Skip to content

Instantly share code, notes, and snippets.

@enriclluelles
enriclluelles / memory.go
Created April 20, 2014 09:46
Consume 2.4gb of RAM firing blocked goroutines
package main
import (
"fmt"
"time"
)
var counter int = 0
var goroutines int = 500000
@enriclluelles
enriclluelles / dabblet.css
Created September 4, 2013 15:14
Rounded arrows with CSS (SO)
/**
* Rounded arrows with CSS (SO)
* http://stackoverflow.com/questions/12461441/rounded-arrows-with-css/12461582#12461582
*/
.arrow {
width: 100px;
height: 100px;
border-radius: 0 0 10% 0;
border: none;
margin: 2em 2.5em;
@enriclluelles
enriclluelles / dabblet.css
Created September 4, 2013 15:14
Rounded arrows with CSS (SO)
/**
* Rounded arrows with CSS (SO)
* http://stackoverflow.com/questions/12461441/rounded-arrows-with-css/12461582#12461582
*/
body {
padding-top: 5em;
background: linear-gradient(left, plum 50%, transparent 50%);
background-size: 5.1em 1px
}
.arrow {
['~>3.2.0', '~>4.0.0rc1'].each do |ver|
pid = fork do
puts ver
gem 'rails', ver
require 'rails/all'
require_relative './lib/route_translator'
routes = ActionDispatch::Routing::RouteSet.new
class PeopleController < ActionController::Base
v=0207;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP
4ZojjV)O>qIH1/n[|2yE[>:ieC "#######% .#" 97N-A&Kj_K_><wS5rtWk@*a+Y5
yH?b[F^e7C/56j|pmRe+:)B "##########: : " O98(Zh)'Iof*nm.,$C5Nyt=
PPu01Avw^<IiQ=5$'D-y? "#############. " g6`YT+qLw9k^ch|K'),tc
6ygIL8xI#LNz3v}T=4W "############: . " lL27FZ0ij)7TQCI)P7u
}RT5-iJbbG5P-DHB<. "############# . " R,YvZ_rnv6ky-G+4U'
$*are@b4U351Q-ug5 "############## " 00x8RR%`Om7VDp4M5
PFixrPvl&<p[]1IJ "# %######### " EGgDt8Lm#;bc4zS^
y]0`_PstfUxOC(q " %#: %##: : " /,}.YOIFj(k&q_V
zcaAi?]^lCVYp!; " #. .:#. . " ;s="v=%04o;ev"%
class Accommodation < ActiveRecord::Base
has_many :pictures
end
@enriclluelles
enriclluelles / explanation
Created July 4, 2012 15:44
Surprising postgres behaviour when paginating with LIMIT and OFFSET
total_points is a not unique field of player. Here its value is 0 for every player
@enriclluelles
enriclluelles / post_office.rb
Created June 19, 2012 12:21
mailing with resque
#encoding: UTF-8
require 'resque_mail'
class PostOffice < ActionMailer::Base
extend ResqueMail
@queue = :mail
end
@enriclluelles
enriclluelles / gist:2946108
Created June 18, 2012 00:04
Event machine terminal sharing
#!/usr/bin/env ruby
require 'eventmachine'
require 'pty'
class ShellServer
class HandlerWriter
def add_source(source)
@sources ||= []
@sources << source
end
@enriclluelles
enriclluelles / gist:2775500
Created May 23, 2012 14:24
Multithreaded seeds
Rails.configuration.cache_classes = true
Rails.configuration.threadsafe!
Rails.configuration.allow_concurrency = true
require "#{Rails.root}/test/factories"
Dir.glob(File.join(Rails.root, 'app', '{lib,app}', '*.rb')).each{|f| require f}
Rails.application.eager_load!
puts "Creating users..."
users = []