Skip to content

Instantly share code, notes, and snippets.

View tyrel86's full-sized avatar

Tyrel Richey tyrel86

View GitHub Profile
@tyrel86
tyrel86 / gist:5167688
Created March 15, 2013 05:33
Leaflet js
$(document).ready( function() {
var user_location = $('user_location')
var user_lat = parseFloat(user_location.data('lat'))
var user_lng = parseFloat(user_location.data('lng'))
var map;
var markers = [];
if($("#map").size() > 0) {
map = L.map('map').setView( [user_lat, user_lng], 11 )
#!/usr/bin/ruby
# This script acts as a command-line filter to convert a BSON file (such as from mongodump) to an equivalent JSON file
# The resulting JSON file will be an array of hashes
# Any binary values from the BSON file are converted to base64 (such as Mongo's _id fields)
# I originally wrote this script so that Mongo files can be easily used with jsawk for
# offline data processing -- https://github.com/micha/jsawk
#
# To invoke, assuming mycollection.bson is a file from mongodump:
# ruby bson2json.rb < mycollection.bson > mycollection.json
@tyrel86
tyrel86 / implementation
Created May 19, 2014 19:00
Sunlight API access
s = Sunlight::UrlGenerator.new("inventory/904655", {format: "json"})
At this test run the URL evaulated to https://services.sunlightsupply.com/v1/inventory/904655?format=json&X-ApiKey=gMgF47gaFdncTcE2GLoTEdmAcXHWakNXyKdPZjKSoiMAWgWLCR&time=2014-05-19T18:59:49Z&signature=113295BAAD176C82CD09127F7CB5E4135B995FA1
I got an invalid signature