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 it = (for (char of 'Hello World') char.codePointAt(0)); | |
// now you can iterate over the collection of code points on-demand | |
console.log(it.next().value) // 72 | |
console.log(it.next().value) // 101 |
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 objit = obj[Symbol.iterator]() | |
, item = objit.next() | |
; | |
while(!item.done) { | |
console.log(item.value); | |
item = objit.next(); | |
} |
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
'use strict'; | |
var obj = {a: 'b'}; | |
obj[Symbol()] = 'symbol'; | |
obj[Symbol('foo')] = 'bar'; | |
// use a generator to define default iterator for obj | |
obj[Symbol.iterator] = function* () { | |
var props = Object.getOwnPropertyNames(obj) |
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 drawD3Treemap(hierarchy) { | |
var treemap = d3.layout.treemap() | |
, color = d3.scale.category10() | |
, chart = d3.select('.html5') | |
, w = parseInt(chart.style('width')) | |
, h = parseInt(chart.style('height')) | |
, nodes = undefined | |
; | |
function altered(name) { |
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 getJSONResourceHierachy() { | |
var images = {png: 1, jpg: 1, jpeg: 1, gif: 1, tif: 1, tiff: 1, bmp: 1, ico: 1, svg: 1} | |
, entries = window.performance.getEntriesByType('resource') | |
, length = entries.length | |
, archy = {} | |
, entry = undefined | |
, name = undefined | |
, mt = undefined | |
; | |
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
{ | |
connectEnd: 318.862000000081 | |
connectStart: 318.862000000081 | |
domainLookupEnd: 318.862000000081 | |
domainLookupStart: 318.862000000081 | |
duration: 53.30899999989924 | |
entryType: "resource" | |
fetchStart: 318.862000000081 | |
initiatorType: "link" | |
name: "http://www.foobar.com/blog/wp-content/themes/foobar/style.css" |
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
NameVirtualHost *:80 | |
<VirtualHost *:80> | |
ServerName myapp | |
DocumentRoot /path/to/myapp/doc/root | |
ProxyPreserveHost On | |
ProxyPass /socoapi http://127.0.0.1:3535 | |
ProxyPass / http://127.0.0.1:3000/ | |
ProxyPassReverse / http://127.0.0.1:3000/ | |
ProxyPassReverse /socoapi http://127.0.0.1:3535 |
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
{ | |
"facebook" : 1434, | |
"google" : 517, | |
"pinterest": 160, | |
"url" : "http//www.foobar.baz/?q1=v1&q2=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
// Standalone | |
var socoapi = require('socoapi'); | |
socoapi.listen('3535', 3600000, function() { | |
console.log('socoapi listening on port 3535'); | |
}); | |
// Embedded | |
var app = require('express')() | |
, socoapi = require('socoapi') |
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
{ | |
// ... San Francisco Muni agency resource ... | |
_links: { | |
self: { | |
href: "http://localhost:3535/agencies/sf-muni", | |
type: "application/json", | |
rel: "self", | |
rt: "agency", | |
title: "Transit agency 'sf-muni'." |