This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def increment(x, y) | |
| n = 1 | |
| while n < x | |
| puts n | |
| n += y | |
| end | |
| end | |
| // with option to choose from where it starts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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=>[]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -> a = [] | |
| => [] | |
| -> a << a | |
| => [[...]] | |
| -> a.first == a | |
| => true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .hidden { | |
| display: hidden; | |
| } | |
| .normal:hover .hidden { | |
| display: block; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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; |
NewerOlder