Skip to content

Instantly share code, notes, and snippets.

View possibilities's full-sized avatar

Mike Bannister possibilities

View GitHub Profile
AWSSum = {
load: function(module) {
var awssum = NodeModules.require('awssum');
return awssum.load(module);
},
loadSyncInterface: function(module, className) {
// Get a reference to the original interface
var interface = AWSSum.load(module)[className];
13:25 deberg: [17:21:57] hey, i just saw your question.
13:25 eiki: [17:22:17] great - any ideas?
13:25 deberg: [17:22:19] the thing to use is futures.
13:25 eiki: [17:22:36] what's the difference?
13:25 eiki: [17:22:45] and do you know of any sample code?
13:25 deberg: [17:23:02] yeah, one place to look is the meteor HTTP package.
13:25 deberg: [17:23:11] packages/http/httpcall_server.js:64
13:25 deberg: [17:23:39] this is the basic pattern for wrapping a node callback.
13:25 eiki: [17:24:09] https://github.com/meteor/meteor/blob/master/packages/http/httpcall_server.js#L65
13:25 deberg: [17:24:35] you want to declare a new future, call future.return() inside the callback, and block the outer caller (your method) with future.wait().
Package.describe({
summary: "Moment.js packaged for Meteor"
});
Package.on_use(function (api, where) {
where = where || ['client', 'server'];
api.add_files('lib/moment/moment.js', where);
});
# 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
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.
{{#if widgetsLoading}}
<p>loading widgets...</p>
{{else}}
{{#ifAny widgets}}
{{#each widgets}}
<p>Name: {{name}}</p>
{{/each}}
{{/ifAny}}
{{/if}}
var userCount = 0;
Meteor.publish(null, function() {
userCount++;
this.onStop(function() {
userCount--;
});
});
Meteor.methods({
var psParts = rawPs.split(/\w+/);
console.error(psParts);
[ ' ', ' ', '' ]
[ ' ', ' ', '' ]
[ ' ', ' ', '' ]
[ '', ' ', '' ]
[ '', ' ', '' ]
[ '', ' ', '' ]
[ '', ' ', '' ]
#foo {
width: 100px;
height: 100px;
border: 1px solid grey;
}