Skip to content

Instantly share code, notes, and snippets.

View caged's full-sized avatar
🎸

Justin Palmer caged

🎸
View GitHub Profile
// includes bindings for fetching/fetched
PaginatedCollection = Backbone.Collection.extend({
fetch: function(options) {
options || (options = {});
var self = this,
success = options.success;
options.success = function(resp) {
self.trigger("fetched");
if(success) { success(self, resp); }
@jc00ke
jc00ke / nginx.conf
Created August 23, 2011 21:52 — forked from pogodan/tunnel.thor
thor/pow reverse SSH tunnel
server {
listen [YOUR IP]:80;
server_name *.dev.jc00ke.com;
location / {
if ($host ~* "(.*)\.dev\.jc00ke\.com" ) {
set $tunnel_app $1.lvh.me;
}
proxy_set_header X-Real-IP $remote_addr;
@bycoffe
bycoffe / README.md
Created June 26, 2013 20:17
Highlighting with point-in-polygon

This code demonstrates how to draw circles on multiple SVGs using d3.js and highlight them by dragging the mouse to draw an enclosing shape.

This is a simplified version of the code used for the Massachusetts special Senate election results on The Huffington Post.

#3de6b1
#22ecf0
#19d1fd
#14b1fd
#2c7fdb
#3d52bf
#6539b3
#a032b2
#d124a9
#fb139c
<!DOCTYPE html>
<html>
<head>
<title>k-means in one dimension</title>
<script src="https://d3js.org/d3.v2.js"></script>
<script src="kmeans.js"></script>
<style>
body { margin: 0; padding: 0; font:normal 12px/20px sans-serif; }
#vis { width: 640px; }
rect.title {
@creationix
creationix / output.log
Created May 8, 2013 22:02
Working version of generator async code sample. Using node from https://github.com/andywingo/node/tree/v8-3.19
tim@touchsmart:~/Code$ nvm use v0.11.2-generators
Now using node v0.11.2-generators
tim@touchsmart:~/Code$ node --harmony testgen.js
<Buffer 76 61 72 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 29 3b 0a 66 75 6e 63 74 69 6f 6e 20 72 65 61 64 46 69 6c 65 28 70 61 74 68 2c 20 65 6e 63 ...>
Sleeping for 2000ms...
Done
data Graph = Graph
{ pointsLeft :: Set.Set (V2 Double)
-- ^ All the points in the whole graph left to be connected
, branches :: Set.Set LineSegment
-- ^ All branches we have found, connecting two points
, currentPoints :: [V2 Double]
-- ^ Points that are currently being processed
, maxDist :: Double
-- ^ Maximum distance a thing can be away from a thing
}
@nbremer
nbremer / README.md
Last active February 13, 2019 14:47
Valentine's day Heart curve

A heart created with D3 and a nice formula found on Wolfram to celebrate Valentine's Day!

  • The blog can be found here
  • The second example of a heart from one sharp line can be found here
@mbostock
mbostock / .block
Last active July 14, 2019 14:08 — forked from mbostock/.block
Threshold Encoding
license: gpl-3.0
redirect: https://observablehq.com/@d3/threshold-encoding
@mbostock
mbostock / .block
Last active July 14, 2019 14:12 — forked from mbostock/.block
Gradient Encoding
license: gpl-3.0
redirect: https://observablehq.com/@d3/gradient-encoding