This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// from https://www.health.ny.gov/statistics/cancer/registry/appendix/neighborhoods.htm | |
// fancypants class version | |
class ZipCode { | |
constructor(label, code) { | |
this.label = label; | |
this.code = code; | |
} | |
} | |
let zipCodes = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var uploadVideo = function (file, title, description) { | |
var d = $q.defer(); | |
youtube.videos.insert({ | |
part: 'snippet,status', | |
resource: { | |
snippet: { | |
title: title, | |
description: description | |
}, | |
status: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Element.prototype.hasClass = function (name) { | |
var classes = this.className.split(" "), | |
hasClass = false; | |
for (var i = 0; i < classes.length; i++) { | |
if (classes[i] === name) { | |
return true; | |
} | |
} | |
return false; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Written by Brad Orego, Dijkstra's implementation adapted from http://rosettacode.org/wiki/Dijkstra%27s_algorithm#Ruby | |
# Ruby implementation of Dijkstra's algorithm intended to be run in Sonic Pi | |
# Define a graph with random arc weights, traverse the graph, playing a note for each node, then at the end, play the shortest path | |
# Repeat for 30 seconds, then stop after that run finishes | |
Vertex = Struct.new(:name, :neighbours, :dist, :prev) | |
def init_graph(graph) | |
@vertices = Hash.new{|h,k| h[k]=Vertex.new(k,[],Float::INFINITY)} | |
@edges = {} | |
graph.each do |(v1, v2, dist)| | |
@vertices[v1].neighbours << v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Coded by Sam Aaron, modified by Brad Orego | |
use_debug false | |
load_sample :bd_fat | |
8.times do | |
sample :bd_fat, amp: (line 0.5, 5, steps: 8).tick | |
sleep 0.5 | |
end | |
live_loop :drums do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A small snippet in Sonic Pi that lets you randomly select functions | |
# from an array, then remove them, and stops the loop when you run | |
# out of functions. | |
# | |
# The purpose being you can define the sections of your song/composition | |
# as functions, and then let rPI randomly select the order in which those | |
# sections happen. | |
# | |
# This is part of an exploration for a dance piece I will be choreographing | |
# for Kanopy Dance Company's April 2016 show. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (pg_android) { | |
var exdate = new Date(); | |
exdate.setDate(exdate.getDate() + 365); | |
/// I tried it on the request, too, but it got weird... | |
// req.headers().set("Cookie", headers.getAll('Cookie').toString() + ";pg_android=1; path=/; expires=" + exdate.toUTCString()); | |
req.response.putHeader("Cookie", "pg_android=1; path=/; expires=" + exdate.toUTCString()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendAJAX(url, method, callback, data, headers) { | |
var xhReq = new XMLHttpRequest(); | |
if (method !== "POST" && method !== "GET" && method !== "PUT" && method !== "DELETE") { | |
return false; | |
} | |
xhReq.open(method, url); | |
if (typeof(headers) != "undefined") { | |
for (var i = 0; i < headers.headers.length; i++) { | |
xhReq.setRequestHeader(headers.headers[i].type, headers.headers[i].value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vertx = require('vertx'), | |
console = require('vertx/console'), | |
client = vertx.createHttpClient().host('google.com'), | |
rm = new vertx.RouteMatcher(); | |
rm.get('/', function(req) { | |
console.log("rm1"); | |
req.bodyHandler(function (body) { | |
console.log("rm2"); | |
req.response.end("Hello, World"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (windowPathname.indexOf("/upcoming") > -1) { | |
var $calRadios = document.getElementsByTagName('input'), | |
$lastActive = document.getElementsByClassName('active')[0], | |
$calList = document.getElementById('planIdeaList'), | |
$couldDoIndicator = document.getElementById('indicator'), | |
$couldDo = document.getElementById('couldDo') | |
$couldDoWrap = document.getElementById('couldDoWrap'); | |
addActionButtonListeners(document.getElementsByClassName('actionButton')); | |
if ($couldDoWrap) { | |
$couldDoWrap.addEventListener(touchEvent, function (e) { |
NewerOlder