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 sys | |
+import pymongo | |
+import json | |
+ | |
+import jinja2 | |
+import flask | |
+ | |
+ | |
+env = jinja2.Environment(loader=jinja2.FileSystemLoader("templates")) | |
+app = flask.Flask(__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
// simple matching | |
var m1 = db.runCommand( | |
{ aggregate : "article", pipeline : [ | |
{ $match : { author : "dave" } } | |
]}); |
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
include MongodbLogger:: Base |
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
collection.find({:runtime => {'$gt' => 1000}}) |
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
Product collection | |
{ | |
_id : ObjectId | |
name : "myproductname" | |
attributes | |
{ | |
color : | |
part_count | |
age : |
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
-bash: run: command not found | |
$:checkin fk$ run (/"checkin.js") | |
-bash: syntax error near unexpected token `/"checkin.js"' | |
$:checkin fk$ load (/"checkin.js") | |
-bash: syntax error near unexpected token `/"checkin.js"' |
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
$ meteor | |
[[[[[ ~/Desktop/checkin ]]]]] | |
Running on: http://localhost:3000/ | |
Errors prevented startup: | |
Exception while bundling application: | |
Error: Couldn't parse .. um .. some HTML file, on some line. sorry | |
at Object._scanChunk (/usr/local/meteor/packages/templating/html_scanner.js:83:13) | |
at Object.scan (/usr/local/meteor/packages/templating/html_scanner.js:7:31) | |
at /usr/local/meteor/packages/templating/package.js:46:32 |
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 worker(): | |
while True: | |
time.sleep(1) | |
while True: | |
msg = mongo_db.sendq.find_and_modify(remove=True) | |
if (msg == None): break | |
sys.stderr.write("send %s %s\n" % (msg['To'], msg['Body'])) | |
message = twilio_client.sms.messages.create(to=msg['To'], | |
from_=twilio_fromnum, | |
body=msg['Body']) |
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 tornado.web, tornado.ioloop | |
import motor | |
class NewMessageHandler(tornado.web.RequestHandler): | |
def get(self): | |
"""Show a 'compose message' form""" | |
self.write(''' | |
<form method="post"> | |
<input type="text" name="msg"> | |
<input type="submit"> |
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
Benchmark: timing 10 iterations of datetime, raw, tiny... | |
datetime: 428 wallclock secs (426.24 usr + 1.22 sys = 427.46 CPU) @ 0.02/s (n=10) | |
raw: 44 wallclock secs (42.58 usr + 0.52 sys = 43.10 CPU) @ 0.23/s (n=10) | |
tiny: 66 wallclock secs (64.68 usr + 0.99 sys = 65.67 CPU) @ 0.15/s (n=10) |
OlderNewer