Skip to content

Instantly share code, notes, and snippets.

View coty's full-sized avatar

Coty Rosenblath coty

View GitHub Profile
@coty
coty / sl_gems_update.rb
Created January 11, 2010 16:12 — forked from mattetti/sl_gems_update.rb
Modified to find GEM_PATH and actually check bundle type
#!/usr/bin/env ruby
require 'rubygems'
puts "looking for the gems to upgrade..."
gem_info = Struct.new(:name, :version)
to_reinstall = []
Dir.glob("#{Gem.dir}/**/*.bundle").map do |path|
path =~ /.*1.8\/gems\/(.*)-(.*?)\/.*/
name, version = $1, $2
bundle_info = `file #{path}`
@coty
coty / multi_store_finder.rb
Created April 20, 2011 21:52 — forked from sarchertech/multi_store_finder.rb
This requires Ruby 1.9. It will run under 1.8 because uniq! will ignore the block, but it won't be correct.
require 'yaml'
class Store
attr_accessor :name, :address, :city, :state, :zip, :phone_number
def unique_attributes
[name[0..5], zip, phone_number, address[0..3]]
end
end
@coty
coty / two_factor_ssh.rb
Created September 29, 2011 19:21 — forked from moomerman/two_factor_ssh.rb
Two Factor SSH Authentication
#!/usr/bin/env ruby
require 'rubygems'
require 'rotp'
require 'time'
user = ARGV[0]
secret = ARGV[1]
abort unless user and secret
trap("INT") do
@coty
coty / crosenblath.json
Created October 3, 2011 14:59
Hacker Hub Profile
{
"settings" : {
"id" : "coty",
"name" : "Coty Rosenblath",
"avatar" : "https://twimg0-a.akamaihd.net/profile_images/60343034/Head_Shot_reasonably_small.jpg",
"enable_search" : true
},
"content" : {
"twitter":{
"title" : "Coty's Twitter",
@coty
coty / .irbrc
Created November 29, 2011 04:22 — forked from adamcrown/.irbrc
My Bundler proof .irbrc file including wirble, awesome_print, hirb, console logging and route helpers
require 'rubygems' unless defined? Gem # rubygems is only needed in 1.8
def unbundled_require(gem)
loaded = false
if defined?(::Bundler)
Gem.path.each do |gems_path|
gem_path = Dir.glob("#{gems_path}/gems/#{gem}*").last
@coty
coty / snippet.rb
Created January 10, 2012 15:21 — forked from indirect/snippet.rb
Rack middleware so NewRelic shows time as ruby
# This adds a request header so NewRelic knows when the middleware stack
# started processing. Hopefully this means we'll get better metrics, split
# between actual request queueing and time spent in the middlewares.
module Plex
class MiddlewareStart
def initialize(app)
@app = app
end
def call(env)
@coty
coty / installation.sh
Created March 13, 2012 22:01 — forked from mikhailov/installation.sh
Nginx+passenger application config: ssl redirection, http headers, passenger optimal settings. see details: http://mikhailov.posterous.com/nginx
$ cd /usr/src
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz
$ tar xzvf ./nginx-0.8.52.tar.gz
$ rm ./nginx-0.8.52.tar.gz
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc
$ passenger-install-nginx-module
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52
# Where do you want to install Nginx to?: /opt/nginx
@coty
coty / gist:2167303
Created March 23, 2012 05:39 — forked from jrochkind/gist:2161449
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@coty
coty / hack.sh
Created April 1, 2012 19:46 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@coty
coty / deploy.rb
Created April 18, 2012 13:47 — forked from netzpirat/deploy.rb
Capistrano recipe to sync rails database and files within a multi stage environment
set :sync_directories, ["public/assets", "public/galleries"]
set :sync_backups, 3