Skip to content

Instantly share code, notes, and snippets.

View caius's full-sized avatar
👻

Caius Durling caius

👻
View GitHub Profile
@caius
caius / gist:40372
Created December 28, 2008 04:41 — forked from emk/gist:40364
Feature: Logging in and out
Scenario: Log in with valid name and password
Given a site
And a global admin
When I try to access the overview page
And I log in as with valid credentials
Then I should see the overview page
And should be logged in
@caius
caius / gist:68141
Created February 21, 2009 19:08
Trying to explain the difference in how blocks "bind" to methods in ruby
def foo *args
p args
puts "foo: " + block_given?.to_s
return "foo"
end
def bar
puts "bar: " + block_given?.to_s
return "bar"
end
<?php
require "HTTParty.php";
class FMyLife extends HTTParty
{
function __construct() {
$this->base_uri = "http://api.betacie.com/view";
$this->default_params = array("key" => "readonly", "language" => "en");
}
require "date"
require "time"
class FixedRow
attr_accessor :formats
def initialize
@columns = []
@formats = {
:datetime => lambda {|x| Date.parse(x) }
@caius
caius / httpdump
Created April 4, 2009 00:35 — forked from peterc/httpdump
# Monitor HTTP requests being made from your machine with a one-liner..
# Replace "en1" below with your network interface's name (usually en0 or en1)
sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*"
# OR.. to be able to use as "httpdump" from anywhere, drop this into ~/.bash_profile:
# (again replace "en1" with correct network interface name)
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*""
# All the above tested only on OS X.
1) Put terminal_clone_tab somewhere in
your path and make sure it is executable (I put it in ~/bin)
chmod u+x terminal_clone_tab
2) Then add the following alias (~/.bash_profile or something)
alias nt='terminal_clone_tab'
3) Then you can hit nt (for new tab) anywhere
and a new tab will open up in same directory.
If there is an easier way to do this, let me know nunemaker@gmail.com.

The bits I'm really looking forward to in Snow Leopard.
From http://www.apple.com/macosx/refinements/enhancements-refinements.html

Finder Rewritten for Snow Leopard.

The Finder has been completely rewritten using Cocoa to take advantage of the new technologies in Snow Leopard, including 64-bit support and Grand Central Dispatch. It’s more responsive from top to bottom, with snappier performance throughout the Finder.

More reliable disk eject.

Snow Leopard makes ejecting external drives more reliable. Core system services such as Spotlight indexing and file system events will intelligently stop their work so you can remove your drive. And improved dialogs tell you which applications are using the drive so you know what to close in order to safely disconnect your drive.

@caius
caius / gist:128644
Created June 12, 2009 13:51
A few bash functions I use to save typing
# Runs `git push` before `cap deploy`
# Otherwise just passes through to `cap`
function cap {
CAP="`which cap`"
if [[ "$1" == "deploy" || "$2" == "deploy" ]]; then
git push && $CAP $*
else
$CAP $*
fi
}
# coding: utf-8
# rails application template for generating customized rails apps
#
# == requires ==
#
# * rails 2.3+, rspec, cucumber, culerity (langalex-culerity gem), machinist
#
# == a newly generated app using this template comes with ==
#