Skip to content

Instantly share code, notes, and snippets.

BrittoRouter = Backbone.Router.extend({
routes: {
":slug/": "findPost",
},
findPost: function(slug) {
alert(slug);
}
});
Router = BrittoRouter();
@jonathanKingston
jonathanKingston / routerissue2
Created April 22, 2012 00:03
sample route issue
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 April 26, 2012 17:42
rendering of diff templates
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"});});
}
});
function post(args) {
//DO post here
}
function comment() {
//Do comment here
}
function checkUser(args) {
//Check args here to make sue is user
@jonathanKingston
jonathanKingston / gist:2558822
Created April 30, 2012 14:33
find nearbythings
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 20:36
server side tags to client side
tags = Tags.find();
_.each(function(tag){
Handlebars.something[tag.key] = tag.value;
})
@jonathanKingston
jonathanKingston / gist:2668583
Created May 12, 2012 19:55
Filters psudo code
Meteor.methods({
'sabotage'
});
Meteor.filters({
'checkIsABeastieBoy'
});
function checkIsABeastieBoy(args) {
//three code here renderer...
document.getElementById('bg').appendChild(renderer.domElement);
Meteor.deps.Context.current.invalidate(); //this clears the above

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 August 29, 2015 14:26
Brainstorming web safety slogans
Spare me from spies
Don't wreak the web
The war on error
Plug your leaks
infosec has a posse
paranoia is perfection