Skip to content

Instantly share code, notes, and snippets.

View spoon16's full-sized avatar
:shipit:

Eric Schoonover spoon16

:shipit:
  • Snohomish WA, Alexandria VA, and Costa Mesa CA
  • 16:45 (UTC -04:00)
View GitHub Profile
## convert HTML POST data or HTTP GET query string to JSON
## get the raw post data from the AWS built-in variable and give it a nicer name
#if ($context.httpMethod == "POST")
#set($rawAPIData = $input.path('$'))
#elseif ($context.httpMethod == "GET")
#set($rawAPIData = $input.params().querystring)
#set($rawAPIData = $rawAPIData.toString())
#set($rawAPIDataLength = $rawAPIData.length() - 1)
#set($rawAPIData = $rawAPIData.substring(1, $rawAPIDataLength))
;; I feel like this should be less lines
(defn add-edge
[graph edge]
(let [parts (clojure.string/split edge #",")
from (first parts)
to (second parts)
graph (if (not (contains? graph from))
(assoc-in graph [from] #{})
graph)
graph (if (not (contains? graph to))
@spoon16
spoon16 / keybase.md
Created April 7, 2015 21:27
keybase.md

Keybase proof

I hereby claim:

  • I am spoon16 on github.
  • I am spoon16 (https://keybase.io/spoon16) on keybase.
  • I have a public key whose fingerprint is A899 7039 3ED0 5BDB 637F 6519 F5D7 4B95 8D7C A1EA

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am spoon16 on github.
  • I am spoon16 (https://keybase.io/spoon16) on keybase.
  • I have a public key whose fingerprint is 24E1 E382 1873 D9EC 1A04 6B0D ED35 6E91 7025 49F2

To claim this, I am signing this object:

java.lang.IllegalStateException: Current state not XML_START_ELEMENT (1) but 6
at com.fasterxml.jackson.dataformat.xml.deser.XmlTokenStream.repeatStartElement(XmlTokenStream.java:228)
at com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser.addVirtualWrapping(FromXmlParser.java:280)
at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer._configureParser(WrapperHandlingDeserializer.java:140)
at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:108)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:230)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:207)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:23)
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:464)
at com.fa
;; Anything you type in here will be executed
;; immediately with the results shown on the
;; right.
;; Anything you type in here will be executed
;; immediately with the results shown on the
;; right.
(defn- flatten-item
([item]
@spoon16
spoon16 / defprotocol_ArityException.clj
Last active December 17, 2015 06:19
Trying to figure out why line 13 is throwing an `ArityException` instead of yielding `"hello world"`
(defn slice
([]
(slice "hello world"))
([v]
(-slice v)))
(defprotocol Pizza
(-slice [this]))
(extend-type String
@spoon16
spoon16 / hiccup_problem.clj
Created October 16, 2012 06:57
Key must be integer - (class java.lang.IllegalArgumentException)
(ns myns
(:use [noir.core :only [defpage]]
[hiccup.form]))
(defpage "/my-form"
[]
(form-to [:post "/group-exporter/group.zip"]
(label "fristname" "First Name: ")
(text-field "firstname")
(submit-button "Submit")))
@spoon16
spoon16 / terminal.out
Created September 30, 2012 00:57
Troubleshooting Opscode Chef Knife EC2 Setup
poon16@desk ~/src$ gem install knife-ec2
Fetching: knife-ec2-0.5.14.gem (100%)
Successfully installed knife-ec2-0.5.14
1 gem installed
Installing ri documentation for knife-ec2-0.5.14...
Installing RDoc documentation for knife-ec2-0.5.14...
spoon16@desk ~/src$ knife ec2
FATAL: Cannot find sub command for: 'ec2'
The ec2 commands were moved to plugins in Chef 0.10
You can install the plugin with `(sudo) gem install knife-ec2
@spoon16
spoon16 / gist:3689043
Created September 10, 2012 05:27 — forked from Chouser/gist:3687532
Lazy seq as event subscription mechanism
;; Here is a spike of a lightweight in-process pubsub mechanism that allows pure ;; functional consumers, both blocking and asynchronous.
;; This defines the event stream, in this case just a series of numbers,
;; a new one produced each second
(defn timer []
(lazy-seq
(do
(Thread/sleep 1000)
(cons (System/nanoTime) (timer)))))