function Person(first, last) {
this.first = first;
this.last = last;
}
Person.prototype.greet = function () {
A few examples to peruse after reading Peter Bourgon's awesome tutorial, which walks you through the building of a backend service for a web app.
- another example - a simple web server and client
- writing web apps - go's official tutorial
- recap of request handling - overview of go's request routing and response handling mechanics
View live on RequireBin.
Finds PNG images in the source
folder, and saves corresponding thumbnails to the target
folder.
Use with gistup to create gists (and blocks) from the command line. The directory containing your gist files gets initialized as a git repo. See this tutorial for a quick overview.
For additional tips on generating block thumbnails, see this HOWTO.
SLEEP (Syncable Lightweight Event Emitting Persistence) is an emerging standard for distributed data sync using HTTP and JSON. A generalized version of CouchDB's much lauded built-in replication, SLEEP extends the REST architecture to define a way in which databases can offer syncable JSON APIs that foster open data innovation by allowing developers to replicate entire databases over the net.
SLEEP comes from the Apache CouchDB project which is now widely known for it's multi-master streaming HTTP + JSON replication. This is possible in part because of the CouchDB _changes feed, which is a particular API that lets you see if there have been any changes made to the database since last time you synchronized. CouchDB can efficiently implement the _changes feed because of one subtle difference between it and most other databases: it stores a history of all changes that happen to the database, including deletes.
If you synchronize data from a remote source and then the remote source deletes a bunch of data,
Drop in replace functions for setTimeout
and setInterval
that make use of requestAnimationFrame
.
See overview article and Paul Irish's earlier post.
Courtesty of Joe Lambert
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php
import SimpleHTTPServer | |
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def send_head(self): | |
"""Common code for GET and HEAD commands. | |
This sends the response code and MIME headers. | |
Return value is either a file object (which has to be copied | |
to the outputfile by the caller unless the command was HEAD, | |
and must be closed by the caller under all circumstances), or |
Run like so:
node gist-clone-all.js username
You'll want to replace "username" with your own username.
This script clones using the push URL, so you should probably be the owner of the gists. You could also use this to clone someone else's gists, but in that case you may wish to edit the code to use gist_pull_url
instead.