Discover gists
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
use strict; | |
print "Hello World!\n"; |
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 | |
DIR="${1}" | |
if [ ! -d "${DIR}" ]; then | |
echo "call me with a directory, e.g.:" | |
echo "${0} /some/path/to/dir" | |
exit 1 | |
fi | |
gnome-terminal --geometry=130x35+345+250 \ |
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
function upload_img($id = null) | |
{ | |
$this->layout = 'empty'; | |
//Configure::write('debug', 0); | |
if(empty($this->data)) { | |
die(); | |
} | |
$full = $this->JqImgcrop->uploadImage($this->data['Listing']['image'], 'img/listings/full/', time()); | |
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
<table bgcolor="000000" width="471" height="580" border="0" cellpadding="0" cellspacing="0"> | |
<tr> | |
<td colspan="3"> | |
<a href="http://www.urbmob.com/" target="_blank"><img src="http://www.qmobile.us/widget/top.png" alt="Visit Urbmob.com to get your own ringtone widget!" border="0" width="471" height="145"></a> | |
</td> | |
</tr> | |
<tr> | |
<td rowspan="2" width="64" height="435"> | |
<img src="http://www.qmobile.us/widget/left.png" border="0" style="vertical-align:top;"> | |
</td> |
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
<xmlData> | |
<ringtone_id>4</ringtone_id> | |
<sender_number>000-000-000</sender_number> | |
<phone_number>111-111-1111</phone_number> | |
</xmlData> |
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
# class User < ActiveRecord::Base | |
# named_scope :active, :conditions => { :active => true } | |
# named_scope :with_status, lambda {|*statuses| {:conditions => ["users.status IN (?)", statuses]}} | |
# named_scope :joshes, :conditions => ["first_name LIKE ?", "%Josh%"] | |
# | |
# combined_scope :active_pending, lambda { active }, lambda { with_status("pending") } | |
# combined_scope :active_unimportant, lambda { active }, lambda { with_status("not_activated", "cancelled", "deleted") } | |
# # since they are real scopes, you can combine them again; in this case, with active_pending (created with combined_scope) and joshes (created with named_scope) | |
# combined_scope :active_pending_joshes, lambda { active_pending }, lambda { joshes } | |
# end |
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
form label { | |
display: inline-block; | |
line-height: 1.8; | |
vertical-align: top; | |
width: 11em; } | |
form label.required:after { | |
content: "*"; | |
color: red; } | |
form fieldset { | |
margin-bottom: 10px; |
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
bryce@bryce-imac ~> cat /mach_kernel | openssl sha1 | |
60b55b9c3daca7018db613e22563b2177906729b | |
bryce@bryce-imac ~> openssl sha1 /mach_kernel | |
SHA1(/mach_kernel)= 60b55b9c3daca7018db613e22563b2177906729b | |
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
$ cat init.rb | pygmentize -f html -l ruby | |
*** Error while highlighting: | |
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 16: ordinal not in range(128) | |
(file "/Library/Python/2.5/site-packages/Pygments-0.9-py2.5.egg/pygments/lexer.py", line 151, in get_tokens) | |
$ pygmentize init.rb | |
<works> |
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
# Turning a string into a class. | |
def class_from_string(class_string) | |
clazz = class_string.split("::").inject(Object) { |obj, const| obj.const_get(const) } | |
instance = clazz.new | |
end | |