Skip to content

Instantly share code, notes, and snippets.

View demimismo's full-sized avatar

David Arango demimismo

View GitHub Profile
differ = RSpec::Expectations::Differ.new
puts differ.diff_as_object "Lorem Ipsum is simply dummy text of the printing\n and typeseting industry",
"Lorem Ipsum is simply dummy text of the printing\n and typesetting industry"
Lorem Ipsum is simply dummy text of the printing
- and typesetting industry
+ and typeseting industry
@demimismo
demimismo / gist:3987282
Created October 31, 2012 14:20 — forked from snikch/gist:2582549
Prevent AssetNotPrecompiledError before it occurs.
##
# Checks that the precompile list contains this file or raises an error, in dev only
# Note: You will need to move config.assets.precompile to application.rb from production.rb
def javascript_include_tag *sources
raise_on_asset_absence sources
super *sources
end
def stylesheet_link_tag *sources
raise_on_asset_absence sources
@demimismo
demimismo / combine.rb
Created August 31, 2012 21:04
Combine multiple sheets on xls into a single csv
require 'rubygems'
require 'roo'
require 'iconv'
oo = Excel.new("data.xls")
CSV.open("export.csv", "wb") do |csv|
oo.sheets.each do |s|
oo.default_sheet = s
@demimismo
demimismo / gist:3388600
Created August 18, 2012 17:33
Install cartodb-rb-client github version
Using bundler:
source "http://rubygems.org"
gem 'cartodb-rb-client', :git => 'git://github.com/Vizzuality/cartodb-rb-client.git'
Or manually from source:
git checkout git://github.com/Vizzuality/cartodb-rb-client.git
cd cartodb-rb-client
gem build cartodb-rb-client.gemspec
@demimismo
demimismo / gist:3359506
Created August 15, 2012 11:57
Install Postgresql on Mountain Lion

Install Postgresql on Mountain Lion

Based on: http://coderwall.com/p/1mni7w

brew install postgresql
initdb /usr/local/var/postgres -E utf8
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
set nocompatible " We don't want vi compatibility
syntax on
filetype plugin indent on " Automatically detect file types
colorscheme molokai
set nu " Insert line numbers
set tabstop=2 " Tabs are 2 spaces
set shiftwidth=2 " Tabs under smart indent
@demimismo
demimismo / swap_lines.vim
Created July 4, 2011 07:47
Vim plugin to swap lines
function! s:swap_lines(n1, n2)
let line1 = getline(a:n1)
let line2 = getline(a:n2)
call setline(a:n1, line2)
call setline(a:n2, line1)
endfunction
function! s:swap_up()
let n = line('.')
if n == 1
// 1
var Person = function(name) {
this.name = name;
}
// 2
Person.prototype.getName = function() {
return this.name;
}
var index;
function log(){
console.log(index);
}
function iterate(){
log();
if(index>1) setTimeout(iterate, 1000);
index--;
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?