This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Select files to work on with :args | |
| :args app/views/*/* | |
| " Perform any action on the previous selected files | |
| :argdo %s/search/replace/gec | update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'date' | |
| require 'mustache' | |
| require 'stringex' | |
| require 'cgi' | |
| export = File.open(ARGV[0]) | |
| target_dir = ARGV[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [color] | |
| diff = auto | |
| status = auto | |
| branch = auto | |
| interactive = auto | |
| [alias] | |
| br = branch | |
| st = status | |
| ci = commit -m | |
| ca = commit -a -m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ENV["RAILS_ENV"] ||= 'test' | |
| if defined?(Bundler) | |
| Bundler.setup(*%w(development test)) | |
| end | |
| require 'rspec' | |
| require 'renum' | |
| require 'active_model' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| changes = { | |
| "Boooking:234" => lambda { |record| record.some_attribute = "new_value" } | |
| } | |
| changes.each do |model_class_and_id, change| | |
| begin | |
| klass = model_class_and_id.split(":").first.constantize | |
| id = model_class_and_id.split(":").last.to_i | |
| print "== Changing #{klass} '#{id}' ... " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def pbcopy(input) | |
| IO.popen("pbcopy", "r+") do |clipboard| | |
| clipboard << input | |
| end | |
| return input | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| run->(e){`curl twitter.com#{e['PATH_INFO']}`=~/_(\d+)"/;[200,{'Content-Type'=>''},[$1]]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env ruby | |
| require 'rubygems' | |
| require 'rb-fsevent' | |
| command = ARGV[0] | |
| fsevent = FSEvent.new | |
| fsevent.watch Dir.pwd do |directories| | |
| system command |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/zsh | |
| bindkey -e '^[[3~' delete-char | |
| # bindkey -v "^[Od" backward-word | |
| # bindkey -v "^[Oc" forward-word | |
| bindkey -e "^A" beginning-of-line | |
| bindkey -e "^E" end-of-line | |
| bindkey -e "^K" kill-line | |
| bindkey -e "^L" clear-screen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| acf, x = [], [] | |
| time_val = 0.002 | |
| i = time_val | |
| # init function 'x[i] = A0 * cos(2*pi*f*i); f = 100Hz' | |
| freq = 100.0 # Hz | |
| sample_window = (freq/time_val).to_i+1 | |
| (freq*2/time_val).to_i.times do | |
| # puts "#{i}: #{2.0*Math::PI*f*i}" |