This file contains 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 was an attempt to do genetic algorithms in python for the 2012 MCM competition. | |
#http://www.comap-math.com/mcm/index.html | |
#It usually works. | |
#How many boats get passed through for each 10? | |
#Make a table | |
import random | |
import pygame | |
from operator import itemgetter, attrgetter |
This file contains 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
// If you need a handy color picker try http://hslpicker.com | |
// Or look at octopress/sass/base/solarized.scss for inspiration. The colors in there are excellent. | |
// The following are ordered in terms of vague importance. | |
//Pick your favorite color. If you picked a thoughtful blue, try again. | |
$main-color: #6c71c4; | |
//This controls the background. | |
$page-bg: lighten($main-color,20); |
This file contains 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
eZ <- function(u){x=rnorm(1000000);mean(x[x>u])} | |
eP <- function(u){dnorm(u)/(1-pnorm(u))} | |
ep = eP((-400:400)/100) | |
ez = sapply((-400:400)/100,eZ) | |
png("qqplot.png") | |
qqplot(ez,ep) | |
dev.off() |
This file contains 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 to inverse fizzbuzz | |
;;http://www.jasq.org/2/post/2012/05/inverse-fizzbuzz.html | |
;;TODO: Uses the top comment from hacker news | |
(ns faster.core | |
(:use clojure.test)) | |
;;Simple fizzbuzz function | |
(defn fizzbuzz [n] | |
(str (when (zero? (mod n 3)) "fizz") | |
(when (zero? (mod n 5)) "buzz"))) |
This file contains 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
#Not valid coffeescript, but close | |
generate = {} | |
generate.ip = ()-> | |
numbers = (Math.round(Math.random()*255)+1) for i in [0..4] | |
numbers.join(".") | |
generate.user_agent = ()-> | |
["Mozilla","Apple","Windows","Etc"].random() |
This file contains 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
//With statement doesn't do what I hoped, which was overriding the whole smear of things. | |
//Actually, just not possible with closures at all I don't think. Once a value has been bound, there isn't much you can do. | |
Function.prototype.bind_global = function bind_global(ctx) { | |
return (function(t,args){ | |
return function() { | |
var g = [].slice.call(args,1,2); | |
g = g ? g : window; | |
with(g){ | |
return t.apply(ctx, [].slice.call(args, 2)); | |
} |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script> | |
<script type="text/javascript" src=https://raw.github.com/gist/2941416/24172d26b3c802f5be54b3411863822cad6b8538/tooltip.custom.js"></script> | |
<script type="text/javascript" src="https://raw.github.com/gist/2941416/39fbe358eb3256e62401e2403735907fbe3f7a75/popover.js"></script> | |
</head> | |
<body> | |
<div id="chart"></div> |
This file contains 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
<!doctype html> | |
<head> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} | |
#main { | |
left: 25%; | |
position: absolute; | |
} |
This file contains 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
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js"></script> | |
</head> | |
<body> | |
<div id="chart"> | |
</div> | |
<script type="text/javascript"> | |
var w = 960, |
This file contains 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
var BubbleChart, root, | |
__bind = function(fn, me){ | |
return function() | |
{ return fn.apply(me, arguments); | |
}; | |
}; | |
BubbleChart = (function() { | |
BubbleChart.name = 'BubbleChart'; |