Skip to content

Instantly share code, notes, and snippets.

View janroesner's full-sized avatar

Jan Roesner janroesner

View GitHub Profile
### Keybase proof
I hereby claim:
* I am janroesner on github.
* I am janroesner_us (https://keybase.io/janroesner_us) on keybase.
* I have a public key ASASIuAZFPXEqbgN4SG7fYTnYcS4OxyEQBerlxH1Fw0KTQo
To claim this, I am signing this object:
// Number of objects in the JSON (reduce it to 20 ... no much difference!!!)
const NUMBER_OF_ENTRIES = 5800;
const numbers = [...Array(NUMBER_OF_ENTRIES).keys()];
// Generating an arbitrary Array of objects w/o additional IDs (the "normal" version)
const slowJSON = numbers.map(el => {
return { id: el, value: String(Math.ceil(Math.random() * 1000000)) };
});
// Generating an arbitrary Object using additional ID's (a version optimized for the search cases we will have in the frontend)

Keybase proof

I hereby claim:

  • I am janroesner on github.
  • I am janroesner (https://keybase.io/janroesner) on keybase.
  • I have a public key ASBDym6P6EoxJCgD7dOw1v06YTkJ8uaDqDo4F6m3rhIDZwo

To claim this, I am signing this object:

@janroesner
janroesner / collection_view.coffee
Created November 25, 2012 20:28
Fetching or not
initialize: (barId, foozId)->
@collection = Global().cache.get(FoosCollection, barId, foozId)
if @collection.isEmpty()
@collection.fetch()
else
@collection.trigger 'reset'
@janroesner
janroesner / collection_view.coffee
Created November 25, 2012 19:07
Make use of CollectionCache
@collection = Global().cache.get(FoosCollection, barId, foozId)
@janroesner
janroesner / collection_cache.coffee
Created November 25, 2012 18:56
Backbone Collection Cache
define [], ()->
CollectionCache = ->
cache = {}
# returns true if the cache has the given key already
cacheHasKey = (key)->
cache.hasOwnProperty key
# generates a unique key from given arguments
@janroesner
janroesner / test.rb
Created November 25, 2012 12:49
Test Gist for tumblr
class FooBar
def foo
1.upto(99) do |n|
puts n
end
end
end