Skip to content

Instantly share code, notes, and snippets.

@GarPit
GarPit / paperclip_restructure.rake
Created March 18, 2014 09:21
paperclip_restructure.rake
#require "ruby-debug"
require "logger"
Thread.abort_on_exception = true
namespace :paperclip_restructure do
namespace :assets do
desc "Migrate assets to new folder structure"
task :migrate, :workers, :needs => :preload do |t, args|

####Go to temp dir $ cd /tmp ####Download your version of btsync i386 or x64 $ curl http://btsync.s3-website-us-east-1.amazonaws.com/btsync_i386.tar.gz -o btsync.tar.gz # i386 $ curl http://btsync.s3-website-us-east-1.amazonaws.com/btsync_x64.tar.gz -o btsync.tar.gz # x64 ####Then unpack this shit $ tar -xf btsync.tar.gz ####And move to your local bin $ sudo mv btsync /usr/local/bin/ ####Okey, generate sample config

@GarPit
GarPit / unicorn.rb
Created October 23, 2012 13:33
Our company unicorn.rb sample
# Sample verbose configuration file for Unicorn (not Rack)
#
# This configuration file documents many features of Unicorn
# that may not be needed for some applications. See
# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb
# for a much simpler configuration file.
#
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation.
app_name = "rename_me"
@GarPit
GarPit / mongod
Created September 13, 2012 07:56
MongoDB init script
#!/bin/bash
#
# mongodb Startup script for the mongodb server
#
# chkconfig: - 64 36
# description: MongoDB Database Server
#
# processname: mongodb
#
@GarPit
GarPit / xml_me.rb
Created August 23, 2012 10:19
simple xml generation
def xml
@xml_string << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
end
def tag(tag, attrs={}, &block)
@xml_string << "<#{tag}"
text = attrs.delete(:text)
@xml_string << " " if not attrs.empty?
attrs.each_pair do |key, value|
@xml_string << "#{key.to_s}=\"#{value.to_s}\""
@GarPit
GarPit / deploy.rb
Created July 16, 2012 06:06
Our company deploy.rb sample
require "bundler/capistrano"
#set :whenever_command, "bundle exec whenever" # uncomment this if you need whenever integration
#require "whenever/capistrano" # uncomment this if you need whenever integration
load 'deploy/assets'
set :rvm_ruby_string, '1.9.3'
# Load RVM's capistrano plugin.
require "rvm/capistrano"
set :rvm_type, :system
Host heroku.com
HostName heroku.com
User git
IdentityFile ~/.ssh/heroku.identity
IdentitiesOnly yes
@GarPit
GarPit / gist:2132032
Created March 20, 2012 06:34 — forked from dx7/gist:1333785
Installing ruby-debug with ruby-1.9.3-p0
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1333785)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
@GarPit
GarPit / gist:1077621
Created July 12, 2011 08:35 — forked from jimmysoho/gist:534668
unicorn.rb
# Our own variable where we deploy this app to
deploy_to = "/srv/example.com"
current_path = "#{deploy_to}/current"
shared_path = "#{deploy_to}/shared"
shared_bundler_gems_path = "#{shared_path}/bundler_gems"
# See http://unicorn.bogomips.org/Sandbox.html
# Helps ensure the correct unicorn_rails is used when upgrading with USR2
Unicorn::HttpServer::START_CTX[0] = "#{shared_bundler_gems_path}/bin/unicorn_rails"