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 |
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
This is basically a dirty hack :) I have no idea if messing with the default OSX apache config this way is frowned upon. My view is that it works now, and if it breaks I'll fix it. | |
Add any domains you want to blacklist to /etc/hosts, pointing at 127.0.0.1. You need to enable web sharing to get apache running of course. | |
Changes to the default /etc/apache2/httpd.conf | |
============================================== | |
Listen 127.0.0.1:80 # so that the world can't see the list | |
DocumentRoot "/Library/WebServer/Documents/public" # to fit in with passenger, you need to create the public dir (and maybe /tmp too) |
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
## | |
# | |
# Automatic | |
# | |
class Developer < ActiveRecord::Base | |
has_many :audit_logs # the macro checks if it can find an obvious inverse_of, but none is found | |
end | |
class AuditLog < ActiveRecord::Base |
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
A backup of http://sites.google.com/site/redcodenl/creating-shazam-in-java-1 just in case | |
Why is this necessary? Read http://sites.google.com/site/redcodenl/patent-infringement | |
Please fork, tweet about, etc. | |
---- | |
Creating Shazam in Java | |
A couple of days ago I encountered this article: How Shazam Works | |
This got me interested in how a program like Shazam works… And more importantly, how hard is it to program something similar in Java? |
OlderNewer