Skip to content

Instantly share code, notes, and snippets.

View alloy's full-sized avatar

Eloy Durán alloy

View GitHub Profile
@alloy
alloy / gist:6339
Created August 20, 2008 08:07 — forked from mmower/gist:6338
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
@alloy
alloy / gist:22408
Created November 5, 2008 19:33 — forked from tenpaiyomi/gist:22407
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
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")
@alloy
alloy / gist:189360
Created September 19, 2009 00:05 — forked from mattetti/gist:189283
require 'rubygems'
require 'active_support'
def rates
o = Object.new
def o.summer_months_nbr
[6, 7, 8, 9]
end
o
end
# 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'
@alloy
alloy / .kick
Created November 6, 2009 10:12 — forked from stepheneb/.kick
# 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
#
** 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 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)
@alloy
alloy / gist:275261
Created January 12, 2010 15:05 — forked from h-lame/gist:275076
##
#
# 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
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?