Skip to content

Instantly share code, notes, and snippets.

@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) {
@eculver
eculver / Projects with beautiful websites
Created February 10, 2011 18:54
Projects with beautiful websites
Vows: http://vowsjs.org/
SASS: http://sass-lang.com/
SSHGuard (pretty decent layout): http://www.sshguard.net/
Django Haystack: http://haystacksearch.org/
twelvesouth (products not project, but still): http://www.twelvesouth.com/
java.lang.Thread.State: RUNNABLE
at java.util.Arrays.copyOf(Arrays.java:2734)
at java.util.PriorityQueue.toArray(PriorityQueue.java:357)
at java.util.concurrent.DelayQueue.toArray(DelayQueue.java:360)
at java.util.concurrent.DelayQueue.iterator(DelayQueue.java:439)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue$1.<init>(ScheduledThreadPoolExecutor.java:644)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.iterator(ScheduledThreadPoolExecutor.java:643)
at java.util.concurrent.ThreadPoolExecutor.drainQueue(ThreadPoolExecutor.java:1198)
at java.util.concurrent.ThreadPoolExecutor.shutdownNow(ThreadPoolExecutor.java:1175)
at java.util.concurrent.ScheduledThreadPoolExecutor.shutdownNow(ScheduledThreadPoolExecutor.java:580)
Client: Mac Pro OS X, 2.8Ghz Quad-Core Intel Xeon, 8 GB 1066 Mhz DDR3
Server: lighttpd/1.4.26 -> Ubuntu, 2.8Ghz Duo-Core Intel Xeon, 6 1066 Mhz DDR3
50 threads that does 50 requests, done 50 times.
Async Http Client 1.5.0 (Config http://is.gd/7rGGWU)
=============================================================
BenchmarkResult{requestsPerSecond=1578.96, threads=50, batches=50, targetRequests=125000, successfulRequests=125000, failedRequests=0, averageRequestTime=0.63ms, averageBatchTime=1583.32ms, totalBenchmarkTime=79166.03ms}
(last 5 runs)
// Service Definition
ServiceDefinition serviceDefinition = injector.getInstance(ServiceDefinition.class);
serviceDefinition
.producing(ServiceDefinition.Media.JSON)
.producing(ServiceDefinition.Media.XML)
.consuming(ServiceDefinition.Media.JSON)
.consuming(ServiceDefinition.Media.XML)
.withHandler(new ServiceHandler(ServiceDefinition.HttpMethod.PUT, "id", "createAddressBook"))
.withHandler(new ServiceHandler(ServiceDefinition.HttpMethod.GET, "id", "getAddressBook"))
@zerowidth
zerowidth / paginated_collection.js
Created November 18, 2010 22:04
first whack at pagination with backbone.js
// includes bindings for fetching/fetched
PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
this.page = 1;
},
fetch: function(options) {
options || (options = {});
this.trigger("fetching");
@rstacruz
rstacruz / 1.haml
Created October 22, 2010 13:52
3.rb
-# Super cheapo minification!
-# Here's how it works:
-#
-# * The HAML below points to the minified version on production,
-# or prints <script> tags if not.
-#
-# * We define the route to /js/script.js ourselves.
-#
-# * Some silly caching will ensure that the minification only happens once.
@bmarini
bmarini / redis_store.rb
Created July 21, 2010 15:11
ActiveSupport::Cache::RedisStore, a drop in replacement for MemCacheStore
require 'redis'
# This is a direct port of ActiveSupport::Cache::MemCacheStore
# Drop this file in lib/active_support/cache/redis_store and in your env files
# add:
#
# config.cache_store = :redis_store
module ActiveSupport
module Cache