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
# Recursion | |
def recursive x | |
return if x >= 10 | |
puts x | |
recursive x + 1 | |
end | |
recursive 0 |
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
#!/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" |
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
#!/bin/bash | |
git log --oneline --reverse --since="midnight" --author="mlambie" |
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
<?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); |
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
-- 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 |
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
>> 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" |
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
** What did you do to get good at Rails? | |
ML: The only thing you can do is cut code. You can read all the books, | |
watch all the screencasts and subscribe to all the blogs in the world, | |
but until you start writing your own code, you won't get experience and | |
you won't become proficient in Rails. | |
** Who taught you what you know? | |
ML: Railscasts with Ryan Bates is the obvious one, but lately I've really |
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
mlambie@prowl:~$ grep mlambie /etc/passwd | |
mlambie:x:1000:1001:Matthew Lambie,,,:/home/mlambie:/bin/bash | |
mlambie@prowl:~$ grep mlambie /etc/passwd | sed 's/Matthew/Andrew/' | |
mlambie:x:1000:1001:Andrew Lambie,,,:/home/mlambie:/bin/bash |
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
# The desired array | |
frequencies = ["hourly", "daily", "weekly", "monthly"] | |
# Shorthand conversion into array | |
frequencies = %w{hourly daily weekly monthly} | |
# Note the delimiter is not important, but must match | |
frequencies = %w"hourly daily weekly monthly" | |
frequencies = %w|hourly daily weekly monthly| |
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
mencoder -endpos 01:00:00 -ovc copy -oac copy input.avi -o first_hour.avi | |
mencoder -ss 01:00:00 -oac copy -ovc copy input.avi -o remainder.avi |
OlderNewer