Skip to content

Instantly share code, notes, and snippets.

require 'cuba'
require 'rack/async'
queue = Queue.new
class Async
def initialize(queue)
@queue = queue
end
@elcuervo
elcuervo / gist:1969242
Created March 4, 2012 00:13
Fix psych errors
# Fix Psych Warnings and failures
brew install libyaml
rvm reinstall ruby-1.9.2 --with-libyaml-dir=/usr/local
@elcuervo
elcuervo / guita
Created March 15, 2012 14:33 — forked from dcadenas/guita.rb
Script para ver el estado de una cuenta del banco Itaú Uruguay
#!/usr/local/bin/ruby
# encoding: UTF-8
require 'rubygems'
gem 'mechanize'
gem 'main'
gem 'highline'
gem 'money'
gem 'change_watcher'
@elcuervo
elcuervo / gist:2430999
Created April 20, 2012 18:50
EM send data popen
IO.popen('./test') do |io|
begin
while line = io.readline do
send_data line
end
rescue EOFError => e
end
end
@elcuervo
elcuervo / nginx.conf
Created August 10, 2012 19:33
Nginx CORS config
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'POST, OPTIONS';
add_header 'Access-Control-Max-Age' '1728000';
add_header 'Content-Type' 'text/plain; charset=UTF-8';
return 200;
}
}
# Autoload .env files
load_env_file() {
if [ -f ".env" ]; then export $(grep -v '#' .env); fi;
}
# Load for .env files when changing dir
chpwd() { load_env_file }
@elcuervo
elcuervo / benchmarks.txt
Created November 20, 2012 18:47
Minuteman usage example
# Running benchmarks:
Minuteman 1 10 100 1000 10000
bench_AND 0.000838 0.000279 0.000287 0.000319 0.000307
bench_MINUS 0.000393 0.000490 0.000513 0.000491 0.000510
bench_NOT 0.000273 0.000269 0.000320 0.000353 0.000685
bench_OR 0.000363 0.000282 0.000356 0.000330 0.000326
bench_XOR 0.000263 0.000277 0.000308 0.000306 0.000358
bench_complex_operations 0.000389 0.000507 0.000505 0.000600 0.000725
@elcuervo
elcuervo / DashCat.md
Last active October 13, 2015 23:18
Suggestions and bug reports of DashCat

What is DashCat?

It's a twitter-like GitHub browser. I've made it the last weekend for me but seems to be something cool for some people.

DashCat

What is this Gist

It's a place where I can discuss stuff of the app

@elcuervo
elcuervo / rand_in_range.go
Created May 28, 2013 14:30
Random int in range
package main
import(
"fmt"
"math/rand"
"time"
)
func random(min, max int) int {
rand.Seed(time.Now().Unix())
return rand.Intn(max - min) + min
@elcuervo
elcuervo / dom
Created May 29, 2013 20:38
Check domain
#!/usr/bin/env ruby
# encoding: utf-8
%w(json open-uri).each { |lib| require lib }
abort "Usage: #{File.basename __FILE__} [query]" unless ARGV.first
response = open("http://domai.nr/api/json/search?q=#{ARGV.first}").read
JSON.parse(response)["results"].each do |domain|