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
# Null Object Pattern | |
class AbstractLogging: | |
def Log(self, msg): | |
pass | |
from time import asctime, localtime | |
class RealLogging(AbstractLogging): | |
def Log(self, msg): | |
print 'Logged at', asctime(localtime()), msg |
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
#include <malloc.h> | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
#include <signal.h> | |
#include <sched.h> | |
#include <stdio.h> | |
#include <fcntl.h> | |
// 64kB stack | |
#define STACK 1024*64 |
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
package API::ReviewBoard; | |
use strict; | |
use warnings; | |
use LWP; | |
use HTTP::Cookies; | |
use Carp qw(croak); | |
use Params::Validate qw[validate OBJECT SCALAR ARRAYREF]; | |
use Data::Dumper; | |
use vars qw( @EXPORT @ISA ); |
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 pymongo | |
from pymongo import Connection | |
conn = Connection() | |
db = conn['myDB'] | |
collection = db['language'] | |
#Creating a collection | |
db.language.insert({"id": "1", "name": "C", "grade":"Boring"}) | |
db.language.insert({"id": "2", "name":"Python", "grade":"Interesting"}) |
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
## Torando Web Server hello World | |
import tornado.ioloop | |
import tornado.web | |
class Hello(tornado.web.RequestHandler): | |
def get(self): | |
self.write("Hello, world") | |
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
mport tornado.ioloop | |
import tornado.web | |
class Hello(tornado.web.RequestHandler): | |
def get(self): | |
self.write("Hello, world") | |
class User(tornado.web.RequestHandler): | |
def get(self, username,designation): | |
self.get_arguments(username, strip=True) |
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
<html> | |
<body> | |
<FORM ACTION="/article" METHOD=POST> | |
<input type="submit" value="Home"> | |
</FORM> | |
</body> | |
</html> |
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 tornado.ioloop | |
import tornado.web | |
import time | |
## MongoDB | |
import pymongo | |
from pymongo import Connection | |
conn = Connection() | |
db=conn['library'] | |
collection = db['articles'] |
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
<html> | |
<title> | |
Articles | |
</title> | |
<body> | |
<h1>Articles page</h1> | |
<p><img src="images/images.jpg"/></p> | |
</body> | |
</html> |
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
<html> | |
<head> | |
<title>{{ title }}</title> | |
</head> | |
<body> | |
<table border="1"> | |
{% for key,value in dict.items() %} | |
<tr> | |
<td>{{ key }}</td> | |
<td>{{ value }}</td> |
OlderNewer