Skip to content

Instantly share code, notes, and snippets.

View bomberstudios's full-sized avatar
🍊
Thinking

Ale Muñoz bomberstudios

🍊
Thinking
View GitHub Profile
@bomberstudios
bomberstudios / profile.sh
Created August 28, 2008 09:34
My .bash_profile
##### EXPORTS ################################################################
export PATH=/opt/local/bin:/opt/local/sbin:$HOME/bin:$PATH
export LC_CTYPE=en_US.UTF-8
# Editors
export EDITOR='mate -w'
export SVN_EDITOR='mate -w'
export GIT_EDITOR='mate -w'
# for Editor Kicker: http://editorkicker.rubyforge.org/
export EDITOR_KICKER="mate -l %s '%s'"
@bomberstudios
bomberstudios / Twit This Service.rb
Created September 28, 2008 19:22
"Twit This" service for Mac OS X
#!/usr/bin/env ruby
# Get ThisService from http://wafflesoftware.net/thisservice/
# Use this .rb file with Type: "Acts on Input" and click "Create Service"
# From now on, you can twit the selected text in *any* Cocoa application by
# selecting Application menu » Services » Twit This
#
# The first time you use it you'll be prompted for authorisation to use your
# saved user and password from Keychain.app
input = STDIN.gets nil
@bomberstudios
bomberstudios / sinatra_sample_app.rb
Created September 29, 2008 10:07
the simplest sinatra app
# Sinatra sample app.
#
# Usage:
# $ sudo gem install sinatra
# $ ruby this_file.rb
# $ open http://0.0.0.0:4567/
require "rubygems"
require "sinatra"
@bomberstudios
bomberstudios / vdiff.rb
Created September 30, 2008 12:01
A crude image comparison tool
#!/usr/bin/env ruby
#
# A crude image comparison tool.
#
# Usage:
# vdiff original_image modified_image
require "rubygems"
require "RMagick"
@bomberstudios
bomberstudios / busca_dominios.rb
Created November 11, 2008 09:39
Buscador de dominios .com disponibles
# Shell script para buscar dominios disponibles a partir de listas de palabras.
# Acepta un fichero como parámetro, y por defecto usa el listado de lemas de
# http://olea.org/proyectos/lemarios/
#
# Para cambiar el criterio de búsqueda, modifica la condicion de la primera línea
# con los parámetros que necesites
condicion = lambda{ |i| i.length >= 3 }
INPUT_FILE = ARGV[0] || "lemario-espanol-2002-10-25.txt"
# RAE
require "rubygems"
require "curb"
require "hpricot"
def url_for word
"http://buscon.rae.es/draeI/SrvltGUIBusUsual?LEMA=#{word}&origen=RAE&TIPO_BUS=3"
end
def get_definition_for(word)
@bomberstudios
bomberstudios / test_unit_hacks.rb
Created December 6, 2008 16:22
a small hack to create tests by using test "Description of the test" do <your code here> end
class Test::Unit::TestCase
def self.test(name, &block)
test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
defined = instance_method(test_name) rescue false
raise "#{test_name} is already defined in #{self}" if defined
if block_given?
define_method(test_name, &block)
else
define_method(test_name) do
flunk "No implementation provided for #{name}"
# A Python plugin for VoodooPad.
# It searches for tag_name appearances in your document and adds the text after it to
# a new list_page page.
VPScriptSuperMenuTitle = "GTD"
VPScriptMenuTitle = "Update @todo list"
VPShortcutKey = "T"
VPShortcutMask = "control"
import time
@bomberstudios
bomberstudios / in-file_templates.rb
Created March 5, 2009 07:44
a small sample of how to use ERB templates in your file without making your code fugly
require 'erb'
files = Dir.glob("*")
templates = DATA.read.split("---")
templates.each do |template|
ERB.new(template, nil, '%-').run
end
__END__
package {
#!/usr/bin/env bash
# A script to create a new remote git repo in git
#
# 1. Make sure to setup ssh keys for passwordless logins
#
# 2. Add this to $HOME/.ssh/config:
# Host git
# HostName your.domain.com
# User username