Skip to content

Instantly share code, notes, and snippets.

View afuggini's full-sized avatar

Ariel Fuggini afuggini

View GitHub Profile
@afuggini
afuggini / ttfb.sh
Created January 11, 2019 05:29 — forked from sandeepraju/ttfb.sh
curl command to check the time to first byte
#!/bin/bash
# file: ttfb.sh
# curl command to check the time to first byte
# ** usage **
# 1. ./ttfb.sh "https://google.com"
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com"
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-s \
@afuggini
afuggini / background.js
Created February 11, 2018 15:29 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@afuggini
afuggini / cookies.js
Created February 2, 2018 21:26 — forked from CrocoDillon/cookies.js
Export your awesome module using AMD, CommonJS, Node.js or just as global.
/*
* Inspiration (well… copy pasting more or less) from:
* https://github.com/ScottHamper/Cookies/blob/0.3.1/src/cookies.js#L127-L140
*
* Thanks Scott!
*/
(function (global) {
'use strict';
var MyModule = function () {
@afuggini
afuggini / nginx.config
Created October 5, 2016 16:13 — forked from jakemmarsh/nginx.config
Modify nginx proxy settings in Elastic Beanstalk options
files:
"/tmp/proxy.conf":
mode: "000644"
owner: root
group: root
content: |
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
var defaults = {
number: 1,
bool: true,
magic: 'real',
animal: 'whale',
croutons: 'delicious'
};
var options = {
number: 2,
// #1 ES6: if passing one argument you don't need to include parenthesis around parameter.
var kitty = name => name;
// same as ES5:
var kitty = function(name) {
return name;
};
// #2 ES6: no parameters example.
var add = () => 3 + 2;

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 / 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",
.factory('genericCollectionFactory',function(){
function Collection() {
var _items = [];
function get () {
return _items;
}
function add (item) {
@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;
},