./test.py ./static/index.html ./static/client.js
python ./test.py
(def t | |
"trie containing the 100,000 most common english words" | |
(with-open [r (clojure.java.io/reader "/tmp/words-100000")] | |
(reduce #(assoc-in %1 %2 (sorted-map \0 nil)) (sorted-map) (line-seq r)))) | |
(defn search [p m] | |
"return a sorted sequence of all words in the trie m that start with the given prefix p" | |
(let [n (get-in m p) | |
next (mapcat #(search (str p (key %)) m) (dissoc n \0))] | |
(if (contains? n \0) (cons p next) next))) |
import nltk | |
import requests | |
FREEBASE_API_KEY = '' | |
class FindNames(object): | |
def __init__(self, text, freebase_api_key): | |
self.text = text | |
self.key = freebase_api_key |
# set up flags for Numpy C extentions compiling | |
export CFLAGS="-arch i386 -arch x86_64" | |
export FFLAGS="-m32 -m64" | |
export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64" | |
export CC=gcc-4.2 | |
export CXX="g++ -arch i386 -arch x86_64" | |
pip install numpy | |
# success! |
# -*- coding: utf-8 | |
from time import sleep, time | |
from tornado.httpserver import HTTPServer | |
from tornado.ioloop import IOLoop | |
from tornado.web import Application, asynchronous, RequestHandler | |
from multiprocessing.pool import ThreadPool | |
from tornado import gen | |
pool = ThreadPool(10) |
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
# encoding: UTF-8 | |
require 'optparse' | |
require 'net/http' | |
require 'json' | |
def parse_options(argv) | |
opts = {} | |
@parser = OptionParser.new do |o| |
It's a common pattern in React to wrap a component in an abstraction. The outer component exposes a simple property to do something that might have more complex implementation details.
We used to have a helper function called transferPropsTo
. We no longer support this method. Instead you're expected to use a generic object helper to merge props.
render() {
return Component(Object.assign({}, this.props, { more: 'values' }));
''' | |
Copyright (c) <2012> Tarek Galal <[email protected]> | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this | |
software and associated documentation files (the "Software"), to deal in the Software | |
without restriction, including without limitation the rights to use, copy, modify, | |
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to the following | |
conditions: |
In this tutorial, we'll take an in-depth view of what's happening when you execute a simple Onyx program. All of the code can be found in the Onyx Starter repository if you'd like to follow along. The code uses the development environment with HornetQ and ZooKeeper running in memory, so you don't need additional dependencies to run the example for yourself on your machine.
At the core of the program is the workflow - the flow of data that we ingest, apply transformations to, and send to an output for storage. In this program, we're going to ingest some sentences from an input source, split the sentence into individual words, play with capitalization, and add a suffix. Finally, we'll send the transformed data to an output source.
Let's examine the workflow pictorially: