Skip to content

Instantly share code, notes, and snippets.

def increment(x, y)
n = 1
while n < x
puts n
n += y
end
end
// with option to choose from where it starts
nodes = { a:[], b:[], c:[], d:[] }
nodes[:a] << nodes[:a]
nodes[:a] << nodes[:b]
nodes[:b] << nodes[:a]
nodes[:b] << nodes[:c]
p nodes
#=> {:a=>[[[...], []], [...]], :b=>[[[...], [...]], []], :c=>[], :d=>[]}
-> a = []
=> []
-> a << a
=> [[...]]
-> a.first == a
=> true
.hidden {
display: hidden;
}
.normal:hover .hidden {
display: block;
}
@Jauny
Jauny / arraymode
Created August 16, 2012 19:19
calculate the mode of an array
def mode(array)
h = Hash.new
array.uniq.each do |x|
h[x] = array.count(x)
end
h.select{|k,v| v == h.values.max }.map{|i| i[0] }
end
@Jauny
Jauny / README.txt
Created June 1, 2012 23:34
Multiple SimpleModal
This is a modified version of Eric Martin's Simplemodal jQuery popup to allow you to easily add multiple links/popups on the same page.
http://www.ericmmartin.com/projects/simplemodal/
I am a noob and had trouble finding material on how to do that... so here is my version :)
Thanks to Eric Martin for making that amazing jQuery function,
Thanks to Alex, a friend, to help me with his magic to make everything work!
Cheers!
@Jauny
Jauny / facebook.cpp
Created May 24, 2012 12:37 — forked from anonymous/facebook.cpp
Facebook interview solution
//Solution à l'interview de Facebook
//Edmond La Chance UQAC 2012
//02:10 2012-05-24
//Énoncé : http://pastebin.com/4FNndtNV
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;