This file contains hidden or 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
Traceback (most recent call last): | |
File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 501, in __call__ | |
handler.get(*groups) | |
File "/base/data/home/apps/vlaahversus/1.333522180435916813/vv/template.py", line 29, in decorated | |
vars = original_method(self, *args, **kwargs) | |
File "/base/data/home/apps/vlaahversus/1.333522180435916813/vv/page.py", line 71, in get | |
colors = kuler.generate(len(set.families)) | |
File "/base/data/home/apps/vlaahversus/1.333522180435916813/vv/kuler.py", line 24, in generate | |
_append_queue(number - len(_queue)) | |
File "/base/data/home/apps/vlaahversus/1.333522180435916813/vv/kuler.py", line 14, in _append_queue |
This file contains hidden or 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
<? | |
/** | |
$r = new ResourceRoute('Person'); | |
$r->people_path() => array('controller'=>'people', 'action' => 'index') | |
$r->new_person_path() => array('controller'=>'people', 'action' => 'add') | |
$r->person_path(1) => array('controller'=>'people', 'action' => 'read', 'id' => 1) | |
$r->edit_person_path(1) => array('controller'=>'people', 'action' => 'edit', 'id' => '1') | |
$r->delete_person_path(1) => array('controller'=>'people', 'action' => 'edit', 'id' => '1') |
This file contains hidden or 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 PagesController extends AppController { | |
function index() { | |
$pages = DataObject::toCollection($this->paginate('Page'), 'PageObject'); | |
//$pages[0]->title; | |
//$pages[0]->body; | |
//$pages[0]->path(); |
This file contains hidden or 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 DataObject { | |
function __construct(object) {} | |
function __set() {} | |
function __get() {} | |
function __isset() {} | |
static function toInstance($data, $class) { | |
return new $class($data) | |
} | |
static function toCollection($data, $class) { |
This file contains hidden or 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
{{ 'Edit' | link_to_edit page }} | |
{{ 'Show me some love' | link_to_view page }} | |
{{ 'Delete them all' | link_to_delete page }} |
This file contains hidden or 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
[ /workspace/h2o ] >: ruby benchmark/parser.rb | |
/ | |
(.*?)(?: | |
\{% (.*?) | |
%\} | | |
\{\{ (.*?) | |
\}\} | | |
\{\* (.*?) | |
\*\} | (.*?) | |
)(?:\r?\n) |
This file contains hidden or 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 | |
/* | |
UPDATES | |
2008-08-10 Fixed CSS comment stripping regex to add PCRE_DOTALL (changed from '/\/\*.*\*\//U' to '/\/\*.*\*\//sU') | |
2008-08-18 Added lines instructing DOMDocument to attempt to normalize HTML before processing | |
2008-10-20 Fixed bug with bad variable name... Thanks Thomas! | |
2008-03-02 Added licensing terms under the MIT License; Only remove unprocessable HTML tags if they exist in the array | |
*/ |
This file contains hidden or 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
require 'json' | |
require 'pp' | |
require 'open-uri' | |
require 'money' | |
url = "http://www.google.com/base/feeds/snippets/-/products%7Cservices?bq=headphone&max-results=100&content=all&adjust=false&alt=json" | |
product = open(url) | |
This file contains hidden or 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
# Nested routes works on ruby 1.8.6, and failed on ruby 1.9 | |
# | |
# app/controllers/admin/dashboard_controller.rb | |
# app/controllers/admin/photos_controller.rb | |
# | |
map.namespace :admin, :name_prefix => '' do |admin| | |
admin.resource :dashboard | |
admin.resource :photos | |
end |
This file contains hidden or 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
chruby () { | |
v=`ruby -e "puts RUBY_VERSION.split('.')[0,2].join('.')"` | |
rubyexes=( erb gem irb rake rdoc ri ruby testrb) | |
for i in ${rubyexes[@]}; do | |
sudo unlink "/usr/bin/${i}" | |
if [ $v == "1.9" ];then | |
src="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/${i}" | |
else | |
src="/opt/local/bin/${i}1.9" |