Skip to content

Instantly share code, notes, and snippets.

View joseluisq's full-sized avatar

Jose Quintana joseluisq

View GitHub Profile
@joseluisq
joseluisq / class.stream.php
Created March 20, 2016 23:12 — forked from jas-/class.stream.php
PHP stream handler w/ support for multiple files over PUT
<?php
/**
* stream - Handle raw input stream
*
* LICENSE: This source file is subject to version 3.01 of the GPL license
* that is available through the world-wide-web at the following URI:
* http://www.gnu.org/licenses/gpl.html. If you did not receive a copy of
* the GPL License and are unable to obtain it through the web, please
*
@joseluisq
joseluisq / fullCalendarDisablePrevNext.js
Created March 28, 2016 21:18 — forked from juanbrujo/fullCalendarDisablePrevNext.js
jQuery FullCalendar.js: disable prev/next button for past/future dates
$('#calendar').fullCalendar({
viewRender: function(currentView){
var minDate = moment(),
maxDate = moment().add(2,'weeks');
// Past
if (minDate >= currentView.start && minDate <= currentView.end) {
$(".fc-prev-button").prop('disabled', true);
$(".fc-prev-button").addClass('fc-state-disabled');
}
else {
@joseluisq
joseluisq / 0_reuse_code.js
Created May 3, 2016 21:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@joseluisq
joseluisq / gist:6823534399e574e2d92560261ba40a52
Created May 14, 2016 22:21
Walmart Mobile node.js Setup

Overview

We run multiple server processes in two data centers. Each process listens on two ports, one for HTTP and one for HTTPS. HTTPS is terminated by Apache prior to reaching node.js. HTTP goes directly from the client to node.js (through a master load balancer). We do not use clusters. We slice our physical servers into thin virtual machines running SmartOS, each with about 3GB of memory designed for a single node.js process.

Our node.js servers are hapi.js servers using the composer functionality and plugins architecture. We have three sets of plugins loaded: mobile web front end experience (single page app), legacy API reverse proxy, and monitoring.

We also serve original node.js services off another server zone which runs closed source plugins using hapi.

Analytics

@joseluisq
joseluisq / node-tar.js
Created May 26, 2016 16:19 — forked from mafintosh/node-tar.js
tar-fs vs node-tar benchmarks
var tar = require('tar');
var fstream = require('fstream');
var input = '/Users/maf/Downloads';
var reader = fstream.Reader({type: "Directory", path: input});
var pack = tar.Pack();
reader.pipe(pack).pipe(tar.Extract({path: '/tmp/destination-node-tar'}));
@joseluisq
joseluisq / .eslintrc
Last active June 22, 2016 07:10 — forked from ghostwords/.eslintrc
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"arrowFunctions": false, // enable arrow functions
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"classes": false, // enable classes
"defaultParams": false, // enable default function parameters
"destructuring": false, // enable destructuring
sudo cp /usr/local/opt/nginx/*.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
@joseluisq
joseluisq / KeyGenerateCommand.php
Created August 31, 2016 22:19 — forked from krisanalfa/KeyGenerateCommand.php
Lumen Key Generator Commands
<?php
namespace App\Console\Commands;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
class KeyGenerateCommand extends Command
{
@joseluisq
joseluisq / node-rm-rf-async.js
Last active September 18, 2017 17:56 — forked from geedew/node-rm-rf-async.js
NodeJS: Remove async directory that is not empty
// http://www.geedew.com/remove-a-directory-that-is-not-empty-in-nodejs/
var fs = require('fs');
var rmdirAsync = function(path, callback) {
fs.readdir(path, function(err, files) {
if (err) {
// Pass the error on to callback
callback(err, []);
return;