(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
/* Client side, works in Chrome 55 and Firefox 52 without transpilation */ | |
//https://blogs.msdn.microsoft.com/typescript/2016/11/08/typescript-2-1-rc-better-inference-async-functions-and-more/ | |
async function fetchURLs() { | |
try { | |
// Promise.all() lets us coalesce multiple promises into a single super-promise | |
var data = await Promise.all([ | |
/* Alternatively store each in an array */ | |
// var [x, y, z] = await Promise.all([ | |
// parse results as json; fetch data response has several reader methods available: | |
//.arrayBuffer() |
/** | |
reference - | |
https://developers.google.com/accounts/docs/OAuth2WebServer | |
https://code.google.com/apis/console/ | |
https://developers.google.com/+/api/latest/ | |
**/ | |
////handle all requests here | |
function doGet(e) { |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
body { | |
font-family: Helvetica, arial, sans-serif; | |
font-size: 14px; | |
line-height: 1.6; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
background-color: white; | |
padding: 30px; } | |
body > *:first-child { |
/* | |
* twitter-entities.js | |
* This function converts a tweet with "entity" metadata | |
* from plain text to linkified HTML. | |
* | |
* See the documentation here: http://dev.twitter.com/pages/tweet_entities | |
* Basically, add ?include_entities=true to your timeline call | |
* | |
* Copyright 2010, Wade Simmons | |
* Licensed under the MIT license |
angular.module('myApp') | |
.run(['$rootScope', function ($rootScope) { | |
window.i18n.init(options, function () { | |
// When finished loading translations, trigger re-evaluation of views for translations | |
$rootScope.$digest(); | |
}); | |
}]) | |
.filter('translate', [function(){ | |
return function(key, params) { | |
// i18next needs time to initialize (loading translations). In this phase translation does not work |
This demonstrates raster-based reverse geocoding using canvas and D3.js. Geocoding is based on the color of the pixel at a given projected position. Note that the canvas is only shown here for the sake of explanation and debugging - this would in fact probably work faster if the canvas was not attached to the document at all.
The biggest remaining issue here is precision, which depends on:
Determining the optimum size based on the accuracy of your data is left as an exercise for the reader. Edge cases will also fail here, generally returning null
- one option might be to stroke neighborhoods in a color, and then return an "uncertain" value for any non-grayscale pixel.
<canvas width=220 height=150></canvas> |
var util = require('util'), | |
http = require('http'), | |
events = require('events'); | |
var Twitter = function(opts) { | |
this.username = opts.username; | |
this.password = opts.password; | |
this.track = opts.track; | |
this.data = ''; | |
}; |