Skip to content

Instantly share code, notes, and snippets.

View garindra's full-sized avatar

Garindra Prahandono garindra

View GitHub Profile
import weblet.component
class UserNameComponent(weblet.component.Component):
def __init__(self):
self.user_id = 42
def fetch(self):
return [
@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
@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 Prahandono
#These are basic and most-used operations when I program.
##Super Simple If Boolean Statement
#Perl
if($awesome)
{
dance();
sleep();
class Users(RengoModel):
username = String(unique_key = True)
short_bio = String(cache = True)
bio = String(cache = False)
post_count = Integer(cache = True)
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))
def query_user():
(Users()
.where(username='garindrapp')
.get('short_bio', 'comment_count'))
@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):