This file contains hidden or 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
cd `brew --prefix` | |
rm -rf Cellar | |
brew prune | |
rm `git ls-files` | |
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions | |
rm -rf .git | |
rm -rf ~/Library/Caches/Homebrew |
This file contains hidden or 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 RestrictAddresses | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
request = Rack::Request.new(env) | |
incoming_ip_address = request.env['REMOTE_ADDR'] | |
allowed_range = ['127.0.0.1'] |
This file contains hidden or 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 'rubygems' | |
require "net/http" | |
require "net/https" | |
require "uri" | |
access_token = "" #App Access Token (app_id|app_secret) | |
user_id = "" #FBID of an app user who has granted perms to publish actions within your app | |
og_object_url = "http://dby-staging.herokuapp.com/og/84" #url to the OG data to be pushed along with your user |
This file contains hidden or 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
var isMobile = { | |
Android: function() { | |
return navigator.userAgent.match(/Android/i) ? true : false; | |
}, | |
BlackBerry: function() { | |
return navigator.userAgent.match(/BlackBerry/i) ? true : false; | |
}, | |
iOS: function() { | |
return navigator.userAgent.match(/iPhone|iPad|iPod/i) ? true : false; | |
}, |
This file contains hidden or 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
# check the type of file and tell them to F off if its wrong. | |
validates_attachment :image, :presence => true, :size => { :in => 0..10.kilobytes } |
This file contains hidden or 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
%20var%20template%20=%20'http://www.facebook.com/dialog/pagetab?app_id=%7Bid%7D&next=%7Bnext%7D',%20id%20=%20prompt('App%20ID'),next%20=%20prompt('App%20URL',%20'http://example.heroku.com');%20if(id%20&&%20next)%7B%20url%20=%20template.replace('%7Bid%7D',%20id).replace('%7Bnext%7D',%20next);window.location%20=%20url;%7D |
This file contains hidden or 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
def check_user_location | |
# need to intro a whitelist for IP addresses | |
user_ip = request.ip | |
unless user_ip.nil? | |
logger.info("User IP Address is: #{user_ip}") | |
user_country = request.location.country | |
logger.info("User Country is: #{user_country}") | |
# if in production mode and the user country doesnt match one on the whitelist | |
# then throw them out to a restricted page. | |
redirect_to restricted_path() unless knock_knock(user_ip, user_country) |
This file contains hidden or 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 'fileutils' | |
# Warning: The following deploy task will completely overwrite whatever is currently deployed to Heroku. | |
# The deploy branch is rebased onto master, so the push needs to be forced. | |
desc "Deploy app to Heroku after precompiling assets" | |
task :deploy do | |
deploy_branch = 'heroku' | |
remote = 'heroku' | |
deploy_repo_dir = "tmp/heroku_deploy" |
This file contains hidden or 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
def redirect_to_canvas_if_no_signed_request_and_not_mobile | |
if !mobile_device? and !request.post?() | |
extended_url = "" | |
if params | |
extended_url = "#{request.fullpath}" | |
end | |
redirect_to "#{Settings.facebook.canvas_url}#{extended_url}" | |
end |
This file contains hidden or 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 Instagrammer | |
cattr_accessor :config, :url | |
class << self | |
def perform(url, options = {}) | |
defaults = {:expires_in => 15.minutes } | |
self.config = defaults.merge(options) | |
self.url = url |