Skip to content

Instantly share code, notes, and snippets.

View TerrenceLJones's full-sized avatar

Terrence L. Jones TerrenceLJones

View GitHub Profile
# -*- ruby -*-
#encoding: utf-8
require 'app/payments' unless defined?( APP::Payments )
require 'csv'
require 'zip'
require 'loggability'
require 'prawn'
require 'prawn/table'
@TerrenceLJones
TerrenceLJones / API-Key-Abstraction-Example.md
Created September 12, 2014 15:13
API-Key-Abstraction-Example

How to Remove Api Keys From Version Controlled Code

This is example is using Devise and OmniAuth Facebook Rails gems. But the concept should transfer for use with any Authentication system.

CREATE A FILE CALL api_keys.yml and place it in your config folder. Configure it how ever you desire.

defaults: &defaults
@TerrenceLJones
TerrenceLJones / geocoder-ruby-gem.md
Last active August 29, 2015 14:06
Geocoder Ruby Gem Overview

Geocoder

For the full reference, go to https://github.com/alexreisner/geocoder.

Overview

Geocoder is a complete geocoding solution for Ruby. With Rails it adds geocoding (by street or IP address), reverse geocoding (find street address based on given coordinates), and distance queries. – Geocoder GitHub Repo

var request = require('request');
exports.index = (req, res)=>{
// request('https://api.instagram.com/v1/tags/snow/media/recent?access_token=10528748.f59def8.8807aab6f2314e86a2a3f38aef27f4a8', function (error, response, body) {
// if(!error && response.statusCode === 200) {
// body = JSON.parse(body);
request('http://api.bandsintown.com/artists/mbid_b1003bf1-25b8-41f4-a783-36060f987913/events?format=json&app_id=NSS&date=all', function (error, response, body) {
if(!error && response.statusCode === 200) {
body = JSON.parse(body);
body.each(show=>{
Show.create({date:show.datetime,latitude:show.venue.latitude,longitude:show.venue.longitude,venue:show.venue.name}, show=>{