Skip to content

Instantly share code, notes, and snippets.

View joyrexus's full-sized avatar

J. Voigt joyrexus

View GitHub Profile
@joyrexus
joyrexus / README.md
Last active August 29, 2015 13:55
Geocoding CLI

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:

@joyrexus
joyrexus / README.md
Created January 29, 2014 16:16
Reverse geocoding CLI

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:

@joyrexus
joyrexus / README.md
Created January 29, 2014 16:47
Geolocation and reverse geocoding

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.

@joyrexus
joyrexus / README.md
Created February 14, 2014 02:58
Stream demo
@joyrexus
joyrexus / README.md
Created February 14, 2014 19:14
Observer/pubsub demo

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
@joyrexus
joyrexus / README.md
Created February 14, 2014 19:50
EventEmitter demo

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
@joyrexus
joyrexus / README.md
Last active August 29, 2015 13:56
Object stream filter demo

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
@joyrexus
joyrexus / README.md
Created February 18, 2014 15:24
Object stream mapper demo

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)
@joyrexus
joyrexus / README.md
Created February 18, 2014 16:13
concat stdin using Transform stream
@joyrexus
joyrexus / README.md
Created February 18, 2014 16:30
Object stream reducer demo