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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
mongod --smallfiles --oplogSize 16 --nojournal |
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
__author__ = 'k0emt' | |
class Greeter: | |
def __init__(self): | |
self.message = 'Hello world!' | |
# print self.message | |
class GreeterOverloaded: | |
def __init__(self, greeting=None): | |
if greeting is None: |
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
# mongod.conf | |
# for documentation of all options, see: | |
# http://docs.mongodb.org/manual/reference/configuration-options/ | |
# Where and how to store data. | |
storage: | |
dbPath: "/var/lib/mongodb" | |
journal: | |
enabled: 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
from pymongo import MongoClient | |
import pymongo | |
import sys | |
# establish a connection to the database | |
connection = MongoClient("mongodb://localhost", safe=True) | |
# get a handle to the school database | |
db = connection.school | |
scores = db.scores |
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
#!/usr/local/bin/python | |
import sys | |
from pymongo import MongoClient | |
if len(sys.argv) < 3: | |
print 'usage is: ' + sys.argv[0] + ' databaseName collectionName' | |
sys.exit() | |
dbName = sys.argv[1] |
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 bottle | |
@bottle.route('/') | |
def home_page(): | |
return "Hello World\n" | |
@bottle.route('/testpage') | |
def test_page(): | |
return "this is a test page" |
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
config = { _id: "m101", members:[ | |
{ _id : 0, host : "localhost:27017"}, | |
{ _id : 1, host : "localhost:27018"}, | |
{ _id : 2, host : "localhost:27019"} ] | |
}; | |
rs.initiate(config); | |
rs.status(); |
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
public class EnumStringExample { | |
public static enum DAYS_OF_THE_WEEK { | |
MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY; | |
public String toString() { | |
String plainName = name().toString(); | |
String fancy = plainName.charAt(0) | |
+ plainName.substring(1).toLowerCase(); |
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
%for thing in things: | |
<li>{{thing}}</li> | |
%end |
OlderNewer