Skip to content

Instantly share code, notes, and snippets.

View morygonzalez's full-sized avatar
🌴
I may be slow to respond.

Hitoshi Nakashima morygonzalez

🌴
I may be slow to respond.
View GitHub Profile
speculation = fs.read(jsonPath)
data = """
speculation = #{speculation}
"""
page.evaluateJavaScript data
@morygonzalez
morygonzalez / fizzbuzz.rb
Created March 21, 2011 15:43
TDD Boot Camp 福岡
#-*- coding: utf-8 -*-
class FizzBuzz
def fizzbuzz(num)
return "FizzBuzz" if num % 15 == 0
return "Buzz" if num % 5 == 0
return "Fizz" if num % 3 == 0
num.to_s
end
@morygonzalez
morygonzalez / cleanup.rb
Created April 5, 2011 08:53
directory clean up (stub)
dir = Dir::entries(Dir::pwd)
dir.each do |d|
unless /^\./ =~ d
f = File::stat(d)
p [d, f.size, f.uid, f.gid, f.atime, f.mtime, f.ftype]
end
end
require "fileutils"
dir = Dir::entries(Dir::pwd)
dir.each do |d|
unless /(^\.|#{__FILE__})/ =~ d
f = File::stat(d)
puts "#{d} is #{(Time.now - f.mtime).div(24*60*60)} days old."
puts "Would you like to remove this file/directory? (y/n)"
answer = gets.chomp
if answer == "y"
perl -pe 's/.+;//' ~/.zsh_history | awk 'BEGIN {FS="|"} {print $1}' | sort | uniq -c | sort -nr | head -10
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
require "rubygems" if RUBY_VERSION < '1.9'
require "json"
require "oauth/cli/twitter"
access_token = OAuth::CLI::Twitter.get_access_token(:file => ENV['HOME'] + '/.favoritter')
def twitter_ary(statuses)

理想の会社

  1. Gitでソースコード管理している。
  2. 会社のGithubアカウントがある。
  3. 外部に公開されている技術ブログがある。
  4. IDEよりVimやEmacsを使うことが奨励されている。
  5. 社員が勉強会に参加することを奨励している。
  6. オープンソースコミュニティに貢献している。
  7. 音楽を聞きながら仕事できる。
  8. Rubyで開発できる。
@morygonzalez
morygonzalez / fix_shebang.rb
Created July 19, 2011 14:27
シバンを直すやつ
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
require "fileutils"
# dir = File::dirname(__FILE__) + '/bin'
dir = "/usr/local/rvm/gems/ruby-1.9.2-p290/bin"
files = Dir::entries(dir)
files.each do |f|
unless f =~ /^\.+$/
@morygonzalez
morygonzalez / bad interpreter
Created July 26, 2011 07:07
rvm migrate and bad interpreter
zsh: /usr/local/rvm/gems/ruby-1.9.2-p290/bin/rake: bad interpreter: /usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby: no such file or directory
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:2377:in `raw_load_rakefile'
(See full trace by running task with --trace)
@morygonzalez
morygonzalez / .ssh config
Created August 22, 2011 11:04
.ssh/config
ServerAliveInterval 100
Host *
ControlMaster auto
ControlPath /tmp/%r@%h:%p