Skip to content

Instantly share code, notes, and snippets.

View possibilities's full-sized avatar

Mike Bannister possibilities

View GitHub Profile
@possibilities
possibilities / install.js
Created June 9, 2012 18:45
A dependency installer for possibilities/meteor-client-sessions
#!/bin/bash
#
# Until Meteor with something better,
# This script installs the required dependencies into meteor
# Written by @orefalo (Olivier Refalo)
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
CLIENT_SESSIONS="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
<head>
<title>Shuffle</title>
<link href='http://fonts.googleapis.com/css?family=PT+Serif' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="wrapper">
<div class="main">
{{#if front}}
Mycollection = new Meteor.Collection("mycollection");
Meteor.startup(function () {
Mycollection.insert({name: test1});
Mycollection.insert({name: test2});
var my_collection = Mycollection.find({}, {sort: {name: 1}});
console.log(my_collection.count());
my_collection.forEach(function debug() {console.log('test');});
});
var list;
function getList() {
if (!list)
...compute list
reutrn list
}
Template.post.postList = function () {
return list;
#foo {
width: 100px;
height: 100px;
border: 1px solid grey;
}
var psParts = rawPs.split(/\w+/);
console.error(psParts);
[ ' ', ' ', '' ]
[ ' ', ' ', '' ]
[ ' ', ' ', '' ]
[ '', ' ', '' ]
[ '', ' ', '' ]
[ '', ' ', '' ]
[ '', ' ', '' ]
var userCount = 0;
Meteor.publish(null, function() {
userCount++;
this.onStop(function() {
userCount--;
});
});
Meteor.methods({
{{#if widgetsLoading}}
<p>loading widgets...</p>
{{else}}
{{#ifAny widgets}}
{{#each widgets}}
<p>Name: {{name}}</p>
{{/each}}
{{/ifAny}}
{{/if}}
12:34 tmeasday: possibilities, homunq: autosubscribe does a little bit more than that. Maybe you don't care but it e.g. captures subscriptions and stops them etc. You might want to take a look at https://github.com/tmeasday/meteor-deps-extensions
12:35 possibilities: tmeasday: but seems to work well without doing any of that, is there overhead
12:35 tmeasday: well, homunq isn't here anymore, but hey..
12:35 tmeasday: possibilities: hard to say i guess
12:36 possibilities: tmeasday: so you have your own lighter weight solution eh?
12:36 tmeasday: yeah, a couple of things i reckon they should add to the deps module.. i've thought of a few more actually but haven't gotten around to implementing them
12:36 tmeasday: I got tired of writing the same code all the time
12:37 possibilities: good work. i've been overloading autosubscribe to do all this. ends up with a lot of bookkeeping code.
# Setup dir and repo
mkdir underscore-string
cd underscore-string
git init
# Make some files we'll need
touch README.md package.js smart.json
# Add the submodule and checkout the desired branch
git submodule add git://github.com/epeli/underscore.string.git lib/underscore.string