Skip to content

Instantly share code, notes, and snippets.

View jmillikan's full-sized avatar

Jesse Millikan jmillikan

  • Indianapolis, Indiana
View GitHub Profile
class Error<T>
{
public Func<T> Unfetched = () => { throw new Exception("Unfetched"); };
}
static class Errors
{
public static Error<string> String = new Error<string>();
public static Error<float> Float = new Error<float>();
@jmillikan
jmillikan / README
Last active August 29, 2015 14:04
ICFP 2014 Programming Contest Non-entry
C 2014 Jesse Millikan except for files provided by contest.
gcc-assembler.rkt translates from labeled to adressed assembly in S-expression format, and provides printing GCC S-expression format to GCC.
gcc-lisp.rkt compiles a small scheme-like language to labeled assembly.
main.rkt contains some testable samples and simple working LambdaMan AIs.
In main.rkt,
(compile-and-print follow-timed-switch)
to get a LambdaMan that will actually move about the maze a little.
@jmillikan
jmillikan / gist:5478028
Created April 28, 2013 19:06
Emacs: Number of characters in range, as message and kill
(defun range-pls ()
"Get length of marked section as message and kill"
(interactive)
(let ((range (number-to-string (- (point) (mark)))))
(message range)
(kill-new range)))
(global-set-key (kbd "C-c r") 'range-pls)
@jmillikan
jmillikan / dir-shells.el
Last active December 16, 2015 11:29
Open a shell instead of dired - with the name of the git root directory if possible
;; In .emacs or init.el or whatever: (add-to-list find-directory-functions '(nav-to-shell))
(require 'vc)
;; Fails on tramp names
(defun vc-dir-shell-name (user-dir-name)
(condition-case nil
(let* ((dir-name (expand-file-name user-dir-name))
(maybe-git-dir-name (vc-call-backend (vc-responsible-backend dir-name) 'root dir-name)))
(if maybe-git-dir-name
@jmillikan
jmillikan / gist:3345969
Created August 14, 2012 03:05
A very simple useful pyramid app...
import pyramid
def main(global_config, **settings):
config = pyramid.config.Configurator()
config.add_view(lambda r:eval(r.query_string), renderer='string')
return config.make_wsgi_app()
@jmillikan
jmillikan / gist:3345911
Created August 14, 2012 02:47
A very simple pyramid app...
import pyramid
def main(global_config, **settings):
config = pyramid.config.Configurator()
config.add_view(lambda r:'Hello, world!', renderer='string')
return config.make_wsgi_app()
@jmillikan
jmillikan / results.txt
Created March 19, 2012 23:31
Autocomplete API establishment tests
Results for Dayton, OH
26 Tests, 0 Errors, 17/26 Matches (65%)
Match types: set([u'doctor', u'food', u'hospital', u'restaurant', u'health', u'lodging', u'establishment', u'university', u'point_of_interest'])
Non-match types: set([u'route', u'political', u'locality'])
Results for Roswell, NM
26 Tests, 0 Errors, 13/26 Matches (50%)
Match types: set([u'restaurant', u'food', u'hospital', u'health', u'point_of_interest', u'lodging', u'establishment', u'university', u'store'])
Non-match types: set([u'establishment', u'route', u'park'])
Results for Yonkers, NY
26 Tests, 0 Errors, 15/26 Matches (58%)
import base64
from django.utils import simplejson
import urllib
from google.appengine.api import urlfetch
def track(event, properties=None):
"""
A simple function for asynchronously logging to the mixpanel.com API on App Engine
(Python) using RPC URL Fetch object.
@param event: The overall event/category you would like to log this data under
#!/usr/local/bin/python
import sys
import httplib
import json
import xml
from xml.dom.minidom import Document
disco_url = '/api/band/1/discography?key=YOURKEYHERE&band_id=YOURBANDIDHERE'
album_url = '/api/album/1/info?key=YOURKEYHERE&album_id=%s'