This file contains hidden or 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
<?php | |
abstract class Model { | |
static abstract function getFields(); | |
static function getFieldsForSQL() { | |
return implode(', ', self::getFields()); | |
} | |
static function getAll() { |
This file contains hidden or 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
<?php | |
abstract class Model { | |
static abstract function getFields(); | |
static function getFieldsForSQL() { | |
return implode(', ', self::getFields()); | |
} | |
static function getAll() { |
This file contains hidden or 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
# Ruby tends to pass by reference. | |
# http://groups.google.com/group/ruby-talk-google/msg/aa5cdea350f46314 | |
# | |
# Notice all the same object ID in the output. | |
# | |
class Test | |
def self.test | |
hash = {:entry => ""} | |
array = [] |
This file contains hidden or 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 | |
REPO=$1 | |
git clone $REPO | |
cd `basename $REPO .git` | |
for BRANCH in `git branch -r`; do | |
git co --track \ | |
-b remote/$BRANCH \ | |
$BRANCH | |
done |
This file contains hidden or 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 your (always-connected) server. | |
$ screen -S irc | |
$ irssi | |
On your Mac. | |
$ cat ~/bin/irc | |
#! /usr/bin/env bash | |
ssh -t <server-ip-or-fqdn> $@ screen -xR irc |
This file contains hidden or 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 = <your name> | |
email = <your email address> | |
[alias] | |
co = checkout | |
ci = commit | |
stat = status | |
[mirror] |
This file contains hidden or 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
# Look to see what's been changed | |
git status | |
# Stage the sandwiches controller | |
git add app/controllers/sandwiches_controller.rb | |
# Commit the changes with a message | |
git commit -m "Added a controller for sandwiches." |
This file contains hidden or 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 SandwichesController < ApplicationController | |
def new | |
end | |
def create | |
@sandwich = Sandwich.create(params[:sandwich]) | |
redirect_to :action => 'show', :id => @sandwich | |
end | |
def show |
This file contains hidden or 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
# Check what's changed | |
git status | |
# Stage the views for the next commit | |
git add app/views/sandwiches | |
# Commit the changes | |
git commit -m "Added create and show views for sandwiches." |
This file contains hidden or 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
<p>This sandwich is called <%=h @sandwich.name %>.</p> |