Skip to content

Instantly share code, notes, and snippets.

import time
import random
random.seed(time.clock())
print random.randint(0, 10000);
@djacobs
djacobs / automatedBuildAndUploadToTestflight.sh
Created April 18, 2012 04:20 — forked from amattn/automatedBuildAndUploadToTestflight.sh
Automated Xcode build and upload to TestFlight.
#!/bin/sh
# Current as working as of 2012/4/17
# Xcode 4.3.2
PROJECT_ROOT="$HOME/SomeDirWhereYourProjectLives/XXXXXXXX"
WORKSPACE="$PROJECT_ROOT/XXXXXXXX.xcodeproj/project.xcworkspace"
CONFIG="AdHoc"
SCHEME="XXXXXXXX"
@djacobs
djacobs / propubnerd-gists.md
Created March 26, 2012 17:07 — forked from kleinmatic/propubnerd-gists.md
ProPubNerd Gists

Open Source code doesn’t always come in big complex packages. At ProPublica we sometimes share small, simple snippets of using GitHub "Gists." These Gists range from single-byte file delimiters to an entire JavaScript framework for making stepper graphics. They rarely have documentation and don’t even always have names, but they can be super-useful. Here are some we’ve shared over the past few years:

@djacobs
djacobs / euler24.js
Created November 30, 2011 04:22
Euler 24 solution
#!/usr/local/bin/node
// basic problem setup
// the answer we want for the millionth iteration is 2783915460
var iteration = 999999;
var size = 2;
// figure out the size of the largest factorial smaller than our target iteration
var tempi = iteration;
@djacobs
djacobs / primes.js
Created November 12, 2011 17:56
Euler 7 (for Jake)
primecount=1;
i=3;
while(primecount < 10001)
{
// console.log("looking at " + i);
isprime = true;
for (j=(Math.floor(Math.sqrt(i))); j > 1; j--) {
// for (j=2; j < (Math.floor(Math.sqrt(i)) + 1); j++ ) {
@djacobs
djacobs / gist:1356267
Created November 10, 2011 21:20
Solving Euler problems with @jakedobkin
use strict;
#use bigint;
use constant TARGET => 20;
use constant VERBOSE => 1;
my $total = 0;
my %fib;
sub fib($)
use strict;
use POSIX;
use bignum;
use constant DEBUG => 0;
my $count = 0;
my $x = 2 ** 1043;
my @s = split(//,$x."a");
@djacobs
djacobs / gist:855940
Created March 5, 2011 00:03
Every app on my air
Apps installed...
Soulver
Textmate
Tinkertool
Xcode
Chrome
FaceTime
Evernote
Marsedit
Perian
@djacobs
djacobs / gist:848569
Created March 1, 2011 03:35
Newbie plack mistake
# shebang
use constant USER => 'xxxx';
use constant PASS => 'xxxx';
# libraries
use CGI::PSGI;
use Data::Dumper;
use File::Glob qw(:globally :nocase);
use JSON;
function domReady(callback) {
var domLoaded;
var called;
var onReadyStateChange = function () {
if (document.readyState == 'complete') {
domLoaded();
}
};