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
<html> | |
<head> | |
<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/rgbcolor.js"></script> | |
<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/canvg.js"></script> | |
<script> | |
function getImgData(chartContainer) { | |
var chartArea = chartContainer.getElementsByTagName('iframe')[0]. | |
contentDocument.getElementById('chartArea'); | |
var svg = chartArea.innerHTML; | |
var doc = chartContainer.ownerDocument; |
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
/** | |
* Created by syzer on 8/20/2014. | |
*/ | |
var port = 1337; | |
var express = require('express'); | |
var app = express(); | |
function disablePopulate(req, res, next) { | |
var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress; | |
console.log('disabling malicious populate on request from ip', ip); |
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
{ | |
"result": "SUCCESS", | |
"interfaceVersion": "1.0.3", | |
"requested": "10/17/2013 15:31:20", | |
"lastUpdated": "10/16/2013 10:52:39", | |
"tasks": [ | |
{ | |
"id": 104, | |
"complete": false, | |
"priority": "high", |
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
// task #function composiotion | |
var articles = [ | |
{ | |
title: 'Why OO Sucks by Joe Armstrong', | |
url: 'http://www.bluetail.com/~joe/vol1/v1_oo.html', | |
author: { | |
name: 'Joe Armstrong', | |
email: '[email protected]' | |
} | |
}, |
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 makeSandwich() { | |
var preparedFood = 'Here is a sandwich with: '; | |
return { | |
addLattice: function () { | |
// Lattice logic here | |
preparedFood += 'Lattice'; | |
return this; | |
}, | |
addBacon: 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
/** | |
* Created by syzer on 12/19/2014. | |
* ex shows how to decouple constant error checking from function/class body | |
* AKA TypeScript AKA WarnScript :) | |
*/ | |
var _ = require('lodash'); | |
function doStuffNumberPlusOneTimes(number, fun) { | |
"use strict"; |
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
/** | |
* Created by syzer on 4/8/2015. | |
*/ | |
module.exports = function (_) { | |
'use strict'; | |
return { | |
objectMerger: objectMerger, | |
mergeObjectsInArr: mergeObjectsInArr, | |
objToSortedArr: objToSortedArr, |
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 jsSpark = require('js-spark')({workers: 4}); | |
var task = jsSpark.jsSpark; | |
var q = jsSpark.q; | |
var _ = require('lodash'); | |
var lib = require('./lib')(_); | |
_.mixin(lib); | |
var fs = require('fs'); | |
var DRACULA = './data/text/dracula/'; |
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 bigramText(arr) { | |
return arr.reduce(bigramArray); | |
} | |
function bigramArray(acc, word, i, arr) { | |
if (1 === i) { | |
acc = {last: acc, out: {}}; | |
} | |
var out = acc.out; | |
var last = acc.last; |
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 mergeSmall() { | |
var task1 = task(ch01) | |
.reduce(bigramArray) | |
.run(); | |
var task2 = task(ch02) | |
.reduce(bigramArray) | |
.run(); | |
return q.all([task1, task2]).then(function (data) { |
OlderNewer