Skip to content

Instantly share code, notes, and snippets.

View fcoury's full-sized avatar

Felipe Coury fcoury

View GitHub Profile
# ~/.bash_profile
sg() {
local migration=`script/generate $@ | awk ' /db\/migrate\//{print $NF}'`
if [ $migration ]; then $EDITOR $migration && rake db:migrate; fi
}
alias sgmo="sg model $@"
alias sgmi="sg migration $@"
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
# Author: Michael van Rooijen
# Description:
# This recipe is designed to work for people using Phusion Passenger,
# Git as your repository.
#
# The script (initially) does the following:
# - It first (after you run cap:deploy setup) will set up the capistrano environment on your remote machine
# - After that, it will sync your current database.yml file to the "shared" location on the remote machine
# - You are now basically ready to deploy.
# - Once you run "cap:deploy" it will start the deployment
/*
* a smart poller for jquery.
* (by github)
*
* simple example:
*
* $.smartPoller(function(retry) {
* $.getJSON(url, function(data) {
* if (data) {
* doSomething(data)
# These aliases provide a single shell command: r
#
# r opens up three tabs in Terminal with:
#
# * script/console
# * tail -f log/development.log
# * Also starts $EDITOR
# * You could make it load script/server, but I use this:
# http://www.fngtps.com/passenger-preference-pane
#
.CodeRay {
background-color: #232323;
border: 1px solid black;
font-family: 'Courier New', 'Terminal', monospace;
color: #E6E0DB;
padding: 3px 5px;
overflow: auto;
font-size: 12px;
margin: 12px 0;
}
#!/usr/bin/env ruby
require 'rubygems'
require 'thor'
require 'chef'
require 'chef/node'
require 'chef/rest'
# Please see the readme for overview documentation.
#
@fcoury
fcoury / gist:179033
Created September 1, 2009 10:25 — forked from tpitale/gist:162954
#! /bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon

A Note

A lot of people have been trying to clone this Gist recently. For some reason, none of them seem to be going through. I've converted this to a normal Github repo, which should work better: http://github.com/h0rs3r4dish/scratch.rb

Basics

The method page will create a new page:

@fcoury
fcoury / iterator.rb
Created October 31, 2009 12:46 — forked from tmm1/iterator.rb
module EventMachine
# A simple iterator for concurrent asynchronous work.
#
# Unlike ruby's built-in iterators, the end of the current iteration cycle is signaled manually,
# instead of happening automatically after the yielded block finishes executing. For example:
#
# (0..10).each{ |num| }
#
# becomes:
#