なんでわざわざ抽出タブ作ってるか理由を説明するのは面倒くさいから省く
ただリストから抽出タブを作ってる人は他にもいるみたいでどうにか自動化出来ないかなと書いてみた
- Mac 使ってる
- YoruFukurou 使ってる
- Ruby が入ってる
def dress(dog_or_dogs) | |
dressed_dogs = Array(dog_or_dogs).map {|dog| DogSweater.new(dog) } | |
dog_or_dogs.respond_to?(:each) ? dressed_dogs : dressed_dogs.first | |
end | |
one_dog = dress(Dog.new) | |
all_my_dogs = dress([Dog.new, Dog.new, Dog.new]) |
# https://github.com/barsoom/attr_extras | |
require "attr_extras" | |
class UserSession | |
pattr_initialize :controller, :session_key, :finder | |
# NOTE: Not memoized yet. | |
def user | |
if id | |
finder.find(id) |
gem 'redcarpet' | |
gem 'pygmentize' |
servers = ( | |
{ | |
address = "irc.freenode.net"; | |
chatnet = "freenode"; | |
port = "6667"; | |
use_ssl = "no"; | |
ssl_verify = "no"; | |
autoconnect = "yes"; | |
} | |
); |
# | |
# This config file is a combination of ideas from: | |
# http://www.37signals.com/svn/posts/1073-nuts-bolts-haproxy | |
# http://www.igvita.com/2008/05/13/load-balancing-qos-with-haproxy/ | |
# http://wiki.railsmachine.com/HAProxy | |
# http://elwoodicious.com/2008/07/15/nginx-haproxy-thin-fastcgi-php5-load-balanced-rails-with-php-support/ | |
# http://upstream-berlin.com/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/ | |
# http://wiki.railsmachine.com/HAProxy | |
# http://gist.github.com/raw/25482/d39fb332edf977602c183194a1cf5e9a0b5264f9 | |
# |
When I tried run "rake test", I received: | |
rake aborted! | |
cannot load such file -- openssl | |
Tasks: TOP => test:units => test:prepare => db:test:prepare => db:abort_if_pending_migrations => environment | |
(See full trace by running task with --trace) | |
# app/models/ability.rb | |
# All front end users are authorized using this class | |
class Ability | |
include CanCan::Ability | |
def initialize(user) | |
user ||= User.new | |
can :read, :all |
Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.
cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/