Skip to content

Instantly share code, notes, and snippets.

@jmateus
jmateus / pi-monte-carlo.py
Created August 10, 2014 14:16
Monte Carlo method for finding pi
from __future__ import division
import random
import sys
import math
def main():
# The first command line argument defines the number of iterations
# of the algorithm. The default value is 400.
if len(sys.argv) > 1:
@jmateus
jmateus / goal.js
Created July 29, 2014 16:15
g()('al')
// Yet another g()('al') solution
// https://github.com/eatnumber1/goal
var g = function (str, calls) {
calls = calls || 0;
if (str) {
return 'g' + Array(calls + 1).join('o') + str;
}