Skip to content

Instantly share code, notes, and snippets.

View aadamsx's full-sized avatar

Aaron Adams aadamsx

View GitHub Profile
@aadamsx
aadamsx / aws-sns-example.js
Created October 11, 2015 07:01 — forked from tmarshall/aws-sns-example.js
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
var fs = require('fs')
, path = require('path')
, _ = require('underscore');
var rootPath = "/path/to/remove";
removeDirForce(rootPath);
// path should have trailing slash
function removeDirForce(dirPath) {
fs.readdir(dirPath, function(err, files) {
# A little Meteor CheatSheet about Iron-Router. (updated on a weekly basis)
# Check our Studio: https://gentlenode.com/
meteor add iron:router
meteor update iron:router
# Iron Router > Configuration
# A little Meteor CheatSheet about Iron-Router. (updated on a weekly basis)
# Check our Studio: https://gentlenode.com/
meteor add iron:router
meteor update iron:router
# Iron Router > Configuration
@aadamsx
aadamsx / promises.js
Last active August 29, 2015 14:16 — forked from danthareja/promises.js
/*
* A quick example of how to use Bluebird and Q to conjure your own promises
*
* Everything going on here is explained further in the following video:
* http://youtu.be/OU7WuVGSuZw?list=PLT-DLWOBKbB4dZ83I_7Ca-sUTvorckG-E
*
*/
// Import node modules
var Q = require('q');
@aadamsx
aadamsx / README.md
Last active August 29, 2015 14:12 — forked from dariocravero/README.md

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

var meteor_root = Npm.require('fs').realpathSync(process.cwd() + '/../');
var application_root = Npm.require('fs').realpathSync(meteor_root + '/../');
// if running on dev mode
var fs = Npm.require('fs');
if (Npm.require('path').basename(fs.realpathSync(meteor_root + '/../../../')) == '.meteor') {
application_root = fs.realpathSync(meteor_root + '/../../../../');
}
var assets_folder = meteor_root + '/server/assets/';
var meteor_root = Npm.require('fs').realpathSync(process.cwd() + '/../');
var application_root = Npm.require('fs').realpathSync(meteor_root + '/../');
// if running on dev mode
var fs = Npm.require('fs');
if (Npm.require('path').basename(fs.realpathSync(meteor_root + '/../../../')) == '.meteor') {
application_root = fs.realpathSync(meteor_root + '/../../../../');
}
var assets_folder = meteor_root + '/server/assets/';
# METEOR CORE:
Anywhere: Meteor.isClient
Anywhere: Meteor.isServer
Anywhere: Meteor.startup(func)
Anywhere: Meteor.absoluteUrl([path], [options])
Anywhere: Meteor.settings
Anywhere: Meteor.release
@aadamsx
aadamsx / SessionVar.js
Last active August 29, 2015 14:09 — forked from lukemt/SessionVar.js
SessionVar = function(key, initialValue){
if (! (this instanceof SessionVar))
// called without `new`
return new SessionVar(key, initialValue);
this.key = key;
// check if already defined
if( SessionVar.keys.indexOf(key) !== -1 )
console.log('SessionVar(' + key + ') defined twice!');
SessionVar.keys.push(key);