Skip to content

Instantly share code, notes, and snippets.

View aitor's full-sized avatar
👊
Working!

Aitor García Rey aitor

👊
Working!
View GitHub Profile
.DS_Store
myapp/
sentinel = 'Rails::Initializer.run do |config|'
gsub_file 'config/environment.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
"\nrequire 'desert'\n#{match}"
end
def gsub_file(path, regexp, *args, &block)
content = File.read(path).gsub(regexp, *args, &block)
File.open(path, 'wb') { |file| file.write(content) }
end
# Lighter -- Campfire from the command line
# usage: ruby lighter.rb subdomain "Main Room" macournoyer@gmail
require "rubygems"
require "tinder"
require "readline"
require "highline/import"
class Lighter
def initialize(room)
@room = room
# Mimic Mac OS X Finder's sort by name.
class Array
def finder_sort
sort { |a, b| a.to_finder_sort <=> b.to_finder_sort }
end
end
class String
def to_finder_sort
result = self.dup
@aitor
aitor / license
Created January 27, 2010 10:34 — forked from defunkt/license
#!/bin/sh -e
# Usage: license
# Prints an MIT license appropriate for totin' around.
#
# $ license > COPYING
year=`date "+%Y"`
cat <<EOF
Copyright (c) $year Aitor García
Permission is hereby granted, free of charge, to any person obtaining
- Una presentación sobre nada
"nothing happens on the show. You see, it's just like life. You know, you eat, you go shopping, you read.. You eat, you read, You go shopping." (Seinfield)
- The Lunar Society
"The Lunar Society of Birmingham was a dinner club and informal learned society of prominent industrialists, natural philosophers and intellectuals who met regularly between 1765 and 1813 in Birmingham, England."
- John Snow - The Ghost Map
"John Snow (15 March 1813 – 16 June 1858) was a British physician and a leader in the adoption of anaesthesia and medical hygiene. He is considered to be one of the fathers of epidemiology, because of his work in tracing the source of a cholera outbreak in Soho, England, in 1854."
- Historias individuales intricadas en un marco histórico
@aitor
aitor / client.rb
Created May 29, 2010 16:24 — forked from tobi/client.rb
STDOUT.sync = true
require 'queue'
start_time = Time.now.to_i
msg = 0
queue = Queue.new("testing")
queue.subscribe do |obj|
msg += 1
# Export your Wordpress posts to Tumblr (also allows to delete some.)
# Author: Alexandre Solleiro <alex@webcracy.org>
# How-to:
# 1. Export your Wordpress posts (http://en.blog.wordpress.com/2006/06/12/xml-import-export/)
# 2. Edit the information below to match your settings
# 3. To import, type "ruby wordpress2tumblr.rb --run" in the command line
# 4. To delete some posts, type "ruby wordpress2tumblr.rb --delete 1,2,3,4" where 1,2,3,4 are post numbers. (Be careful not to use spaces between IDs)
# Edit these
WP_EXPORT_PATH = "./wordpress.2009-09-14.xml" # path to the Wordpress Export file
@aitor
aitor / wadus.rb
Created July 2, 2010 10:53 — forked from porras/wadus.rb
def wadus(wadus = nil, options = {})
puts "wadus = #{wadus.inspect}"
puts "options = #{options.inspect}"
end
wadus
# wadus = nil
# options = {}
# OK
A backup from http://sites.google.com/site/redcodenl/creating-shazam-in-java-1 just in case
----
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?