Skip to content

Instantly share code, notes, and snippets.

View speedmax's full-sized avatar

Taylor luk speedmax

View GitHub Profile
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
<?
/**
$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')
<?
class PagesController extends AppController {
function index() {
$pages = DataObject::toCollection($this->paginate('Page'), 'PageObject');
//$pages[0]->title;
//$pages[0]->body;
//$pages[0]->path();
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) {
{{ 'Edit' | link_to_edit page }}
{{ 'Show me some love' | link_to_view page }}
{{ 'Delete them all' | link_to_delete page }}
[ /workspace/h2o ] >: ruby benchmark/parser.rb
/
(.*?)(?:
\{% (.*?)
%\} |
\{\{ (.*?)
\}\} |
\{\* (.*?)
\*\} | (.*?)
)(?:\r?\n)
<?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
*/
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)
# 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
@speedmax
speedmax / switch between apple's ruby 1.8.6 and macport's 1.9.1 .sh
Created April 30, 2009 00:46
switch between apple's ruby 1.8.6 and macports 1.9.1
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"