Skip to content

Instantly share code, notes, and snippets.

View esjewett's full-sized avatar

Ethan Jewett esjewett

View GitHub Profile
@esjewett
esjewett / README.md
Last active August 29, 2015 14:24 — 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 December 20, 2015 15:49 — forked from mbostock/.block
@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 / 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.
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'));
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)