Skip to content

Instantly share code, notes, and snippets.

Router.static = function(options) {
options = options || {};
if (! options.path)
throw new Meteor.Error("Router.static: options.path is required");
return {
where: 'server',
path: options.path,
action: function() {
Template.foo.events({
'keyup .bar': _.debounce(function(event) {
// ...
}, 300)
});
@dburles
dburles / gist:7e6f8a1ae2c89b7f005d
Created December 2, 2014 05:16
default Meteor project using template session
if (Meteor.isClient) {
Template.hello.created = function() {
this.setDefault('counter', 0);
};
Template.hello.helpers({
counter: function() {
var template = Template.instance();
return template.get('counter');
}
Blaze.TemplateInstance.prototype.setDefault = function(key, value) {
return Session.setDefault(this.view.name + '.' + key, value);
};
Blaze.TemplateInstance.prototype.set = function(key, value) {
return Session.set(this.view.name + '.' + key, value);
};
Blaze.TemplateInstance.prototype.get = function(key) {
return Session.get(this.view.name + '.' + key);
var timeout;
var batch = [];
batcher = function(attributes) {
batch.push(attributes);
if (! timeout) {
// send whatever we have in the queue after 5 seconds
timeout = setTimeout(function() {
console.log('sending a batch of ' + batch.length + '...');
Template.foo.helpers({
stepsWithIndex: function() {
return _.map(this.steps, function(value, index) {
return {
index: index,
value: value
};
});
}
});
http://localhost:3000/enroll-account/vHHzHoBaN5Hc65mye
@dburles
dburles / Counter.py
Created December 22, 2011 01:26 — forked from keyo/Counter.py
Python useless counter class
"""
░░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░​░█
░▄▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░​░░█
█░▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒​▒▒▒█
█░▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀​▀▀▄▒█
░█░▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░​█░░█
░░█░░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀█​█░█
░░█░░░░██░░▀█▄▄▄█▄▄█▄████░​█
░░░█░░░░▀▀▄░█░░░█░█▀██████​░█
░░░░▀▄░░░░░▀▀▄▄▄█▄█▄█▄█▄▀░​░█
if (Meteor.isClient) {
StaticPosts = new Mongo.Collection(null);
fetchAndInsert('test', StaticPosts, (error, response) => {
// ...
});
}
if (Meteor.isServer) {
Meteor.methods({
{
"color_scheme": "Packages/User/SublimeLinter/PlainText (SL).tmTheme",
"draw_white_space": "all",
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
".meteor"