Skip to content

Instantly share code, notes, and snippets.

View alexspurling's full-sized avatar

Alex Spurling alexspurling

View GitHub Profile
@alexspurling
alexspurling / Comment.java
Created June 28, 2010 18:22
Simple example of MongoDB driver for Java
public class Comment {
private final String author;
private final String body;
public Comment(String author, String body) {
this.author = author;
this.body = body;
}
{ "_id" : "7183414623122970455", "name" : "Bob", "items" : [ { "id" : 29 }, {"id" : 37 } ], "itemCount" : 2 }
{ "_id" : "-1843045741878739623", "name" : "Jim", "items" : [ { "id" : 93 }, { "id" : 51 }, { "id" : 42 }, { "id" : 11 } ], "itemCount" : 4 }
...
@alexspurling
alexspurling / git_svn_bash_prompt.sh
Last active August 8, 2018 05:51 — forked from woods/git_svn_bash_prompt.sh
Update of prompt colours and terminal title
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git repository
# * the branch of the current subversion repository
# * the return value of the previous command
#
# USAGE:
get = -> {
secret_callback = -> {
secret_squirrly_function = -> {secret_callback(err, res, body)}
# Do something asynchronous
setTimeout secret_squirrly_function, 5000
# and return a function
(callback) -> {secret_callback = callback}
}
}
console.log("foo");
@alexspurling
alexspurling / bash_aliases
Created February 11, 2015 11:29
OSX terminal notification for completed builds
#Add an alias for your build commands for example:
alias make='notify make'
alias mvn='notify mvn'
@alexspurling
alexspurling / bash_aliases
Last active August 29, 2015 14:15
OSX terminal notification for completed builds
#Add an alias for your build commands for example:
alias make='notify make'
alias mvn='notify mvn'
@alexspurling
alexspurling / InitialValues.elm
Last active September 15, 2015 13:13
Port initial value example
module InitialValues where
import Graphics.Element exposing (..)
port timestamp : Int
main =
show ("Hello" ++ (toString (timestamp + 2)))
@alexspurling
alexspurling / Distances.elm
Created August 3, 2015 21:26
Two methods for generating a random distance matrix one in Elm and one in Javascript.
import Array
import Debug
import Random
import Matrix
planetNames : Array.Array String
planetNames = Array.fromList [
"Terra",
"Vulcan",
"Omicron Persei 8",
import Html exposing (..)
import Html.Events exposing (onClick)
import Http
import Json.Decode as Json exposing((:=))
import StartApp.Simple as StartApp
type alias Model =
{ name : String
, amount : Int