This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
░░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░░█ | |
░▄▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░░░█ | |
█░▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒▒▒▒█ | |
█░▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀▀▀▄▒█ | |
░█░▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░█░░█ | |
░░█░░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀██░█ | |
░░█░░░░██░░▀█▄▄▄█▄▄█▄████░█ | |
░░░█░░░░▀▀▄░█░░░█░█▀██████░█ | |
░░░░▀▄░░░░░▀▀▄▄▄█▄█▄█▄█▄▀░░█ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plot random pixels. | |
require 'rubygame' | |
Width = 200 | |
Height = 200 | |
class Array | |
def rand | |
self[Kernel.rand(self.length)] | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type="text/css"> | |
#ffs { | |
top: 0; | |
left: 0; | |
position: fixed; | |
padding: 5px; | |
background: #DDD; | |
} | |
#ffs input { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Session.setDefault('forms', 1); | |
Template.main.helpers({ | |
forms: function () { | |
return _.range(1, Session.get('forms') + 1); | |
} | |
}); | |
Template.main.events({ | |
'click .add': function(event, template) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Factory = function() { | |
var factoryName; | |
var factories = {}; | |
this.define = function(name, collection, attributes) { | |
factoryName = name; | |
factories[name] = { | |
name: name, | |
collection: collection, | |
attributes: attributes, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Meteor.isClient) { | |
Meteor.subscribeReactive = function(name) { | |
// ... | |
}; | |
} | |
Meteor.Collection.prototype.relations = function(relations) { | |
this._relations = relations; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
OlderNewer