Skip to content

Instantly share code, notes, and snippets.

# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@bpizzi
bpizzi / gist:669191
Created November 9, 2010 15:00
Nginx site conf for symfony 1.4
We couldn’t find that file to show.
@77web
77web / sfValidatorIntegerRange.class.php
Created May 26, 2011 04:02
integer filter widget and integer range validator for symfony1.4
<?php
/**
* sfValidatorIntegerRange
* @package symfony
* @subpackage validator
* @auther Hiromi Hishida<info@77-web.com>
*/
class sfValidatorIntegerRange extends sfValidatorBase
{
protected function configure($options = array(), $messages = array())
@kirs
kirs / avatar_uploader.rb
Created September 24, 2011 07:33
Validation of image dimensions with CarrierWave
# encoding: utf-8
class AvatarUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :file
# Override the directory where uploaded files will be stored.
@tuongaz
tuongaz / BaseModelManager.php
Created April 1, 2012 03:51
Symfony2 Model Manager
<?php
abstract class BaseModelManager {
protected $em;
protected $class;
protected $repository;
protected $container;
/**
* Constructor.
@turbod
turbod / getopts.zsh
Created September 8, 2012 15:46
Processing options and parameters with getopts
#!/bin/zsh
# processing options and parameters with getopts
while getopts :a:b:cd opt
do
case "$opt" in
a) echo "The -a option, value $OPTARG";;
b) echo "The -b option, value $OPTARG";;
c) echo "The -c option";;
d) echo "The -d option";;
@krusynth
krusynth / site.py
Created October 13, 2012 22:06
Builds site directory, database, db user, virtualhost file, and /etc/hosts entry
#!/usr/bin/python
# Base config
basedir = '/Users/YOURUSERNAME/'
user = 'YOURUSERNAME'
# Setup User
import pwd
@sunny
sunny / paperclip_has_destroyable_file.rb
Created October 25, 2012 17:03
Rails Initializer to add destroyable attachments with Paperclip
# encoding: UTF-8
class ActiveRecord::Base
# Class method to add destroyable paperclip attachments.
#
# Example:
# has_attached_file :image
# has_destroyable_file :image
# attr_accessible :image_delete
#
anonymous
anonymous / index.html
Created November 7, 2012 10:36
A CodePen by Fabrice Weinberg.
<h1>atebits spinning logo</h1>
<div class="atebits"></div>
@chocnut
chocnut / cmd
Created December 10, 2012 20:27 — forked from pifleo/cmd
Proxy List Fetcher Using Ruby
$ chmod +x ./proxy_list_fetcher.rb
$ ./proxy_list_fetcher.rb | head
180.94.88.58 8080 Afghanistan fast HTTPS High +KA
187.87.155.2 8080 Brazil fast HTTPS High +KA
120.132.132.119 8080 China medium HTTPS High +KA
210.211.109.244 8081 Viet Nam fast HTTP Low
216.244.71.143 3128 United States medium HTTPS High +KA
190.237.224.22 8080 Peru slow HTTPS High +KA