Skip to content

Instantly share code, notes, and snippets.

View paradoja's full-sized avatar

Abby Henríquez Tejera paradoja

View GitHub Profile
def is_ancestor_of?(other_page)
other_page.is_descendant_of? self
end
@paradoja
paradoja / index.html
Created June 3, 2012 20:07
Playing with node
<html>
<head>
<title> ¡Hola! </title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script>
var server = io.connect('http://localhost:8080');
document.onkeypress = manda;
function manda(event) {
@paradoja
paradoja / factorial.java
Created May 31, 2012 08:44
Recursividad final
/* Este factorial es recursivo, pero operamos de alguna forma la
* llamada recursiva (la multiplicamos por n).
*/
long factorial(long n) {
if (n == 0) {
return 1;
}
else {
return n * factorial(n-1);
@paradoja
paradoja / fizbuzz.hs
Created May 4, 2012 20:53
Haskell's brute force Scala-like inverse fizzbuzz
-- http://www.jasq.org/2/post/2012/05/inverse-fizzbuzz.html
import Control.Applicative -- para <*>
import Data.List -- para sortBy
import qualified Data.Map as M
divides m n = n `mod` m == 0
fizzbuzzTest n = [divides 3, divides 5] <*> [n]