Skip to content

Instantly share code, notes, and snippets.

View esjewett's full-sized avatar

Ethan Jewett esjewett

View GitHub Profile
val post_session = post("session", "token" -> token)
"API2" should {
"/session POST" in {
def withSession(a: => Any) = for(sess <- post_session) { a }
doAroundExpectations(withSession(_))
"Attempt to log in with a valid token should succeed with a 200 response" in {
(sess.xml \ "session" \ "user" \ "id").text must be equalTo (theUser.id.toString)
javascript:q=location.href;if(document.getSelection){d=document.getSelection();}else{d='';};p=document.title;void(open('http://pinboard.in/add?url='+encodeURIComponent(q)+'&description='+encodeURIComponent(d)+'&title='+encodeURIComponent(p),'Pinboard',%20'toolbar=no,width=700,height=350'));
@esjewett
esjewett / ABAP Insanity #1
Created March 2, 2011 14:26
See if you can guess the output?
FUNCTION ZTEST12345.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" EXPORTING
*" REFERENCE(E_TEST) TYPE I
*"----------------------------------------------------------------------
e_test = e_test + 1.
ENDFUNCTION.
@esjewett
esjewett / DynamicWizardExample.scala
Last active December 10, 2015 18:49
Seems to successfully dynamically create fields on second Screen of a Lift Wizard based on selection in the first Screen. Access fields of the second screen later on using "second.screenFields".
import net.liftweb._
import http._
import wizard._
import common.{Empty, Box}
import net.liftweb.util.FieldContainer
import model.Thing
object ThingsWizard extends Wizard {
val emptyThings: Seq[Thing] = Seq()
@esjewett
esjewett / README.md
Last active December 20, 2015 15:49 — forked from mbostock/.block
@esjewett
esjewett / example.js
Last active March 29, 2020 19:02
Example of Reductio/Crossfilter moving average w/ efficient Date calculations for larger data set
// This example data set (not provided) is over 100,000 records. The following code calculates 30-day moving
// averages (over 3 million aggregations) using Crossfilter and the Reductio helper library. It takes about
// 3 seconds for the initial aggregation in Chrome Canary (42.0.2291.0) on a 2.3 GHz Core i7, mid-2012 rMBP.
d3.csv('dataJan-29-2015.csv', function (data) {
//convert the iso timestamps to JS Dates
var parseDate = d3.time.format("%Y-%m-%dT%H:%M:%S").parse;
var ymd = d3.time.format("%Y-%m-%d");
data.forEach(function(d) {
@esjewett
esjewett / README.md
Last active August 29, 2015 14:24 — forked from mbostock/.block
@esjewett
esjewett / README.md
Last active April 2, 2016 15:40
dc dataTable sorting example
@esjewett
esjewett / README.md
Last active February 15, 2019 14:04
Input lag demo
@esjewett
esjewett / US_cities.csv
Last active July 19, 2016 21:45
Tab delimited US Cities from Geonames export
We can't make this file beautiful and searchable because it's too large.
City,Latitude,Longitude,State
Amchitka,51.56722,178.8775,AK
Sunik (historical),52.43333,173.6,AK
Attu,52.9375,173.2375,AK
Ugiatok (historical),52.41667,173.58333,AK
Siksatok (historical),52.43333,173.6,AK
Navy Town,52.84083,173.17556,AK
Ugtikun (historical),52.41667,173.58333,AK
Ugtumuk (historical),52.41667,173.58333,AK
Ukashik (historical),52.41667,173.58333,AK