Skip to content

Instantly share code, notes, and snippets.

// Map function
function(doc) {
// Split on unicode whitespace or punctuation.
// TODO: Is there a unicode-aware \W that I could use?
// log('mapping ' + doc);
var tokens = doc.text.split(/[\s\,\.\;\:\'\"\(\)\!\?]+/);
var words = {};
for each (var token in tokens) {
token = token.toLowerCase();
if (token != "") {
diff --git a/gift-4-u.txt b/gift-4-u.txt
index ca36d0a..986e9c4 100644
--- a/gift-4-u.txt
+++ b/gift-4-u.txt
@@ -1,2 +1,2 @@
-I am sending this because you *really* love patch files. :)
+Ben Spaulding is my hero (and Daniel really loves patch files).
# You'll need to require these if you
# want to develop while running with ruby.
# The config/rackup.ru requires these as well
# for it's own reasons.
#
# $ ruby sinatra-test.rb
#
require 'rubygems'
require 'sinatra'
require 'json'
from itty import get, post, run_itty
try:
import json
except ImportError:
import simplejson as json
@get('/')
def index():
return json.dumps({'message' : 'Hello, World!'})
from itty import *
@get('/')
def index(foo):
return 'Hello World!'
run_itty('appengine')
# yes_note.py for PyS60 - Matt Croydon - License: GPL
# Requires json.py from http://www.mobilepythonbook.org/
import urllib, json, appuifw
BASE_URL = 'http://api.yes.com/1/'
station = appuifw.query(u'Enter a station', 'text')
station = station.upper()
NOW_URL = BASE_URL + 'station?name=%s' % station
data = json.read(urllib.urlopen(NOW_URL).read())
'-._ ___.....___
`.__ ,-' ,-.`-,
`''-------' ( p ) `._ FACETIME IS
`-' \ NOT SICP!
\
\
/---..,--'
................._ \--...--,
`-.._ _.-'
`'-----''
diff --git a/tests/core/fixtures/initial_data.json b/tests/core/fixtures/initial_data.json
index 199988c..2cc5b6f 100644
--- a/tests/core/fixtures/initial_data.json
+++ b/tests/core/fixtures/initial_data.json
@@ -14,7 +14,7 @@
"fields": {
"user": "daniel2",
"foo": "bar",
- "pub_date": "2009-03-17 06:00:00"
+ "pub_date": "2009-03-17 07:00:00"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from postneo.category.models import Category
from postneo.blog.models import Entry
from lxml import etree
tree = etree.parse(open('../../../wordpress-20090526.xml', 'r'))
def field_data(tree, name):
"""Return the text for a field element with a particular name"""
return tree.find("field[@name='%s']" % name).text