Skip to content

Instantly share code, notes, and snippets.

View eregon's full-sized avatar

Benoit Daloze eregon

View GitHub Profile
Ceci est un essai de réponse en Ruby à:
http://lasts.goldzoneweb.info/pf.html
require "benchmark"
require "thread"
require "thread/queue"
methods = {
push: -> q { N.times { |i| q.push i } },
pop: -> q { N.times { |i| q.pop } },
empty?: -> q {
(N/2).times { |i| q.empty? }
q.push :tmp
@jwhitmire
jwhitmire / Ode to _why
Created August 20, 2010 02:50
Happy _whyday everybody! In honor of his absence, I've composed a little haiku that I think _why would appreciate. I think you'll agree it's quite ... like the man himself.
_why the lucky stiff
his brain was rare in the world
hackety hack -- brilliant
_why the lucky stiff
we miss him even today
how very poignant
_why the lucky stiff
sometimes didn't make much sense
#!/usr/bin/env ruby
=begin
INSTALL:
curl http://github.com/defunkt/gist/raw/master/gist.rb > gist &&
chmod 755 gist &&
sudo mv gist /usr/local/bin/gist
@ged
ged / parasite.rb
Created November 13, 2010 23:33
More cool/stupid Method#to_proc tricks
#!/usr/bin/env ruby -wKU
### A parasitic class
class Parasite
### Make all future instances of the Parasite actually call
### methods of the +victim+ instead.
def self.infest( victim )
victim.methods.each do |m|
meth = victim.method( m )
require "rubygems"
require "sinatra"
get "/next" do
tell_itunes "next track"
end
get "/previous" do
tell_itunes "previous track"
end
@eregon
eregon / README.md
Created August 19, 2011 18:27
WhyDay 2011: A Binary Clock in Shoes

Binary Clock

A simple and concise (474 bytes minified, 1KB normal) binary clock in Shoes.

Compatible with Shoes 2 (Raisins) and 3 (Policeman).

Design inspired by The Game of Life on the ShoeBox.

@netshade
netshade / american _why
Created August 24, 2011 18:52
_catch the lucky whiff's tribute to _why
A long, long time ago...
I can still remember
How his blog used to make me smile.
And I knew that if he had his chance
That he could make their code enhance
And, maybe, they’d be happy for a while.
But August made me shiver
With every code line I’d deliver.
Bad news on the doorstep;
@josevalim
josevalim / rbx_partial_application.diff
Created September 17, 2011 20:59
Partial application on rubinius. Apply the diff to rubinius project and run `rake build`. Idea by @josevalim, code by @wycats.
diff --git a/lib/compiler/ast/transforms.rb b/lib/compiler/ast/transforms.rb
index 19e1cfb..4e52ec2 100644
--- a/lib/compiler/ast/transforms.rb
+++ b/lib/compiler/ast/transforms.rb
@@ -59,6 +59,71 @@ module Rubinius
end
end
+ # Provide an underscore node that allows partial application in Ruby.
+ # Instead of doing a method call, we are going to generate a lambda
@rlisowski
rlisowski / cert_generator.rb
Last active December 22, 2015 05:29
generate ssl certs
# GENERATE CERTIFICATES
require 'openssl'
class CertGenerator
def self.generate
CertGenerator.new.generate
end
def generate