Skip to content

Instantly share code, notes, and snippets.

@ddollar
ddollar / test.pl
Created July 23, 2008 15:07 — forked from maio/test.pl
use strict;
print "Hello World!\n";
@monde
monde / railsvim.sh
Created July 23, 2008 15:24
launch gvim and autotest in an gnome terminal side by side
#!/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 \
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());
<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>
<xmlData>
<ringtone_id>4</ringtone_id>
<sender_number>000-000-000</sender_number>
<phone_number>111-111-1111</phone_number>
</xmlData>
# 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
@geoffgarside
geoffgarside / test.css
Created July 23, 2008 15:59
Trying to get a columnar list with CSS
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;
bryce@bryce-imac ~> cat /mach_kernel | openssl sha1
60b55b9c3daca7018db613e22563b2177906729b
bryce@bryce-imac ~> openssl sha1 /mach_kernel
SHA1(/mach_kernel)= 60b55b9c3daca7018db613e22563b2177906729b
$ 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>
@jugglebird
jugglebird / gist:1807
Created July 23, 2008 16:22
Turning a string into a class
# 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