Skip to content

Instantly share code, notes, and snippets.

View sunzhongwei's full-sized avatar
👋

Zhongwei Sun sunzhongwei

👋
View GitHub Profile
@mayflaver
mayflaver / gist:7884973
Created December 10, 2013 02:42
tornado coroutine return
import tornado.ioloop
import tornado.web
import tornado.gen
import tornado.httpclient
from tornado.platform.caresresolver import CaresResolver
import time
@tornado.gen.coroutine
def test():
client = tornado.httpclient.AsyncHTTPClient()
@mattetti
mattetti / gist:3798173
Last active April 16, 2023 03:09
async fetching of urls using goroutines and channels
package main
import (
"fmt"
"net/http"
"time"
)
var urls = []string{
"https://splice.com/",
@ThomasBurleson
ThomasBurleson / gist:2432692
Last active March 20, 2017 10:07
AngularJS - RESTful CRUD with Services and $http
//
// CRUD API for RESTful services with URLs similar 'http://services.mysite.com/classes/Book'.
//
// e.g. parse.get(
// "Book",
// 123,
// function(response){ console.log(response.toString());}
// );
//
services.factory('parse', function($rootScope, $http) {
@io41
io41 / paginated_collection.js
Created February 22, 2011 10:10 — forked from zerowidth/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {