Skip to content

Instantly share code, notes, and snippets.

View eduardo's full-sized avatar

Edu Fernández eduardo

View GitHub Profile
# In reply to my own question
# (http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/#comment-69995567)
# about using git-flow with existing git repos I experimented with a dummy
# git repo and it appears rather straight-forward
kold@Macintosh-27 $ git init test_git_flow
Initialized empty Git repository in /private/tmp/test_git_flow/.git/
(/tmp)
kold@Macintosh-27 $ cd test_git_flow/

Instrument Anything in Rails 3

With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)

Started GET "/" for 127.0.0.1 at Mon Sep 06 01:07:11 -0400 2010
  Processing by HomeController#index as HTML
  User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
  CACHE (0.0ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1

Rendered layouts/_nav.html.erb (363.4ms)

$ sudo su -
# mkdir /etc/resolver
# cat > /etc/resolver/test
nameserver 127.0.0.1
port 2155
^D
^D
$ brew install dnsmasq
$ dnsmasq --port=2155 --no-resolv --address=/.test/127.0.0.1
$ ping foo.test
/*!
* JavaScript whatevCache - v0.2pre - 12/30/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// whatevCache.set( key, value [, ttl ] );
@eduardo
eduardo / large
Created December 26, 2010 21:36 — forked from progrium/large
#!/bin/bash
echo -e "tell application \"Quicksilver\"\nshow large type \"$1\"\nend tell" | osascript
## FORVO PRONOUNCIATION APP FOR TROPO.COM
## by @Skram / [email protected] / blog.marksilver.net
# == TRY IT ==
# SMS: (202) 618-0887
# Jabber: [email protected]
#
# == USAGE ==
# message tropo bot: [a word/phrase/whatever you want to hear in different accents from around the world.]
# example input: gruyere
task :finish do
next if ENV['NOCAMPFIRE']
require "#{rails_root}/lib/campfire"
branch_name = branch.split('/', 2).last
msg = "#{deploying_user}'s #{rails_env} deployment of #{branch_name} is done!"
if rand > 0.7
msg.sub! /done\!$/, 'NOW DIAMONDS!'
end
Campfire.notify msg
end
.gradient (@from: #eee, @to: #ccc) {
background-color: @from;
background-image: -webkit-gradient(linear, left top, left bottom, from(@from), to(@to));
background-image: -moz-linear-gradient(center top, @from, @to);
}
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?
# example of translator snippet
require "translator"
puts Translator.translate("Hello World", "en", "fr")