Skip to content

Instantly share code, notes, and snippets.

View sadasant's full-sized avatar
👁️

Daniel Rodríguez sadasant

👁️
View GitHub Profile
@sadasant
sadasant / Resources
Created May 4, 2012 19:27 — forked from csanz/hackathons101.md
Hackathons 101
How to organize and run your own hackathon by Peter Moran: https://www.youtube.com/watch?v=1nk2zJ2GTkQ
@sadasant
sadasant / fly.js
Created February 10, 2012 18:24
fly
// 1kFly.js ~ sadasant.com
// http://jsbin.com/aluyax/3
function fly(f,mx,my,gx,gy,tx,ty,b,X,Y,x,y,i,r,M,a,w,W,w1){
with(document){
var h=["☼❤☼"," ❤"],
P=M.PI*i,A=M.abs,
D=.7+Math.random()*.7,
p=createElement('p'),s,
o=onmousemove;(s=p.style).fontFamily="monospace";s.position="fixed"
body.appendChild(p)
@sadasant
sadasant / euler5.js
Created February 5, 2012 23:57
Euler Problem 5 in JavaScript
// Euclidean Algorithm
function gcd(a,b) { while (b) { var t = b; b = a%b; a = t } return a }
function lcm() { return Array.prototype.reduce.call(arguments, function(a,b){ return (a*b)/gcd(a,b) }) }
// http://projecteuler.net/problem=5
// lcm(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,1,18,19,20)
// but we only need... ehm... primes but from last to first?
lcm(20, 19, 18, 17, 16, 15, 14, 13, 12, 11)