This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rack::ProcTitle | |
F = ::File | |
PROGNAME = F.basename($0) | |
def initialize(app) | |
@app = app | |
@appname = Dir.pwd.split('/').reverse. | |
find { |name| name !~ /^(\d+|current|releases)$/ } || PROGNAME | |
@requests = 0 | |
$0 = "#{PROGNAME} [#{@appname}] init ..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
# This is a demonstration of using SQLite3's Virtual File System API in Ruby. | |
# | |
# == Synopsis | |
# | |
# This program will store its SQLite database after the __END__ line. | |
# | |
# === In Detail | |
# | |
# SQLite3 uses the DATABase class as a proxy for our IO object. Upon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set(:branch) do | |
if :production == stage | |
branch = Capistrano::CLI.ui.ask("#{`git branch`}\n\nWhich branch do you want to deploy?: ") | |
raise "Error: The master branch cannot be deployed to production." if 'master' == branch | |
else | |
`git branch | grep ^* | sed s/\\*\\ //`.chomp # use current active branche | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [andre ~/.bash](master)$ # clean working directory | |
# [andre ~/.bash](master⚡)$ # dirty working directory | |
# [andre ~/.bash](master~2)$ # checked out revision not a branch | |
# [andre ~/.bash](branch)$ # checked out branch with same commits as master | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "⚡" | |
} | |
function parse_git_branch { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :rails_env, "production" | |
set :passenger_port, 9292 | |
set :passenger_cmd, "#{bundle_cmd} exec passenger" | |
namespace :deploy do | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && #{passenger_cmd} start -e #{rails_env} -p #{passenger_port} -d" | |
end | |
task :stop, :roles => :app, :except => { :no_release => true } do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -x | |
# These variables are always passed to build.sh | |
DIST_DIR="$1" | |
TMP_DIR="$2" | |
ROOT_DIR="$3" | |
PROJNAME="fuse_wait" | |
DESTDIR="usr/local/bin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.configure do |config| | |
config.before(:suite) do | |
ActiveRecord::Base.establish_connection database['one'] | |
DatabaseCleaner.strategy = :deletion | |
ActiveRecord::Base.establish_connection config.database['two'] | |
DatabaseCleaner.strategy = :deletion | |
end | |
config.before(:each) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run {input, parameters} | |
tell application "Finder" | |
set sel to selection | |
if (count sel) > 0 then | |
set myTarget to item 1 of sel | |
else if (count window) > 0 then | |
set myTarget to target of window 1 | |
else | |
set myTarget to path to home folder | |
end if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{namespace examples.simple} | |
/** | |
* Greets a person using "Hello" by default. | |
* @param name The name of the person. | |
* @param? greetingWord Optional greeting word to use instead of "Hello". | |
*/ | |
{template .hello} | |
{if not $greetingWord} | |
Hello {$name}! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
You can now create a spinner using any of the variants below: | |
$("#el").spin(); // Produces default Spinner using the text color of #el. | |
$("#el").spin("small"); // Produces a 'small' Spinner using the text color of #el. | |
$("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color). | |
$("#el").spin({ ... }); // Produces a Spinner using your custom settings. | |
$("#el").spin(false); // Kills the spinner. |
OlderNewer