Skip to content

Instantly share code, notes, and snippets.

View jbn's full-sized avatar

John B Nelson jbn

View GitHub Profile
@jbn
jbn / masonify.html
Created April 9, 2015 16:53
Bookmarklet to access academic resources through MASON
<html>
<head>
<title>External Access for GMU Library Resources</title>
</head>
<body>
<a href="javascript:(function() {window.location = 'http://mutex.gmu.edu/login?url=' + window.location;
})();">MASONify</a> Bookmarklet
</body>
</html>
@jbn
jbn / gv_layouts.ipynb
Created July 1, 2015 23:54
ipython-magic pull request 1 demo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbn
jbn / D3_IPython_Freeze_Framing.ipynb
Created September 1, 2015 21:26
A Little Demo of a Fun Technique for D3.js Development
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbn
jbn / rewrite_oauth_serialize_url_parameters.jl
Created September 18, 2015 22:48
My justification for rewriting OAuth.jl's oauth_serialize_url_parameters
function method_a(options)
parameterstring = ""
keyssorted = sort!(collect(keys(options)))
for key in keyssorted
parameterstring *= "$key=$(options["$key"])&"
end
chop(parameterstring)
end
function method_b(options)
import java.util.LinkedList;
/*
Curves:
probabilityOfHavingChild(deltaWealth, inflation)
wealth/inflation
consumptionCurve(deltaWealth, inflation)
adolesentConsumptionRequirements
adulthoodBetsowment
adulthoodYearlyExpense
@jbn
jbn / dump.java
Created September 14, 2010 22:45
public class Classifier{
public static boolean[] stringToBoolean(String s){
boolean[] b = new boolean[s.length()];
for(int i=0; i<s.length(); ++i){
b[i] = (s.charAt(i) == '1');
}
return b;
}
public static void main(String[] args){
module MiniMagick
class Image
# Size is in 'WidthxHeight' string format.
def resize_and_crop(target_size)
target_width, target_height = *target_size.split('x').collect{|x| x.to_f}
width, height = self[:width].to_f, self[:height].to_f
# If the width or height are already less than the targets
# just take the extent -- no resizing nessessary.
if width >= target_width && height >= target_height
@jbn
jbn / setup_mason.sh
Created March 6, 2012 17:43
Setup MASON in an SBT project
#!/bin/bash -v
# MASON (http://cs.gmu.edu/~eclab/projects/mason/) has no MAVEN repository, and
# is built with Makefiles. Sinec I build MASON simulations in Scala with SBT,
# this is inconvienent. This script downloads the latest version of MASON and
# its listed dependencies, and places them in the lib directory. I've never been
# very clear on licensing issues, so I hope I'm not in violation (and I hope
# I'm not stepping on anyone's toes.) If I am, please let me know.
#
# The most convienent way to run is to CD into your scripts base directory and
@jbn
jbn / setup_geomason.sh
Created April 28, 2012 17:46
setup GeoMASON in a MASON sbt project
#!/bin/bash -v
# A script to make using GeoMASON easier in SBT projects, given lack of a
# MAVEN repository.
#
# See: http://cs.gmu.edu/~eclab/projects/mason/extensions/geomason/
#
# The most convienent way to run is to CD into your scripts base directory and
# issue the command:
#