Skip to content

Instantly share code, notes, and snippets.

View @ SimpleDB.md

SimpleDB - Like Indexed DB, but Simple

A simple asynchronous data store.

STATUS: This is a thought experiment, not a serious proposal. Would basic async storage like this be useful? With this plus some locking primitive, could you build Indexed DB?

Like Indexed DB:

  • rich value types - store anything you can structured clone
  • rich key types - Number, String, Date, Array (of other key types)
@jonathanKingston
jonathanKingston / gist:7d855d1657fe260b1358
Last active Aug 29, 2015
Brainstorming web safety slogans
View gist:7d855d1657fe260b1358
Spare me from spies
Don't wreak the web
The war on error
Plug your leaks
infosec has a posse
paranoia is perfection
View routerissue
BrittoRouter = Backbone.Router.extend({
routes: {
":slug/": "findPost",
},
findPost: function(slug) {
alert(slug);
}
});
Router = BrittoRouter();
View routerissue2
BrittoRouter = Backbone.Router.extend({
routes: {
":slug": "findPost",
":slug/": "findPost"
},
findPost: function(slug) {
console.log(Posts.find());
console.log(Posts.findOne());
post = Posts.findOne({slug: 'out'});
Session.set('new_slug', slug);
@jonathanKingston
jonathanKingston / gist:2501225
Created Apr 26, 2012
rendering of diff templates
View gist:2501225
Handlebars.registerHelper('content', function(something) {
if(something) {
Meteor.ui.chunk(function() {Template.hello({first: "Alyssa", last: "Hacker"});});
} else {
Meteor.ui.chunk(function() {Template.something_else({first: "silly", last: "bobby"});});
}
});
View gist:2552266
function post(args) {
//DO post here
}
function comment() {
//Do comment here
}
function checkUser(args) {
//Check args here to make sue is user
View gist:2558822
Meteor.setInterval(function() {
var allTheThings = Things.find({});
//Near will contain all the object _id's and this will be an array of all other objects nearby.
near = {}
allTheThings.forEach(function (thing) {
if (thing != undefined) {
near[thing._id] = [];
allTheThings.forEach(function (thing2) {
if(thing2.x >= thing.x-5 && thing2.x <= thing.x+5) {
if(thing2.y >= thing.y-5 && thing2.y <= thing.y+5) {
@jonathanKingston
jonathanKingston / gist:2580242
Created May 2, 2012
server side tags to client side
View gist:2580242
tags = Tags.find();
_.each(function(tag){
Handlebars.something[tag.key] = tag.value;
})
View gist:2668583
Meteor.methods({
'sabotage'
});
Meteor.filters({
'checkIsABeastieBoy'
});
function checkIsABeastieBoy(args) {
View gist:2668674
//three code here renderer...
document.getElementById('bg').appendChild(renderer.domElement);
Meteor.deps.Context.current.invalidate(); //this clears the above