Skip to content

Instantly share code, notes, and snippets.

View mlambie's full-sized avatar
🇦🇺
$ iex -S mix

Matt Lambie mlambie

🇦🇺
$ iex -S mix
View GitHub Profile
@mlambie
mlambie / gist:220522
Created October 28, 2009 14:58
Updating an encrypted attribute to an empty string doesn't actually update the attribute
>> c = Factory(:credit_card)
=> #<CreditCard id: 2, first_name: "Royce", last_name: "Ritchie", number: "4ioaILZVhGjVtdV7yJXBUFl8o6c2LeqPQAkRPSnUHl4=\n", month: 10, year: 2010, scheme: "visa", start_month: nil, start_year: nil, issue_number: nil, created_at: "2009-10-28 14:31:10", updated_at: "2009-10-28 14:31:10", friendly_name: nil, token: "f55440238e4dda3298ee9c625c00494ba6608000">
>> c.number.decrypt(PASSWORD)
=> "4242424242424242"
>> c.number = '4242424242424241'
=> "4242424242424241"
>> c.save
=> false
>> c.number.decrypt(PASSWORD)
=> "4242424242424241"
-- Register to track if we need a new window or not
set tab_count to 0
-- The names of the screen sessions - change as necessary
set screen_names to {"tfg_1", "tfg_2", "tfg_3", "tfg_4"}
-- Make our settings globally available
global tab_count, screen_names
-- Mainline
<?php
require_once('FirePHPCore/FirePHP.class.php');
require_once('FirePHPCore/fb.php');
// some reports indicate the output buffering is required
// ob_start();
FB::setEnabled(true);
@mlambie
mlambie / today.sh
Created July 1, 2009 01:54
An ordered account of the commits made against a git repo since midnight
#!/bin/bash
git log --oneline --reverse --since="midnight" --author="mlambie"
@mlambie
mlambie / colours.sh
Created June 22, 2009 05:07
Print the rainbow of colours in your terminal
#!/bin/bash
# Credit: http://blog.infinitered.com/entries/show/6
echo -e "\\e[0mCOLOR_NC (No color)"
echo -e "\\e[1;37mCOLOR_WHITE\\t\\e[0;30mCOLOR_BLACK"
echo -e "\\e[0;34mCOLOR_BLUE\\t\\e[1;34mCOLOR_LIGHT_BLUE"
echo -e "\\e[0;32mCOLOR_GREEN\\t\\e[1;32mCOLOR_LIGHT_GREEN"
echo -e "\\e[0;36mCOLOR_CYAN\\t\\e[1;36mCOLOR_LIGHT_CYAN"
echo -e "\\e[0;31mCOLOR_RED\\t\\e[1;31mCOLOR_LIGHT_RED"
# Recursion
def recursive x
return if x >= 10
puts x
recursive x + 1
end
recursive 0