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
| from PyDOM import PyDOM | |
| class ExampleViewComponent(PyDOM): | |
| def draw(self): | |
| self.div() #Result : '<div></div>' | |
| class AnotherViewComponent(PyDOM): |
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
| def query_user(): | |
| (Users() | |
| .where(username='garindrapp') | |
| .get('short_bio', 'comment_count')) |
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
| 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)) |
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 Users(RengoModel): | |
| username = String(unique_key = True) | |
| short_bio = String(cache = True) | |
| bio = String(cache = False) | |
| post_count = Integer(cache = True) |
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
| #Garindra Prahandono | |
| #These are basic and most-used operations when I program. | |
| ##Super Simple If Boolean Statement | |
| #Perl | |
| if($awesome) | |
| { | |
| dance(); | |
| sleep(); |
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
| benchmark = (name, fn) -> | |
| start = new Date().getTime() | |
| fn() | |
| delta = new Date().getTime() - start | |
| console.log 'Benchmark "' + name + '" runs for ' + delta + ' ms.' |
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
| colorscheme desert | |
| set number | |
| set autoindent | |
| set expandtab | |
| syntax on | |
| set shiftwidth=4 | |
| set tabstop=4 | |
| set smarttab | |
| set ruler |
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
| import weblet.component | |
| class UserNameComponent(weblet.component.Component): | |
| def __init__(self): | |
| self.user_id = 42 | |
| def fetch(self): | |
| return [ |