Skip to content

Instantly share code, notes, and snippets.

View garindra's full-sized avatar

Garindra Prahandono garindra

View GitHub Profile
@garindra
garindra / PyDOM_ex1.py
Created May 23, 2011 18:47
PyDOM API examples
from PyDOM import PyDOM
class ExampleViewComponent(PyDOM):
def draw(self):
self.div() #Result : '<div></div>'
class AnotherViewComponent(PyDOM):
def query_user():
(Users()
.where(username='garindrapp')
.get('short_bio', 'comment_count'))
def insert_user():
(Users().insert(
username='garindrapp',
short_bio = 'I am a CS student',
bio = 'Hi there, I live in the US -- specifically the Bay Area -- for almost 2 years, and been loving it by far.',
comment_count = 0))
class Users(RengoModel):
username = String(unique_key = True)
short_bio = String(cache = True)
bio = String(cache = False)
post_count = Integer(cache = True)
#Garindra Prahandono
#These are basic and most-used operations when I program.
##Super Simple If Boolean Statement
#Perl
if($awesome)
{
dance();
sleep();
@garindra
garindra / bencher.coffee
Created November 24, 2011 02:45
Simple benchmarker function
benchmark = (name, fn) ->
start = new Date().getTime()
fn()
delta = new Date().getTime() - start
console.log 'Benchmark "' + name + '" runs for ' + delta + ' ms.'
@garindra
garindra / .vimrc
Created January 22, 2012 05:01
My Vimrc
colorscheme desert
set number
set autoindent
set expandtab
syntax on
set shiftwidth=4
set tabstop=4
set smarttab
set ruler
import weblet.component
class UserNameComponent(weblet.component.Component):
def __init__(self):
self.user_id = 42
def fetch(self):
return [