This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
type: "GET", | |
url: 'http://xml2json.heroku.com', | |
data:'url=https://www.pivotaltracker.com/services/v3/projects/'+projectId+'/iterations/current?token='+trackerToken, | |
dataType: 'jsonp', | |
success: function(data) { | |
console.log(data); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'daemons' | |
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) | |
Daemons.run_proc('navvy_worker', :dir => Rails.root.join('tmp/pids')) do | |
logger = Logger.new Rails.root.join('log/navvy.log') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
require 'carrierwave/processing/mini_magick' | |
class PicUploader < CarrierWave::Uploader::Base | |
include CarrierWave::MiniMagick | |
# Choose what kind of storage to use for this uploader | |
storage :grid_fs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
'name': 'Joe Bloggs', | |
'emails': ['[email protected]', '[email protected]'], | |
'phone_numbers': [{'type':'work', | |
'number':'+447872456173' | |
}, | |
{'type':'mobile', | |
'number':'+447273456679' | |
}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Company | |
include Mongoid::Document | |
has_many :projects | |
end | |
class Project | |
include Mongoid::Document | |
has_many :project_zones | |
has_many :incidents | |
has_many_related :safety_inspectors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'geoip' | |
module Rack | |
# Rack::GeoIPCountry uses the geoip gem and the GeoIP database to lookup the country of a request by its IP address | |
# The database can be downloaded from: | |
# http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz | |
# | |
# Usage: | |
# use Rack::GeoIPCountry, :db => "path/to/GeoIP.dat" | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/enviroment.rb | |
config.gem 'mongo' | |
config.gem 'mongo_mapper' | |
# remove AR | |
config.frameworks -= [ :active_record, :active_resource ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NoWWW | |
STARTS_WITH_WWW = /^www\./i | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
if request.get? && env['HTTP_HOST'] =~ STARTS_WITH_WWW |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.metals = ["Gridfs"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pp' | |
require 'rubygems' | |
require 'mongo_mapper' | |
MongoMapper.database = 'testing' | |
class Site | |
include MongoMapper::Document | |
key :domain, String | |
key :authorizations, Array |
NewerOlder