Skip to content

Instantly share code, notes, and snippets.

View hallettj's full-sized avatar

Jesse Hallett hallettj

View GitHub Profile
#!/bin/sh -e
if [ ! $SBT_VERSION ]; then SBT_VERSION=0.11.0; fi
if [ ! $SBT_DIR ]; then SBT_DIR=$HOME/.sbt; fi
if [ ! $SBT_FILENAME ]; then SBT_FILENAME=sbt-launch-$SBT_VERSION.jar; fi
if [ ! $SBT_LOCATION ]; then SBT_LOCATION=$SBT_DIR/$SBT_FILENAME; fi
if expr match $SBT_VERSION "0.7" > /dev/null;
then
SBT_URL="http://simple-build-tool.googlecode.com/files/$SBT_FILENAME"
@hallettj
hallettj / update.log
Created October 10, 2011 01:14
Error log, SBT 0.11.0 fails to download commons-logging 1.0.4
setting 'ivy.default.settings.dir' to 'jar:file:/home/jesse/.sbt/sbt-launch-0.11.0.jar!/org/apache/ivy/core/settings'
setting 'ivy.basedir' to '/home/jesse/projects/scala/.'
setting 'ivy.default.conf.dir' to 'jar:file:/home/jesse/.sbt/sbt-launch-0.11.0.jar!/org/apache/ivy/core/settings'
impossible to define new type: class not found: org.apache.ivy.plugins.version.PatternVersionMatcher in [] nor Ivy classloader
impossible to define new type: class not found: org.apache.ivy.plugins.trigger.LogTrigger in [] nor Ivy classloader
impossible to define new type: class not found: org.apache.ivy.plugins.resolver.DualResolver in [] nor Ivy classloader
impossible to define new type: class not found: org.apache.ivy.plugins.resolver.VsftpResolver in [] nor Ivy classloader
impossible to define new type: class not found: org.apache.ivy.plugins.conflict.RegexpConflictManager in [] nor Ivy classloader
impossible to define new type: class not found: org.apache.ivy.plugins.resolver.SshResolver in [] nor Ivy classloader
impossib
@hallettj
hallettj / sbt
Created October 10, 2011 02:51
Install and launch script for sbt, a Scala build tool
#!/bin/sh -e
if [ ! $SBT_VERSION ]; then SBT_VERSION=0.11.0; fi
if [ ! $SBT_DIR ]; then SBT_DIR=$HOME/.sbt; fi
if [ ! $SBT_FILENAME ]; then SBT_FILENAME=sbt-launch-$SBT_VERSION.jar; fi
if [ ! $SBT_LOCATION ]; then SBT_LOCATION=$SBT_DIR/$SBT_FILENAME; fi
if expr match $SBT_VERSION "0.7" > /dev/null;
then
SBT_URL="http://simple-build-tool.googlecode.com/files/$SBT_FILENAME"
@hallettj
hallettj / wordnet.scala
Created January 3, 2012 09:09
Scala parser for WordNet's Prolog-format database
/*
* An incomplete parser intended to import rules from the WordNet[1]
* Prolog-formatted database. Rules are of the form:
*
* s(101942869,1,'abalone',n,1,0).
* sk(101942869,1,'abalone%1:05:00::').
*
* and so forth.
*
* [1]: http://wordnet.princeton.edu/ "WordNet"
@hallettj
hallettj / user-list.html
Created January 20, 2012 22:05
There is a bug here
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
for (var i = 1; i < 5; i += 1) {
var elemId = "#user"+ i;
$.get('/users/'+ i, function(content) {
$(elemId).html(content);
@hallettj
hallettj / xmonad.hs
Created March 6, 2012 19:45
XMonad configuration for a left-handed Tall layout
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}
-- FlexibleInstances and MultiParamTypeClasses are necessary for the
-- LayoutClass instance declaration of Flip.
-- I use two monitors. The default tiled layout in XMonad, Tall, puts
-- the master window on the left side of the screen. That feels right
-- for my right screen. But for my left screen I would prefer the
-- master window to be on the right side of the screen because that side
@hallettj
hallettj / prototype_puzzle.js
Created May 22, 2012 20:56
Prototype Puzzle
function f() {}
f.prototype = { i: 10 };
var i = new f();
f.prototype = { j: 11 };
var j = new f();
equal(i.i, ?);
equal(i.j, ?);
equal(j.i, ?);
@hallettj
hallettj / iframe-memory-leak-prevention.html
Created July 16, 2012 23:28
iFrame memory leak prevention test
<!doctype html>
<html>
<head>
<title>iFrame memory leak prevention test</title>
</head>
<body>
<h1>iFrame memory leak prevention test (void)</h1>
<p>In IE up through version 8 adding an iframe to a page and
removing it produces a memory leak in some cases. The pattern
@hallettj
hallettj / jquery.flatmap.js
Created August 1, 2012 02:08
$.flatMap, generalizes running asynchronous operations in sequence
$.flatMap = function(promise, f) {
var deferred = $.Deferred();
function reject(/* arguments */) {
// The reject() method puts a deferred into its failure
// state.
deferred.reject.apply(deferred, arguments);
}
promise.then(function(/* values... */) {
@hallettj
hallettj / base36.hs
Created August 25, 2012 21:56
Haskell library to convert unsigned integers to and from base36 representations
-- Converts unsigned integers to and from base36 representations
module Numeric.Base36 (
readBase36
, showBase36
) where
import Data.Char (isAscii, isLetter, isDigit, ord, chr, toLower)
import Numeric (readInt, showIntAtBase)