Skip to content

Instantly share code, notes, and snippets.

View afuggini's full-sized avatar

Ariel Fuggini afuggini

View GitHub Profile
#!/bin/bash -x
# useradd -m digilord # Uncomment and change digilord to your username if you want to add a user for yourself
sudo apt-get install build-essential -y
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update -y
sudo apt-get install nodejs -y
sudo apt-get install mongodb -y

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.

@afuggini
afuggini / gist:e3862e5ef27722989c6e
Last active August 29, 2015 14:03 — forked from sclausen/gist:7c655d0a99c0a434e066
Turn object into array to then iterate helper
Template.foo.helpers({
data1: function(){
var array = [];
var storedData = Session.get("data");
//underscore
_.each(Object.keys(storedData),function(key){
array.push(storedData[key]);
});
return array;
},
@CallbackController = RouteController.extend(
fastRender: true
onBeforeAction: (pause) ->
p = @params
run = false
switch p.key
when "stripe"
u = Meteor.user()
@afuggini
afuggini / Error
Last active August 29, 2015 14:04
Angular DDP
Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to:
Error: [$injector:modulerr] Failed to instantiate module starter.controllers due to:
Error: [$injector:modulerr] Failed to instantiate module angularDDP due to:
Error...<omitted>...1)
.factory('genericCollectionFactory',function(){
function Collection() {
var _items = [];
function get () {
return _items;
}
function add (item) {
Router.configure
layoutTemplate: "MasterLayout"
loadingTemplate: "Loading"
notFoundTemplate: "NotFound"
Router.route "/",
name: "homepage"
Router.route "/files",
name: "files"
@afuggini
afuggini / config.json
Created April 16, 2015 14:26 — forked from anonymous/config.json
Untitled Project - Bootstrap Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",

TL;DR

Meteor is great at sharing code between different builds for different platforms. You can use the same source for your browser builds, server builds, your builds for iOS, Android, ... But how to organize your project to be able to orchestrate your builds for different apps and services from the same source? This post elaborates on the reasons why you need these different builds and how you could accomplish this with Meteor easily.

Use cases: Why would you build different apps?

1. Different apps for different roles

Say you have an app with completely different end user experiences depending on their role. It is common practice to have the user logged in, check her authorization (role) and then setup different routes or load different templates to serve that type of user’s needs. While doing so, all types of users load the same build and the app decides what portions of the build to use and what not to use.

@afuggini
afuggini / query.json
Last active October 15, 2015 19:46
How do I insert a new key:value set under one of the objects inside AdTagNames in MongoDB?
{
"_id" : ObjectId("541945c1a5b1e41035b49ed7"),
"AdTagNames" : [
{
"adURL" : "http://www.sdfadgs.com",
"adPASSBACK" : "http://google.com/passback.html",
"adTAGS" : [
"sdfgsdfgsdfg"
]
},