牌語備忘録 -pygo

あくまでもメモです。なるべくオフィシャルの情報を参照してください。

牌語備忘録 -pygo

2013-02-01から1ヶ月間の記事一覧

Emacs の helm でバッファを上部に表示させる場合のメモ

(Emacs24.2) emacs-helm/helm · GitHub 希望 切り替えるウインドウにhelmのバッファを表示させたい。 しかも上部にだけ。 下のウインドウはちょい見(C-z)でつかいたい。 問題 ウインドウがひとつの場合は、これでいいかと思ったけど。 (setq helm-split-wi…

Ruby で「a~z」と「あ〜ん」の表示メモ

(Ruby1.93) irb(main):001:0> [*'a'..'z'].join => "abcdefghijklmnopqrstuvwxyz" irb(main):002:0> [*'あ'..'ん'].join => "あぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽま…

Rails3 の Devise でユーザ登録完了メールを送信する場合のメモ

(Rails3.2.11, ruby1.9.3) app/models/user.rb class User < ActiveRecord::Base : def confirm! super if confirmed? UserMailer.completion_of_registration(self).deliver end end app/mailers/user_mailer.rb class UserMailer < ActionMailer::Base def…

Emacs で Common Lisp の環境構築メモ

(Emacs24.2, clisp2.49, MacOSX10.8) Install: clisp sudo port install clisp Install: slime M-x package-list-packages で slime インストール (slime-20130213.745) 修正2013-10-28 init.el ;;;; Common Lisp ;; (setq inferior-lisp-program "ccl64") (…

git でリモートのurlを変更するコマンドのメモ

Git

git remote set-url origin ssh://USERNAME@SERVERNAME:22/var/lib/git/hoge.git

CentOS6.3 に git1.8.1.3 をインストールしてみたメモ

デフォルトで git1.7.1 が入ってたけど、何か微妙なバージョンな気がするので現時点で最新安定版をインンストールしてみた。 Git(Gitの公式サイトってシャレおつなのね。) Downloads - git-core - Git - the stupid content tracker - Google Project Host…

Rspec でテスト内容を出力するコマンドのメモ

忘れるからメモ rake spec SPEC_OPTS="--format documentation"

Rails3 で コントローラからメールが送信されたか Rspec で確認のメモ

(Rails3.2.11) http://railscasts.com/episodes/275-how-i-test?language=ja&view=asciicast 動作確認用プロジェクト作成 $ rails new test_email_in_rspec -T --skip-bundle $ cd test_email_in_rspec Gemfile group :test, :development do gem 'rspec-rai…

Rails3 で delayed_job を利用して非同期でのメール送信メモ

(Rails3.2.11) collectiveidea/delayed_job · GitHub Installation Gemfile gem 'delayed_job_active_record' shell bundle install rails generate delayed_job:active_record rake db:migrate 確認用メーラー作成 rails g user_mailer send_mail config/en…

Rails3 と whenever でバッチ処理のメモ

(Rails3.2.11) javan/whenever · GitHub Installation Gemfile gem 'whenever', :require => false bundle install Getting started $ bundle exec wheneverize . [add] writing `./config/schedule.rb' [done] wheneverized! Example User rails g scaffold…

Emacs から Google Chrome を Applescript でリロードするメモ(MacOS only)

(MacOSX 10.8, Emacs 24.2, Google Chrome 24.0) How To AppleScript ~/.emacs.d/reload-chrome.scpt tell application "Google Chrome" tell active tab of first window execute javascript "window.location.reload()" end tell end tell Emacs init.el (…

Railsレシピ087『rails consoleでモデルを操作する』の記事の中の「yメソッド」が効かない件のメモ

(ruby1.9.3, rails3.2.11) Case irb(main):001:0> y User.first.attributes User Load (0.3ms) SELECT `users`.* FROM `users` LIMIT 1 NoMethodError: undefined method `y' for main:Object Answer Rails console 'y' helper returns NameError rather tha…

Rubyのブロックのメモ

(Ruby1.9.3) def foo(a) yield a end puts foo(10) {|x| x * 2} # >> 20 def bar(option) yield option end puts bar(a: 2, b: 3) { |o| o[:a] + o[:b] + 10 } # >> 15

Pythonでリスト内包表記を使った処理をRubyで書くとしたらメモ

(Python2.7, Ruby1.9) Python print [name.upper() for name in ["foo", "bar"]] # >> ['FOO', 'BAR'] これをmapで print map(lambda x: x.upper(), ["foo", "bar"]) # >> ['FOO', 'BAR'] python久々すぎて、にメソッド名の後に括弧いれるの忘れて戸惑ってし…

Rubyのmapとinjectのメモ

(Ruby1.9.3) seq = ["foo", "bar"] p seq.inject(0) { |sum, str| sum + str.length } # >> 6 p seq.map(&:length) # >> [3, 3] p seq.inject(:+) # >> "foobar" p seq.map(&:length).inject(:+) # >> 6 Rubyによる関数型プログラミング

Ruby で 1/0 のメモ

(Ruby1.9.3) p 1/0 # >> ZeroDivisionError p 1.0/0 # >> Infinity Infinity!?

2013年に勉強すること(予定)

基礎をしっかり固めたい Rails Ruby Server CentOS DB DB設計 MySQL Programming 基礎的な事? リファクタリング Clojure On Lisp 読み切る Business お金の稼ぎ方