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 main | |
import "fmt" | |
func main() { | |
// shoppingList is a map that has a map inside it | |
shoppingList := make(map[string]map[string]int) | |
// veggies key points to veggiesMap | |
veggiesMap := map[string]int{"onion": 2, "orka": 3} |
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 | |
class Hello(tornado.web.RequestHandler): | |
def get(self): | |
self.write("Hello, world") | |
class User(tornado.web.RequestHandler): | |
def get(self): |
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 | |
from datetime import datetime | |
import urlparse | |
from bson.json_util import dumps | |
import pymongo | |
from pymongo import Connection | |
class Home(tornado.web.RequestHandler): |
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
<html> | |
<title> | |
SQLite Example | |
</title> | |
<body> | |
<FORM ACTION="/create" METHOD=POST> | |
Name: <input type="text" name="name"> | |
Marks: <input type="text" name="marks"> |
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 main | |
import ( | |
"encoding/json" | |
"errors" | |
"fmt" | |
) | |
func deepCopyMap(src map[string]int, dst map[string]int) error { | |
if src == nil { |
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
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
import tornado | |
import tornado.ioloop | |
import tornado.web | |
import os, uuid | |
__UPLOADS__ = "uploads/" | |
class Userform(tornado.web.RequestHandler): | |
def get(self): | |
self.render("fileuploadform.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 whoosh,os | |
from whoosh import index | |
import whoosh.index | |
import whoosh.qparser | |
import tornado.ioloop | |
import tornado.web | |
class Search(object): | |
def __init__(self, indexdir, searchstr): | |
self.indexdir = indexdir |
NewerOlder