- Start a Sinatra server on port 4000
- GET / to that server triggers a
git pull
and mod_rails restart - Hit port 4000 locally after pushing
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
# | |
# = Capistrano database.yml task | |
# | |
# Provides a couple of tasks for creating the database.yml | |
# configuration file dynamically when deploy:setup is run. | |
# | |
# Category:: Capistrano | |
# Package:: Database | |
# Author:: Simone Carletti <weppos@weppos.net> | |
# Copyright:: 2007-2010 The Authors |
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
// Examples: | |
// | |
// button_to "Mark as unread", mark_as_unread_message_path(message), :method => :put, :class => "form_to_link" | |
// button_to "New Alert", new_alert | |
// | |
jQuery(document).ready(function($) { | |
jQuery('.form_to_link').each(function(el){ | |
var form = el.parents('form'); | |
form.after('<a href="' + form.attr('action') + '" class="button_link_to">' + form_to_link.attr('value') + '</a>'); | |
form.hide(); |
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 -e | |
# for a setup script see http://gist.github.com/32917 | |
PASSENGER=2.2.3 | |
REE="ruby-enterprise-1.8.6-20090610" | |
PREFIX=/opt/$REE | |
# git checkout of git://github.com/FooBarWidget/passenger.git | |
cd ~/passenger | |
git fetch origin |
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
# Three things to add: | |
# * before_filter call | |
# * action_has_layout? method (if you have one, combine them) | |
# * adjust_for_inline | |
# | |
class ApplicationController < ActionController::Base | |
# ... | |
before_filter :adjust_for_inline | |
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
[user] | |
name = Scott Chacon | |
email = schacon@gmail.com | |
[alias] | |
serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git | |
unstage = reset HEAD | |
lol = log --pretty=oneline --abbrev-commit --graph --decorate | |
branches = !git-branches | |
st = status | |
[gui] |
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
~vp(master)> cat ~/.gitconfig | |
...SNIP... | |
[alias] | |
datetag = !git tag `date \"+%Y%m%d%H%M\"` | |
update = pull --rebase | |
commdiff = log --pretty=oneline --left-right | |
...SNIP... | |
~vp(master)> git commdiff master...staging | |
>bb569b9a8c70a61ecffd4def3ac5e460848e0f36 Merge branch 'master' into staging | |
>f95b7db13fb48b3b5e1c2c484d00909a89f468d5 bulk edit on search page is no longer experimental |
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
development: &global_settings | |
database: textual_development | |
host: 127.0.0.1 | |
port: 27017 | |
test: | |
database: textual_test | |
<<: *global_settings | |
production: |
Add this little snippet to your ~/.gitconfig
and it amps up your git pull
by means of git up
- Adds in a list of the commits you're pulling down
- Auto-prunes remote branches
- Defaults to
pull --rebase
- gets rid of unnecessary merge commits. If you don't know what rebase does, this is probably safe for you. If you know what rebase does, you should know where this will not be safe for you.
Scott Chacon and Ryan Tomayko basically figured out how to do this and I am stealing all of the credit.
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 JsonHax | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
if env['CONTENT_TYPE'] == 'application/json' | |
env['CONTENT_TYPE'] = 'application/xml' | |
env['REQUEST_URI'].gsub!(/\.json/, '.xml') |
OlderNewer