Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh -
#
# new_tab.sh v0.01
#
# Script to open a new tab on MacOSX's terminal from the command line
#
# Usage:
# new_tab.sh -> opens new tab in current directory
# new_tab.sh /tmp -> opens new tab in /tmp
# new_tab.sh /tmp ls -> opens new tab in /tmp and executes ls
# Quick & Dirty textmate command to execute the current Rails test file
#
# 1) Open Bundles > Bundle Editor > Edit commands
# 2) Select Ruby > Run and press "copy" icon (++)
# 3) Rename the new command and select it
# 4) Paste this into Command(s) and customize the activation keys
cd ../..
#/opt/local/bin/ruby -I=test $TM_FILEPATH
export RUBYLIB="$TM_BUNDLE_SUPPORT/RubyMate${RUBYLIB:+:$RUBYLIB}"
export RUBYLIB="test:$RUBYLIB"
# Quick & Dirty textmate command to execute only the selected test on the current Rails test file
# Note: It's so quick and so dirty that it doesn't support the new 'test "foo bar baz" do' syntax
#
# 1) Open Bundles > Bundle Editor > Edit commands
# 2) Select Ruby > Run Focused Unit Test and press "copy" icon (++)
# 3) Rename the new command and select it
# 4) Paste this into Command(s) and customize the activation keys
cd ../..
# class to test
require 'rubygems'
require 'active_record'
class Post < ActiveRecord::Base
validates_presence_of :title
before_save :create_slug
# spanish dummy group
class AppServer
attr_accessor :admin_password
end
-- AppleScript doesn't load shell's environment variables
-- in "do shell script", so here goes a nasty workaround
on shell_cmd(command)
do shell script "source ~/.profile; " & command
end shell_cmd
do shell script "echo $EDITOR" -- => ""
shell_cmd("echo $EDITOR") -- => "mate"
# arrays can be used as a kind of circular list
a = ['a','b','c']
(1..20).each{ |n| puts a[n%a.size]} # forward
(-10..0).each{ |n| puts a[n%a.size]} # backwards
# Dieta para verano:
- desayuno: galletas de fibra + café/infusión (en mi caso limonada casera)
- media mañana: fruta (1 ó 2 melocotones o 3 rodajas piña al natural o 2 rodajas de sandía)
- comida: verdura hervida, a la plancha, en conserva o ensalada a tutiplén. Filete de vaca, de pollo o pescado blanco a la plancha. Sin límite de cantidad, cébate!
- media tarde: fruta, como a media mañana
- cena: como la comida + un yogur desnatado o infusión.
- Recomendaciones ;)
- si no la tienes, compra una sartén antiadherente de verdad y límpiala justo después de usarla: podrás hacer cosas a la plancha sin usar aceite y podrás usar más de este para aliñar ensaladas y verduras
- si echas de menos las salsas, prueba a combinar especias, cebolla, ajo, limón... sirven para animar cualquier plato, por insulso que sea
# rack mapping example
# run at port 9292 with "rackup config.ru"
require 'path_to_my_rails_app/config/environment'
app1 = Rack::Builder.new {
map "/" do
use Rails::Rack::Static
run ActionController::Dispatcher.new
end
}.to_app
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?