Skip to content

Instantly share code, notes, and snippets.

View deanrad's full-sized avatar
🎯
Staying On Target

Dean Radcliffe deanrad

🎯
Staying On Target
View GitHub Profile
// p = require('./extract_meteor_deps');
// Package = p.Package;
// getPackageDeps = p.getPackageDeps; depsByPackage = p.depsByPackage;
//
// > getPackageDeps('spacebars')
// ['htmljs', 'blaze', 'observe-sequence', 'templating']
// > depsByPackage
// {"spacebars": ['htmljs', 'blaze', 'observe-sequence', 'templating']}
var Package, api, depsByPackage, getPackageDeps, mockApiUse, _;
@deanrad
deanrad / load-it.js
Last active August 29, 2015 14:05
Load core Meteor Libraries for a Meteor-style REPL in the browser
var loadScript = function(url){
var d=document;
var s=d.createElement('script');
s.src=url;
(d.head || d.documentElement).appendChild(s)
};
/*needed for reactive-coffee, and meteor*/
loadScript('http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js');
/*Tracker.autorun (as Meteor.run), ReactiveDict (as ReactiveMap), ReactiveVar, and ReactiveObject */
loadScript('https://s3.amazonaws.com/www.chicagogrooves.com/js/mini-meteor.js');
@fraserxu
fraserxu / auth.js
Last active February 6, 2018 09:51
Handling CORS in Meteor app
/*
* packages/reststop2/auth.js
* Add a method to handle OPTIONS request
*/
// return nothing
RESTstop.add('login', {'method': 'OPTIONS'}, function() {})
# This little gist shows how to easily internationalize your application using the meteor-just-i18n package.
# Package repository: https://github.com/subhog/meteor-just-i18n/
# 1. Adding the package.
$ meteor add anti:i18n
@CrabDude
CrabDude / callback_contract.md
Last active December 20, 2019 18:50
Node.js Callback Contract

Node.js Callback* Contract

(aka "errback" or "error first callback")

  1. Function that takes 2 arguments
    • first argument is an error
    • second argument is the result
    • Never pass both
    • error should be instanceof Error
  2. Must never excecute on the same tick of the event loop
  3. Must be passed as last argument to function
# METEOR CORE:
Anywhere: Meteor.isClient
Anywhere: Meteor.isServer
Anywhere: Meteor.startup(func)
Anywhere: Meteor.absoluteUrl([path], [options])
Anywhere: Meteor.settings
Anywhere: Meteor.release