Quick demo of how to use Google's Geocoding API.
Pass in an address/location as argument and the location coordinates are returned.
For example:
geocode.coffee '973 E 61st Street, Chicago, IL'
... returns:
Quick demo of how to use Google's Geocoding API.
Pass in an address/location as argument and the location coordinates are returned.
For example:
geocode.coffee '973 E 61st Street, Chicago, IL'
... returns:
Quick demo of how to use Google's reverse geocoding API.
Pass in a pair of latitude/longitude coordinates as args and the address is returned.
For example:
address.coffee 41.7840748 -87.6021859
... returns:
A simple demo utilizing geolocation sensing and reverse geocoding.
Displays your current location and address.
We're using the Geolocation API to get the users current location coordinates and Google's reverse geocoding service to get the address associated with those coordinates.
Demo basic use of node streams.
See also ...
Quick demo of the observer / pubsub pattern.
The scenario here is a publisher notifiying its subscribers of events. Subscribers have callbacks registered with the publisher for particular event types. Each subscriber's callback is called when the publisher emits the associated event.
# create instances
pub = new Pub('Acme Media') # publisher
Quick demo of the observer / pubsub pattern.
Here we leverage node's EventEmitter class as the basis for our observable/publisher. (See this variant for a publisher class not based on EventEmitter
.)
The scenario is a publisher notifiying its subscribers of events. Subscribers have callbacks (watch
, read
) registered with the publisher that listen for particular event types. Each subscriber's callback is called when the publisher emits the associated event.
# create instances
acme = new Pub('Acme Media') # publisher
bob = new Sub('Bob') # subscribers
Demonstrate how to extend stream's Transform base class to create streaming filters for streamed objects.
We observe each object in the stream, pushing along any values meeting the filter's predicate condition. In other words, we're filtering out any values that do not meet the predicate condition.
odd = (d) -> d % 2
Demonstrate how to extend stream's Transform base class to create streaming mappers for streamed objects.
inc = new Map((d) -> d + 1) # increment each value by one
count
.upto(3)
.pipe(inc)
Use Transform
stream to concat strings coming in on stdin
.
bytewiser's buffer concat
problem and discussion
Demonstrate how to extend stream's Transform base class to create reducers for streamed objects.
count = new Counter
iter = (memo, d) -> memo + d
sum = new Reduce(iter, 0)
count