header

2013年6月27日木曜日

Hexoでブログはじめました


Node.jsでブログ書いてみようと思ってHexoを使ってみました。
嘘です。coderwallのバッジを表示したかったけどBloggerでテンプレートいじるのが辛くて
Hexoにしました。英語の練習も兼ねてるので英語でし書かない予定。
(Hexoでcoderwallのバッジを表示する:
http://howdyblog.herokuapp.com/2013/06/25/first-post/)
以下は導入した時のメモ、参考程度に

導入

Node.jsとnpmが利用できることが必要です。


  • Hexoのインストール:

    sudo npm install -g hexo
  • ブログのひな形の作成:

    hexo init project-name
    cd project
  • 新しい記事を作る:

    hexo new "New Post"
  • 編集
    /source/posts以下にNew Postがタイトルのmarkdownファイルができるので編集
    する
  • _config.ymlを編集する
    title, author, language, emailとか、deploy:の項でgithubベースにするかherokuにするかrsyncに設定できる。(詳細は hexoのドキュメント を)
  • markdown形式の記事を反映させる

    hexo generate
  • localhostで出力を確認:
    hexo server

Herokuへのアップロード

ブログをHerokuで公開したかったので、そのあたりの設定をしました。
ここは記憶がちょっとあやふや、というのはheroku login, heroku createを
先におこなってから、hexo deploy or hexo deploy –generateを行ったので
本当に必要なのかちょっとわからない。
hexo deploy –generateすると、/.git/configにherokuのリポジトリが追加された。

git init
heroku login
... register heroku
heroku create
hexo deploy --generate

.git/configに追加branchを追加

Emacsのmagitで履歴表示するのにmasterブランチを追加

[branch "master"]
remote = heroku
merge = refs/heads/master

管理方法

/source/post/以下で記事を書く、hexo generateで反映、リモートにpushって
感じっぽい。
お手軽だけど、テンプレートの部分とapp.jsとpublic以下の部分を分けたい。


2013年6月5日水曜日

Emacsのelectric-pair-modeをコメント行かそれ以外かで動作を変える

Emacs24からの新機能electric-pair-modeをご存知でしょうか?
一度の入力で""や()を2つpairで自動で挿入してくれる機能です。
便利な反面コードの中の文字列を編集しているときに
2つペアで挿入されて違うのに!!って思うことがありました。
そこでflyspell用の関数flyspell-generic-progmode-verifyという、
コメント行かそうでないか判別する関数があったので
それを使ってコードを書いてみました。

(electric-pair-mode)
(require 'init_ispell)
(defun my/electric-pair-mode ()
(interactive)
(if (flyspell-generic-progmode-verify)
(setq electric-pair-mode nil)
(setq electric-pair-mode t)))

(add-hook 'post-self-insert-hook 'my/electric-pair-mode)


まだ設定を変えて使い始めたばかりなので、便利かそうでないかは
みえてきてないのですが、electric-pair-modeに不満のあるかたは
試してみてもよいのではないでしょうか?


2013年4月25日木曜日

Quoted Speach -> Reported Speach

Today I learned about Quoted Speach and Reported Speach.
It can convert to Reported Speach from Quoted Speach.
Q=Quoted Speach, R=Reported Speach

past

Q: "I got a new credit card" she said.
R: she said she had gotten a credit card.


Q: "I went to work at 5" he said.
R: he said he had gone to work at 5.


Q: "I forgat to order your food" she said.
R: she said she had forgotten to order your food.


Q: "I was sleeping when you cold" she said.
R: she said she had been sleeping when I cold.

present

Q: "It's a good idea" he said.
R: he said it was a good idea.


Q: "I can't pay for it" he said.
R: he said he couldn't pay for it.


Q: "I live in Gardena" she said.
R: she said she leved in Gardena.


Q: "I can't go to the party" she said.
R: she said she she couldn't go to the party.

future

Q: "I'm going to go shopping" she said.
R: she said she was going to go shopping.


Q: "I'll finish later" he said.
R: he said he would finish later.

present parfect

Q: "I haven't written my composition" she said.
R: she said she hadn't written her composition.


Popular Posts

Blogger templates

Blogger news