This file contains 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; |
This file contains 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 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 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 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 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
<title>Laugh</title><?php | |
$file = "output.txt"; | |
$number = "a"; | |
$number2 = "z"; | |
$yes = array('file', 'number', 'number2'); | |
$file = fopen('/output.txt', 'w', 'a'); | |
fwrite($file, $yes); |
This file contains 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 help(): | |
print("HELP!!!") | |
def account_info(): | |
print("account infoz:!!!") |
This file contains 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 prompt(message, password=False): | |
""" | |
Prompt the user for information. | |
message - what you're prompting the user for. | |
password - whether you want a password (invokes getpass instead of vanilla raw_input()). | |
returns the text returned by the user. | |
""" | |
# We don't want a password. |
This file contains 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 twitter import user, tweet | |
Kye = twitter.userbase.new("KyeRussell", "Kye Russell") | |
while True: | |
if Kye.is_tweeting = True: | |
Kye.tweeting_about = 'Apple' |
This file contains 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 twitter import user | |
UncleMark = twitter.user('Markedw', 'Mark Edwards') # instnatise new Twitter.User object. | |
tweet_list = UncleMark.stream() # Write tweet list to variable | |
for tweet in tweet_list: # cycle through tweet list | |
if tweet.location == 'Bunbury': # if tweet is in bunbury | |
if 'football' not in tweet.text: # if tweet doesn't contain 'football' str. | |
tweet.subject = "Bogans" # tweet subject is 'bogans'. | |
else: # tweet contains 'football'. |
OlderNewer