Skip to content

Instantly share code, notes, and snippets.

View guilhermedecampo's full-sized avatar
👩‍🚀
Lets go 🚀

Guilherme Decampo guilhermedecampo

👩‍🚀
Lets go 🚀
View GitHub Profile

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

function agg_session_count(){
db.logs.mapReduce(
function(){
var local_zone = new Date().getTimezoneOffset()
var br_zone = 3*60;
var date_br = parseInt(this.when)+(br_zone-local_zone)*60;
var date = new Date(date_br*1000);
var date_format = date.getFullYear()+"-"+date.getMonth()+"-"+date.getDate();
emit(date_format,{event_ids: [this.event_id], count: 1});
Accounts.onCreateUser(function(options, user) {
// We're enforcing at least an empty profile object to avoid needing to check
// for its existence later.
if (user.services && user.services.facebook) {
var
accessToken = user.services.facebook.accessToken,
result,
profile,
config
;
packages:
yum:
git: []
files:
/opt/elasticbeanstalk/hooks/appdeploy/pre/51install_meteor.sh:
mode: "000755"
user: root
group: root
encoding: plain
HelpRequests = new Meteor.Collection('helpRequests', {
transform: function (doc) {
doc.isCancelled = function () {
return _.contains(['cancel-requester', 'cancel-helper'], this.status);
}
return doc;
}
});

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:

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after