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
// ==UserScript== | |
// @version 1.0 | |
// @match http://*.google.com/* | |
// @match https://*.google.com/* | |
// ==/UserScript== | |
(function() | |
{ | |
// why can't the world just standardize on jQuery? |
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
# color.coffee - triple rainbow | |
# thanks wikipedia! | |
color = | |
rgbToHsl: (red, green, blue) -> | |
red /= 255 | |
green /= 255 | |
blue /= 255 | |
max = Math.max(red, green, blue) |
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
// ==UserScript== | |
// @version 1.0 | |
// @match http://twitch.tv/* | |
// @match http://www.twitch.tv/* | |
// ==/UserScript== | |
(function() | |
{ | |
var $chatList = jQuery('#chat_line_list'); | |
$chatList.bind('DOMNodeInserted', function() |
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
// ==UserScript== | |
// @version 1.1 | |
// @match http://www.youtube.com/* | |
// @match https://www.youtube.com/* | |
// ==/UserScript== | |
// TO INSTALL: | |
// 1. download this file. | |
// 2. open the extensions settings pane in chrome. |
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
goals.each(function(model) | |
{ | |
var markup = model.get('description') | |
if (markup) | |
{ | |
markup = markup.replace(/\n/g, '').replace(/ /g, ' ').replace(/ +/g, ' '); | |
var $markup = $(markup); | |
$wrapper = $('<div/>').append($markup) |
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
# manipulation.ls -- functions for returning modified versions of trees. | |
{ compact, map } = require('prelude-ls').Obj | |
# node manipulation: | |
with-data = (data, node) --> node with data: data | |
with-child = (child, node) --> node with children: node.children with ((child.id): child) | |
with-children = (children, node) --> node with children: node.children with children | |
without-child = (child, node) --> node with children: compact(node.children with ((child.id): null)) |
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 fs = require('fs'); | |
var soda = require('soda-js'); | |
var moment = require('moment'); | |
var update = /* some configuration we load in from a local JSON file */; | |
// read in our csv | |
fs.readFile(update.file, function(error, data) | |
{ | |
if (error) { console.error(error); return; } |
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
// iterate through each row of the dataset | |
for (var j = 0; j < parsedData.length; j++) | |
{ | |
// create a js key/value hash object | |
var datum = {}; | |
// fetch the row we're processing | |
var row = parsedData[j]; | |
// iterate through each column of the row |
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
// create a soda producer based on our configuration | |
var producer = new soda.Producer(update.cname, update.credentials); | |
// perform the actual insert based on our parse and our configurations | |
producer.operation() | |
.withDataset(update.id) | |
.add(importData) | |
.on('success', function(result) { console.log('Successfully wrote ' + importData.length + ' rows from ' + update.file + ' to ' + update.id + '.'); }) | |
.on('error', function(error) { console.error('Error writing ' + importData.length + ' rows from ' + update.file + ' to ' + update.id + '!'); }); |
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 fs = require('fs'); | |
var soda = require('soda-js'); | |
var moment = require('moment'); | |
var trim = function(str) { return str.replace(/^\s+|\s+$/g, ''); } | |
// following is from http://stackoverflow.com/questions/8493195/how-can-i-parse-a-csv-string-with-javascript | |
function csvToArray(text) { | |
var re_valid = /^\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,'"\s\\]*(?:\s+[^,'"\s\\]+)*)\s*(?:,\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,'"\s\\]*(?:\s+[^,'"\s\\]+)*)\s*)*$/; | |
var re_value = /(?!\s*$)\s*(?:'([^'\\]*(?:\\[\S\s][^'\\]*)*)'|"([^"\\]*(?:\\[\S\s][^"\\]*)*)"|([^,'"\s\\]*(?:\s+[^,'"\s\\]+)*))\s*(?:,|$)/g; |
OlderNewer