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
/** @jsx React.DOM */ | |
var ReadingTimeWidget = React.createClass({ | |
getInitialState: function() { | |
return ({ | |
secondsRequired: null, | |
}); | |
}, | |
componentWillMount: function() { | |
var cdiv = this.props.contentDiv; |
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
import csv | |
import json | |
from collections import defaultdict | |
datafiles = ['./GL{0}.TXT'.format(x) for x in range(1960,2014)] | |
counts = defaultdict(lambda: defaultdict(lambda: defaultdict(int))) | |
max_i = 0 |
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
/** @jsx React.DOM */ | |
FBLoginMessageComponent = new React.createClass({ | |
render: function() { | |
var status = this.props.status; | |
var message = ''; | |
if (status === 'logged_in') { | |
message = 'You\'re already logged in.'; | |
} else if (status === 'not_logged_in') { | |
message = 'You\'re not logged in yet.'; |
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
#!/usr/bin/env python | |
# usage: choices choice_a 1 choice_b 5 choice_c 4 | |
# will return choice_a 10% of the time, choice_b 50% of the time | |
# and choice_c 40% of the time | |
from random import randrange | |
import sys | |
options = [] |
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
(require db openssl) | |
; connect to a Amazon RDS MySQL instance using SSL | |
(define sslcontext | |
(let ([ctx (ssl-make-client-context 'tls)]) | |
(ssl-load-verify-root-certificates! ctx "./rds-combined-ca-bundle.pem") | |
(ssl-set-verify! ctx #t) (ssl-set-ciphers! ctx "DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2") | |
(ssl-seal-context! ctx) | |
ctx)) |
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
package com.biesnecker.scalajetty | |
import cc.spray._ | |
import org.eclipse.jetty.server.Server | |
import org.eclipse.jetty.xml.XmlConfiguration | |
import org.eclipse.jetty.webapp.WebAppContext | |
import java.io.File | |
object ScalaJetty { |
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
#################### | |
# Akka Config File # | |
#################### | |
# This is the Akka config template to be used for spray SERVLET CONTAINER deployments | |
akka { | |
version = "1.1.3" # Akka version, checked against the runtime version of Akka. | |
# spray requires nothing but akka-actors, which are implicitly enabled |
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
(ns nadsack.utils.queue | |
(:import (java.util.concurrent BlockingQueue LinkedBlockingQueue))) | |
(defn- generic-worker [worker-function #^BlockingQueue queue switch] | |
(future | |
(let [worker-id (.toString (java.util.UUID/randomUUID))] | |
(while (not (realized? switch)) | |
(let [work-item (.take queue)] | |
(cond |
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
(import '(org.joda.time LocalDate)) | |
(defn today [] (LocalDate.)) | |
;; basic functions to increment or decrement a date | |
(defn inc-date [#^LocalDate ds] (.plusDays ds 1)) | |
(defn dec-date [#^LocalDate ds] (.minusDays ds 1)) | |
;; generate infinite streams of LocalDate objects starting with start-ds | |
(defn inc-date-stream [#^LocalDate start-ds] (iterate inc-date start-ds)) |
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
(def charvals (apply vector "ABCDEFGHJKMNPQRSTUVWXYZ23456789")) ; some characters weren't allowed in the codes | |
(defn rand-char [] (charvals (rand-int (count charvals)))) | |
(apply str (take 10 (repeatedly rand-char))) |
OlderNewer