This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
module ProMotion | |
class StaticPageView < PageView | |
def self.method_missing(method_name, obj_or_klass, *args) | |
options = args.last if args.last.is_a?(Hash) | |
options ||= {} | |
# then do rest | |
end | |
end | |
end |
This file contains 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
# Option 1 | |
info = if publication | |
"Title: #{ publication.title } (ID: #{ publication.id })" | |
else | |
'N/A' | |
end | |
# Option 2 | |
info = case publication | |
when Publication then puts "Title: #{ publication.title } (ID: #{ publication.id })" |
This file contains 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 f(&b) | |
var_inside_method = :foo | |
binding_of_this_method = binding | |
binding_of_block = b.binding | |
binding_inside_block = b.call | |
eval "p local_variables", binding_of_this_method | |
eval "p local_variables", binding_of_block | |
eval "p local_variables", binding_inside_block |
This file contains 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
class MenuBarController | |
def initialize | |
# Create our status bar for the application | |
puts "Initializing....." | |
# menuZone = NSMenu.menuZone() | |
# menu = NSMenu.allocWithZone(menuZone) | |
menuItem = NSStatusBar.systemStatusBar.statusItemWithLength(NSVariableStatusItemLength) | |
# And set it's details |
This file contains 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
require 'time' | |
git = ARGV.shift | |
svn = ARGV.shift | |
class Git2SVN | |
def initialize(git, svn) | |
@git = git | |
@svn = svn | |
@repo = File.expand_path File.join(@svn, "repo") |
This file contains 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
require 'rubygems' | |
require 'active_support' | |
def rates | |
o = Object.new | |
def o.summer_months_nbr | |
[6, 7, 8, 9] | |
end | |
o | |
end |
This file contains 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
# Install kicker on osx: sudo gem install kicker --source http://gemcutter.org | |
# | |
# Place a `.kick' file with this code in the root of your project, which contains the file to watch. | |
# Then start running kicker from the project root: $ kicker | |
module Mockup | |
FILE_TO_WATCH = 'mockup-1.psd' | |
def self.last_exported_version | |
FileUtils.mkdir_p 'output' |
This file contains 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
# Uses the kicker gem, a file-change watcher, using OS X FSEvents: | |
# | |
# http://github.com/alloy/kicker | |
# gem install kicker -s http://gemcutter.org | |
# | |
# to send a reload command via Drb to a running spork_server: | |
# | |
# http://github.com/timcharper/spork/ | |
# gem install spork | |
# |
This file contains 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
** Execute stdlib:build | |
./miniruby -I. -I./lib bin/rubyc --internal --arch i386 --arch x86_64 -C "rbconfig.rb" -o "./rbconfig.rbo" | |
./miniruby -I. -I./lib bin/rubyc --internal --arch i386 --arch x86_64 -C "lib/date.rb" -o "lib/date.rbo" | |
./miniruby -I. -I./lib bin/rubyc --internal --arch i386 --arch x86_64 -C "lib/date/format.rb" -o "lib/date/format.rbo" | |
./miniruby -I. -I./lib bin/rubyc --internal --arch i386 --arch x86_64 -C "lib/erb.rb" -o "lib/erb.rbo" | |
./miniruby -I. -I./lib bin/rubyc --internal --arch i386 --arch x86_64 -C "lib/fileutils.rb" -o "lib/fileutils.rbo" | |
./miniruby -I. -I./lib bin/rubyc --internal --arch i386 --arch x86_64 -C "lib/irb.rb" -o "lib/irb.rbo" | |
./miniruby -I. -I./lib bin/rubyc --internal --arch i386 --arch x86_64 -C "lib/irb/cmd/chws.rb" -o "lib/irb/cmd/chws.rbo" | |
./miniruby -I. -I./lib bin/rubyc --internal --arch i386 --arch x86_64 -C "lib/irb/cmd/fork.rb" -o "lib/irb/cmd/fork.rbo" | |
./miniruby -I. -I./lib bin/rubyc --internal --arch i386 --arch x86_64 -C "lib/irb/cmd/help.rb" -o "lib/irb |
OlderNewer