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 HerpDerp (object): | |
def __init__(self, foo, bar, baz): | |
self.foo = foo | |
self.barbaz = bar + " " + baz | |
self.mylist = ['hey', 'awesome' 12] | |
self.dict = {'green eggs': 'ham', | |
'sam': 'i am'} | |
def foo_bar_baz(self): | |
return self.foo + " " + self.barbaz |
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 pickle | |
import random | |
# Opening a file handler. | |
fh = open('obj.txt', 'w') | |
# Create a new object. | |
eggs = {'green eggs': 'ham', | |
'sam' : 'i am'} |
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 IRCChannel (object): | |
""" Simulate an IRC channel environment """ | |
def __init__ (self, chan_name, topic): | |
self.chan_name = chan_name # Channel name | |
self.topic = topic # Channel topic | |
self.users = [] # User list | |
# Prints joining messages | |
self.system_msg("You have joined " + self.chan_name) | |
self.system_msg("Topic for " + self.chan_name + " is: " + self.topic) | |
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 main(): | |
class Avatar (object): | |
def __init__(self, name, category): | |
self.name = name | |
self.cat = category | |
self.health = 100 | |
self.magic = 25 | |
def stats (self): | |
print("---[ Avatar Stats ]---") | |
print("Name:\t\t", self.name) |
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 | |
/* my model */ | |
class News_model extends Model { | |
function get_recent_stories() { | |
$query = $this->db->get('news_entries'); | |
if ($query->num_rows() > 0) { | |
foreach ($query->result() as $row) { | |
$data[] = $row; | |
} | |
return $row; |
NewerOlder