Skip to content

Instantly share code, notes, and snippets.

View joshkh's full-sized avatar

Joshua Heimbach joshkh

View GitHub Profile
request = require 'request'
imjs = require 'imjs'
class maintest
constructor: ->
console.log "maintest constructed"
post: ->
request.post 'http://httpbin.org/post', form: {key:'value'}, (err, res) ->
@joshkh
joshkh / gist:9645794
Created March 19, 2014 16:41
Webservice::InterMine test error.
joshua@deimos:~/Desktop/perltest$ perl query.pl
Bareword "Save" not allowed while "strict subs" in use at query.pl line 66.
Execution of query.pl aborted due to compilation errors.
at query.pl line 66.
@joshkh
joshkh / gist:055ad1d3e928578862f8
Created May 6, 2014 09:43
Simple HTTP Server
python -m SimpleHTTPServer
@joshkh
joshkh / gist:4d85b42b5962dd59a9ed
Last active August 29, 2015 14:09
Regex to validate Intermine range query.
/^[0-9]{0,}[a-zA-Z]:[0-9]{1,}[.]{2}[0-9]{0,}$/g
@joshkh
joshkh / gist:bdb5fb4d6cd7fc28c48e
Last active August 29, 2015 14:14
Proposed JAMI/JSON Structure 1
... some participant in an interaction...
{
"id": "12",
"interactorRef": "uniprotkb_P39079",
"stoichiometry": "2",
"bioRole": {
"id": "MI:0499",
"name": "unspecified role"
},
"features": [
@joshkh
joshkh / gist:987dc19059971130f44a
Last active August 29, 2015 14:14
Find a nested value of an object.
Object::hasprop = (propstring) ->
split = propstring.split '.'
obj = @
i = 0
while i < split.length
if !obj or !obj.hasOwnProperty split[i] then return false
obj = obj[split[i]]
i++
obj
@joshkh
joshkh / gist:4b274cbb7211af2f9a7b
Created February 5, 2015 15:32
Complex Portal Notes
Dancing Graphs:
* http://wwwdev.ebi.ac.uk/intact/complex/details/EBI-9003834
@joshkh
joshkh / gist:ab045d64e8952344cf92
Created March 5, 2015 14:16
clojure atom example
(defn get-all-projects []
(let [results (sql-get-all-projects)
acc (atom [])]
(info "modified" modified)
(doseq [next_project results]
(let [project_contents (sql-get-single-project (:id next_project))
project_with_contents (assoc next_project :contents project_contents)]
(defn make-tree-orig
([coll] (info "SINGLERUN")(let [root (first (remove :parent_id coll))]
{:node root :children (make-tree-orig root coll)}))
([root coll list]
(info "DOUBLERUN") (for [x coll :when (= (:parent_id x) (:id root))]
{:node x :children (make-tree-orig x coll)})))