Skip to content

Instantly share code, notes, and snippets.

View spejman's full-sized avatar

Sergio Espeja spejman

View GitHub Profile
@spejman
spejman / gist:9622
Created September 9, 2008 06:34 — forked from amaia/gist:9463
Provincias y Comunidades Españolas
provincias = ['Alava','Albacete','Alicante','Almería','Asturias','Avila','Badajoz','Barcelona','Burgos','Cáceres',
'Cádiz','Cantabria','Castellón','Ciudad Real','Córdoba','La Coruña','Cuenca','Gerona','Granada','Guadalajara',
'Guipúzcoa','Huelva','Huesca','Islas Baleares','Jaén','León','Lérida','Lugo','Madrid','Málaga','Murcia','Navarra',
'Orense','Palencia','Las Palmas','Pontevedra','La Rioja','Salamanca','Segovia','Sevilla','Soria','Tarragona',
'Santa Cruz de Tenerife','Teruel','Toledo','Valencia','Valladolid','Vizcaya','Zamora','Zaragoza']
comunidades = ['Andalucía','Aragón','Principado de Asturias','Islas Baleares','País Vasco',
'Canarias','Cantabria','Castilla-La Mancha','Castilla y León','Cataluña','Extremadura','Galicia',
'Comunidad de Madrid','Región de Murcia','Navarra', 'La Rioja','Comunidad Valenciana','Ceuta','Melilla']
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'net/http'
class GitHub
def initialize(username)
@username = username
@spejman
spejman / LogIt.scpt
Created September 5, 2009 18:48 — forked from sippey/LogIt.scpt
This is a simple AppleScript designed for use with QuickSilver to log text to a file with a date and timestamp.
using terms from application "Quicksilver"
on process text log_text
set theDate to (do shell script "date '+%m-%d-%Y %H:%M'")
set theText to log_text
set theText to theDate & " " & theText & "
"
set thePosixFilePath to "/Users/msippey/Dropbox/taskpaper/log.txt" as string
set theFilePath to POSIX file thePosixFilePath
set theFileReference to open for access theFilePath with write permission
write theText to theFileReference starting at eof
@spejman
spejman / x
Created December 28, 2009 09:20 — forked from anonymous/x
CmdUtils.CreateCommand({
author: { name: "elbarto", email: "elbarto404@gmail.com"},
description: "search w3schools with google",
name: "w3",
takes: {"w3": noun_arb_text},
preview: function( pblock, searchTerm) {
pblock.innerHTML = "Searches w3schools for: " + searchTerm.text;
},
@spejman
spejman / gist:265292
Created December 29, 2009 12:50
Ubiquity 0.5 command for seaching in Spotify
// Based on http://anders.mellbratt.se/lastspot.html Thanks to Anders Mellbratt
CmdUtils.CreateCommand({
names: ['spotify search'],
arguments: [{role: 'object', nountype: noun_arb_text, label: 'music seach'}],
icon: "http://www.spotify.com/favicon.ico",
description: "Performs a search in Spotify",
author: {name: "Sergio Espeja", email: "sergio.espeja@gmail.com"},
homepage: "http://sergioespeja.com",
preview: function( pblock, args ) {
pblock.innerHTML = "Do a spotify search for: <i>" + args.object.text + "</i>";
// Based on Zhao Lu Ubiquity < 0.5 command
CmdUtils.CreateCommand({
names: ['rails', 'search rails documentation'],
arguments: [{role: 'object', nountype: noun_arb_text, label: 'method'}],
icon: "http://rubyonrails.org/images/rails.png",
homepage: "",
author: {name: "Sergio Espeja", email: "sergio.espeja@gmail.com"},
license: "MPL,GPL",
description: "Search rails documentation",
help: "Type a rails class or method",
# Run rake db:size to get a print of your database size in bytes.
# Run rake db:tables:size to get the sizes for individual tables
# Works for MySQL and PostgreSQL. Not tested elsewhere.
namespace :db do
desc 'Print data size for entire database'
task :size => :environment do
database_name = ActiveRecord::Base.connection.instance_variable_get("@config")[:database]
adapter = ActiveRecord::Base.connection.adapter_name.downcase
~$ ARCHFLAGS='-arch i386 -arch x86_64'
~$ rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes
~$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.0/RubyCocoa-1.0.0.tar.gz/download
~$ tar xzf RubyCocoa-1.0.0.tar.gz && rm RubyCocoa-1.0.0.tar.gz && cd RubyCocoa-1.0.0
~/RubyCocoa-1.0.0$ ruby install.rb config --build-universal=yes
~/RubyCocoa-1.0.0$ ruby install.rb setup
~/RubyCocoa-1.0.0$ sudo ruby install.rb install
# Integration Test for ExceptionNotifier
# Please change this values for your own purposes:
# * UsersController
# * users_path
#
# Author: http://fernandoguillen.info
#
require 'test_helper'
@spejman
spejman / Creating Shazam in Java
Created July 8, 2010 15:29 — forked from mort/Creating Shazam in Java
Algoritmo de Shazam
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?