Skip to content

Instantly share code, notes, and snippets.

Avatar

J. Voigt joyrexus

View GitHub Profile
@joyrexus
joyrexus / README.md
Created Jan 29, 2014
Geolocation and reverse geocoding
View README.md

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 Jan 29, 2014
Map current location with address
View README.md
@joyrexus
joyrexus / README.md
Created Jan 29, 2014
Reverse geocoding CLI
View README.md

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
Last active Aug 29, 2015
Geocoding CLI
View README.md

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 Feb 14, 2014
EventEmitter demo
View README.md

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
Created Feb 14, 2014
Observer/pubsub demo
View README.md

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
View README.md
@joyrexus
joyrexus / README.md
Created Feb 18, 2014
concat stdin using Transform stream
View README.md
@joyrexus
joyrexus / README.md
Last active Aug 29, 2015
Object stream filter demo
View README.md

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 Feb 18, 2014
Object stream reducer demo
View README.md