Skip to content

Instantly share code, notes, and snippets.

View craigw's full-sized avatar
🦄

Craig R Webster craigw

🦄
View GitHub Profile
@craigw
craigw / models.php
Created October 14, 2009 11:13 — forked from sneeu/models.php
<?php
abstract class Model {
static abstract function getFields();
static function getFieldsForSQL() {
return implode(', ', self::getFields());
}
static function getAll() {
@craigw
craigw / models.php
Created October 14, 2009 11:13 — forked from sneeu/models.php
<?php
abstract class Model {
static abstract function getFields();
static function getFieldsForSQL() {
return implode(', ', self::getFields());
}
static function getAll() {
@craigw
craigw / gist:175901
Created August 26, 2009 22:31 — forked from james/gist:175877
# 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 = []
#!/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
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
[user]
name = <your name>
email = <your email address>
[alias]
co = checkout
ci = commit
stat = status
[mirror]
# 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."
class SandwichesController < ApplicationController
def new
end
def create
@sandwich = Sandwich.create(params[:sandwich])
redirect_to :action => 'show', :id => @sandwich
end
def show
# 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."
<p>This sandwich is called <%=h @sandwich.name %>.</p>