Skip to content

Instantly share code, notes, and snippets.

View jacobo's full-sized avatar

Jacob Burkhart jacobo

  • HOVER
  • San Francisco, CA
View GitHub Profile
@jacobo
jacobo / gist:6084556
Created July 25, 2013 23:02
that was fun
while true; do find . -name '*service*' | head -1 | while read filename ; do echo $filename; mv $filename ${filename/service/addon}; done; done
@jacobo
jacobo / gist:6216165
Created August 12, 2013 23:02
for travis gem
def setup_engineyard
configure 'deploy', 'provider' => 'engineyard' do |config|
eyrc = File.expand_path(".eyrc", Dir.home)
if File.exists?(eyrc)
config['api_key'] = YAML.load_file(eyrc)["api_token"]
end
env = ask("Environment (optional): ").to_s
config['environment'] = env unless env.empty?
if agree("Run migrations on deploy? ") { |q| q.default = 'yes' }
@jacobo
jacobo / gist:6275395
Created August 19, 2013 23:27
my pull request
From 767031e6fc1f313b29a982dc2f315596ac97bf47 Mon Sep 17 00:00:00 2001
From: Jacob Burkhart & Martin Emde <[email protected]>
Date: Mon, 19 Aug 2013 16:25:02 -0700
Subject: [PATCH] Optimize more by not using normalized_ methods
---
Rakefile | 9 ++++++---
lib/gitable/scp_uri.rb | 10 +++++-----
lib/gitable/uri.rb | 5 ++---
3 files changed, 13 insertions(+), 11 deletions(-)
def load_from_cache
unless File.exists?(cache_path)
return false
end
toload = YAML.load_file(cache_path)
created = {}
models.each do |model|
toload[model.name].each do |id, attributes|
atts = {}
attributes.each do |k,v|
# Put this anywhere in your specfile:
class ReloadHax
def self.setup(*files_to_reload, &go_block)
@files_to_reload, @go_block = files_to_reload, go_block
end
def self.go
ApplicationController.asset_host = "http://billing.localdev.engineyard.com:3000"
ActionView::Resolver.caching = false
@files_to_reload.each{|x| load(File.join(Rails.root,x))}
require 'flickraw'
FlickRaw.api_key= "SECRET"
FlickRaw.shared_secret="SECRET"
def reauth
token = flickr.get_request_token
auth_url = flickr.get_authorize_url(token['oauth_token'], :perms => 'write')
puts auth_url
verify = gets #"123-123-123"
while :; do clear; git add -A; git commit -m "update"; git push origin master; sleep 2; done
https://plus.google.com/events/cqkjpnv749irie3s862vtvnvkik?authkey=COeQg_2V36Wi-QE
gist_it = Proc.new do |content|
post_body = {
description: "gist",
public: false,
files: { :file1 => {content: content}}
}
resp = RestClient.post "https://api.github.com/gists", post_body.to_json, {content_type: :json, accept: :json}
JSON.parse(resp.body)["files"]["file1"]["raw_url"]
end
module WithControllerHelper
class TestCase < ActionController::TestCase
def initialize(controller_class)
super("WithControllerHelper")
setup_controller_request_and_response
@routes = Rails.application.routes
@controller = controller_class.new
end
end