Skip to content

Instantly share code, notes, and snippets.

@dburles
dburles / Counter.py
Created December 22, 2011 01:26 — forked from keyo/Counter.py
Python useless counter class
"""
░░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░​░█
░▄▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░​░░█
█░▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒​▒▒▒█
█░▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀​▀▀▄▒█
░█░▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░​█░░█
░░█░░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀█​█░█
░░█░░░░██░░▀█▄▄▄█▄▄█▄████░​█
░░░█░░░░▀▀▄░█░░░█░█▀██████​░█
░░░░▀▄░░░░░▀▀▄▄▄█▄█▄█▄█▄▀░​░█
@dburles
dburles / evolution.rb
Created March 15, 2013 13:08
a little evolution experiment i made ages ago
# Plot random pixels.
require 'rubygame'
Width = 200
Height = 200
class Array
def rand
self[Kernel.rand(self.length)]
end
end
@dburles
dburles / gist:6321059
Last active December 21, 2015 14:39
Meteor route/template ideas #2
// for the sake of clarity
Blogs = new Meteor.Collection('blogs');
// Basic main app routes domain.com/*
// No first parameter name passed here, so assume the main routes
RouteController.add({
layout: 'layout',
map: [
{ name: 'home', root: true }, // could set 'root' to define the / route if we skipped 'path' for other routes
{ name: 'about' }, // we could assume path /about/ from name
Session.setDefault('forms', 1);
Template.main.helpers({
forms: function () {
return _.range(1, Session.get('forms') + 1);
}
});
Template.main.events({
'click .add': function(event, template) {
Factory = function() {
var factoryName;
var factories = {};
this.define = function(name, collection, attributes) {
factoryName = name;
factories[name] = {
name: name,
collection: collection,
attributes: attributes,
if (Meteor.isClient) {
Meteor.subscribeReactive = function(name) {
var keyValues = {};
var mapper = Reactive[name].mapper;
var relations = Reactive[name].relations;
if (! mapper.key)
mapper.key = '_id';
Deps.autorun(function() {
// pass through object containing
# Making everything reactive!
#### The goal: Display the 10 latest `Books` along with their respective `Authors`
# Example 1.
> Authors are *not* reactive
> The problem with this approach is that once a new book (with a new author) appears,
> the new author is not sent to the client
```javascript
if (Meteor.isClient) {
Meteor.subscribeReactive = function(name) {
// ...
};
}
Meteor.Collection.prototype.relations = function(relations) {
this._relations = relations;
};
@dburles
dburles / gist:9086392
Last active August 29, 2015 13:56 — forked from tmeasday/gist:9086145
var relations = {};
Meteor.Collection.prototype.relations = function(obj) {
relations[this._name] = obj;
};
if (Meteor.isClient) {
Meteor.subscribeReactive = function(name) {
Meteor.subscribe(name);
Deps.autorun(function() {