Skip to content

Instantly share code, notes, and snippets.

View jameslmartin's full-sized avatar

James Martin jameslmartin

View GitHub Profile
@jameslmartin
jameslmartin / jsonParser.java
Created July 11, 2014 18:30
Neat little JSON parser, grabs outer level keys from a JSONObject that has been converted to a string with toString() and returns them in an ArrayList
/**
* getNames() - Returns ArrayList of Strings that are outer-most keys of a JSONObject that has been converted
* to a String with the toString() method (JSON4J)
* @author martinlj
* @param json - JSONObject that has been converted to a string with toString()
*/
private ArrayList<String> getNames(String json){
//Strip outer curly braces
json = json.substring(1,json.length()-1);
ArrayList<String> names = new ArrayList<String>();
@jameslmartin
jameslmartin / provision.sh
Last active August 29, 2015 14:03
provision.sh
if grep -q "\[thestinger\]" "/etc/pacman.conf"; then
echo "Repository already added."
else
echo $'\n[thestinger]\nSigLevel = Optional\nServer = http://pkgbuild.com/~thestinger/repo/$arch' >> /etc/pacman.conf
fi
pacman -Syuq --noconfirm
pacman -Sq --noconfirm community/rust
@jameslmartin
jameslmartin / HaskellExplorations.md
Last active August 29, 2015 14:00
Explorations with Haskell

Explorations in Haskell as a platform

Note: I'm pretty new to Haskell, I've only experimented with it during COMP 524, and written some pretty basic functions.

So I decided I wanted to try to throw together a quick web server together with Haskell, but it's been a small disaster setting up the tools necessary.

OS: Ubuntu 12.10

The first thing I did was create a folder for my experiment, under ~/Documents/Code/haskell I then ran sudo apt-get install haskell-platform to get ghci and cabal, Haskell's package manager. I then wanted to create cabal sandbox, so I ran cabal sandbox init and this was the beginning of a two-hour struggle...