Skip to content

Instantly share code, notes, and snippets.

@Quebecisnice
Quebecisnice / house_dataset
Created January 30, 2014 15:54
Codalab CLI Tutorial Example Dataset
0 | price:.23 sqft:.25 age:.05 2006
1 2 'second_house | price:.18 sqft:.15 age:.35 1976
0 1 0.5 'third_house | price:.53 sqft:.32 age:.87 1924

From Meteor's documentation:

In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node. We find the linear execution model a better fit for the typical server code in a Meteor application.

This guide serves as a mini-tour of tools, trix and patterns that can be used to run async code in Meteor.

Basic async

Sometimes we need to run async code in Meteor.methods. For this we create a Future to block until the async code has finished. This pattern can be seen all over Meteor's own codebase:

@Quebecisnice
Quebecisnice / manifest.json
Created April 7, 2011 23:44
Github for Google Chrome Browser
{
"name": "Github",
"description": "Github",
"version": "1.0",
"icons": {
"128": "128.png"
},
"app": {
"urls": [
"https://github.com/"
@Quebecisnice
Quebecisnice / about.md
Created August 9, 2011 15:52 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@Quebecisnice
Quebecisnice / hack.sh
Created April 2, 2012 14:08 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@Quebecisnice
Quebecisnice / User.rb
Created April 3, 2012 00:57
Rails OmniAuth snippet
def self.create_from_hash(registration_hash)
unless registration_hash || resigration_hash.empty?
return nil
end
provider = registration_hash[:provider]
info = registration_hash[:info]
user = User.new
@Quebecisnice
Quebecisnice / 24.cpp
Created April 9, 2012 17:57 — forked from fedelebron/24.cpp
24 solver, with no access to binary_function or function<...>, thanks to an outdated compiler. :) Still using C++11 though.
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define forn(i, n) for(int i = 0; i < (n); ++i)
#define FUNC(i) (*(dispatch[funcs[i]]))
#define MFUNC(o) ([](double a, double b) { return a o b; })
using namespace std;
@Quebecisnice
Quebecisnice / Gemfile
Created September 13, 2012 18:43
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin