Skip to content

Instantly share code, notes, and snippets.

View marcusandre's full-sized avatar

Marcus André marcusandre

View GitHub Profile
const sequence = require('run-sequence')
// create a middleware stack
// (obj, obj, [fn(obj, obj, fn)], fn) -> null
function mw (req, res, arr, done) {
const fns = arr.map(fn => (next) => fn(req, res, next))
sequence(fns, done)
}
@pwaldhauer
pwaldhauer / playbook.yaml
Created September 15, 2015 21:09
Simple Ansible Playbook
---
- hosts: all
gather_facts: false
remote_user: ubuntu
sudo: yes
vars:
http_port: 80
api_root: /var/www/ansibletest.com/
tasks:
- name: update apt
@domenic
domenic / asyncdefer.svg
Created September 10, 2015 19:54
Async/defer SVG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@beriberikix
beriberikix / backbone-links.md
Created March 4, 2012 03:45
AWSUM Web Development Linkz
@evantahler
evantahler / example.js
Created June 1, 2012 12:31
PhoneGap / Cordova Device Token plugin JS component (iOs)
// An example of how to use the PhoneGap / Cordova plugin described in this post [[ http://blog.evantahler.com/phonegap-and-push-notifications ]] to get an iOs device token
document.addEventListener("deviceready", function(){
getDeviceToken();
}
getDeviceToken = function(){
if(typeof device != "undefined" && typeof cordova == "object"){
var getToken = function(types, success, fail){
cordova.exec(success, fail, "PushToken", "getToken", types);
@cgcardona
cgcardona / balanceModule
Created October 11, 2012 13:58
The Module Pattern in Javascript
'use strict';
var balanceModule = (function(){
// Private variable
var balance = 0;
// Private functions
function logStatus(updateFigure, currentBalance, operatorSymbol, newBalanceFigure){
console.log(currentBalance + ' ' + operatorSymbol + ' ' + updateFigure + ' = ' + newBalanceFigure);
}
@max-mapper
max-mapper / readme.md
Last active October 12, 2015 10:17
introduction to node
@marcusandre
marcusandre / inline-blocks.md
Created February 26, 2015 21:47
Correct inline-block elements
<div style="text-align: center;">
  <div class="inline-block">Element</div>
  <div class="inline-block">Element</div>
  <div class="inline-block">Element</div>
</div>
.inline-block {
@tj
tj / example.js
Created July 31, 2013 18:48
console.api()
function params(fn) {
var str = fn.toString();
var sig = str.match(/\(([^)]*)\)/)[1];
if (!sig) return [];
return sig.split(', ');
}
console.api = function(obj){
console.log();
var proto = Object.getPrototypeOf(obj);
@shazron
shazron / ios7.phonegap.cordova.js
Last active December 23, 2015 07:39
PhoneGap / Apache Cordova - top margin for iOS 7
// Pre-requisites:
// 1. Device core plugin
// 2. Splashscreen core plugin (3.1.0)
// 3. config.xml: <preference name="AutoHideSplashScreen" value="false" />
// 4. config.xml: <preference name="DisallowOverscroll" value="true" />
function onDeviceReady() {
if (parseFloat(window.device.version) >= 7.0) {
document.body.style.marginTop = "20px";
// OR do whatever layout you need here, to expand a navigation bar etc