This file contains hidden or 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 random | |
# Implementation of Resevoir Algorithm, see | |
# http://stackoverflow.com/a/3540315/1424361 | |
def random_line(contestants): | |
line = next(contestants) | |
line2 = line | |
# go through each line, check to see if we | |
# should select it, with decreasing probability | |
# over time |
This file contains hidden or 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
Show hidden characters
{ | |
"bitwise":true, | |
"curly": true, | |
"eqeqeq": true, | |
"immed": true, | |
"indent": 4, | |
"latedef":true, | |
"newcap": true, | |
"nonew":true, | |
"quotmark":"single", |
This file contains hidden or 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
/* jshint ignore:start */ | |
/** This file is a bit of a hack to make the requireJS build paths available | |
* both in the browser and for gulp. There's some ugliness requires to make | |
* it loadable/usable in both environments. | |
**/ | |
var requirePaths = { | |
paths: { | |
jquery: 'vendor/jquery/jquery', | |
jqueryui: 'vendor/jquery/jquery.ui', |
This file contains hidden or 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 is an experiment to shim support for handling Backbone.Radio | |
Events, Commands, and Requests onto Mn.Object. | |
Right now it only supports Object and not other Mn classes due to annoyances | |
of overriding the constructors of the different classes | |
It's also written in ES6 and uses my own import names for modules, so | |
it probably will not work for most people without some alteration as a result | |
*/ | |
import * as Mn from 'marionette'; | |
import * as Radio from 'radio'; |
This file contains hidden or 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
"Ben McCormick's vimrc | |
" Plugins | |
" ============= | |
"Setup Vundle For Package Management | |
"Vundle begins here, turn off filetype temporarily | |
filetype off | |
"Add vundle and any other packages not installed through vundle to our lookup |
This file contains hidden or 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
fs = require('fs') | |
writevalue = (i, val)-> | |
output += "Case #"+i+": "+val+"\n" | |
# is a palindrome (expects a string) | |
isPalindrome = (num) -> | |
reversed = (num).split("").reverse().join("") | |
num is reversed |
This file contains hidden or 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 java.io.BufferedReader; | |
import java.io.BufferedWriter; | |
import java.io.File; | |
import java.io.FileReader; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
public class Palindrome { | |
public static void main(String[] args) throws Exception |
This file contains hidden or 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
/* Small Knockout Extension to allow for canceling/confirming | |
* changes to the view model. Defaults to the changed option. Based on code sample from Ryan Niemeier | |
* http://www.knockmeout.net/2011/03/guard-your-model-accept-or-cancel-edits.html | |
* | |
* Please note: You should not use this unless you are | |
* explicitly confirming or resetting the values in every scenario before you | |
* reference them again. An unwanted revert may occur if you make changes without confirming and then cancel at a later point. | |
*/ | |
//wrapper to an observable that requires accept/cancel |
This file contains hidden or 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
/* Small Knockout Extension to allow for canceling/confirming | |
* changes to the view model Originally from: | |
* http://www.knockmeout.net/2011/03/guard-your-model-accept-or-cancel-edits.html | |
*/ | |
//wrapper to an observable that requires accept/cancel | |
ko.protectedObservable = function(initialValue) { | |
//private variables | |
var _actualValue = ko.observable(initialValue), | |
_tempValue = initialValue; |
This file contains hidden or 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
#!/bin/bash | |
# This is a script to set up a Linux Mint environment for Tim's development this summer. It is by no means complete, but is just meant to get started with some of the basics for java development and the courage project. | |
#set your username here | |
USER=ben | |
#update available packages | |
apt-get update | |
#installing postgres | |
apt-get -y install postgresql |
OlderNewer