Skip to content

Instantly share code, notes, and snippets.

View ivan-marquez's full-sized avatar

Jose Ivan Marquez ivan-marquez

View GitHub Profile
@ivan-marquez
ivan-marquez / reactor.js
Created October 22, 2018 14:56 — forked from mohsen1/reactor.js
Reactor Pattern in JavaScript
function Event(name){
this.name = name;
this.callbacks = [];
}
Event.prototype.registerCallback = function(callback){
this.callbacks.push(callback);
}
function Reactor(){
this.events = {};
@ivan-marquez
ivan-marquez / tessel_vx.x.x.js
Created June 24, 2018 00:06
Flow typed definitions for Tessel projects.
// flow-typed signature: 41c26b1157e954a0cd4ce3efa2131537
// flow-typed version: <<STUB>>/tessel_v^2.0.0/flow_v0.75.0
/**
* This is an autogenerated libdef stub for:
*
* 'tessel'
*
* Fill this stub out by replacing all the `any` types.
*
@ivan-marquez
ivan-marquez / streams.js
Created March 10, 2018 16:04
Exploring Node.js streams
const fs = require('fs');
const server = require('http').createServer();
server.on('request', (req, res) => {
/**
* We basically put the whole big.file (~400mb) content in memory before we write it
* out to the response object. This is very inefficient.
* memory used: ~430mb
*/
// fs.readFile('./big.file', (err, data) => {
@ivan-marquez
ivan-marquez / jquery-file-upload.js
Last active June 21, 2017 13:40
JQuery fileUpload attach form values to submit
$('#file').fileupload({
url: 'rewards/postnotes',
singleFileUploads: true,
replaceFileInput: false,
fileInput: $('#file'),
type: 'POST',
autoUpload: false,
progressall: function (e, data) {
button.attr('disabled', 'disabled')
},
@ivan-marquez
ivan-marquez / javascript.json
Created April 8, 2017 01:05
Visual Studio Code API Doc snipppets.
/**
* For more info on how to create snippets in VS Code,
* visit https://code.visualstudio.com/Docs/customization/userdefinedsnippets
*/
{
"API Documentation": {
"prefix": "apidocs",
"body": [
"/**",
"* @api {${1:http-method}} ${2:url} ${3:description}",
@ivan-marquez
ivan-marquez / .bowerrc
Created August 14, 2016 01:40
Bower config file
{
"directory": "public/lib"
}
@ivan-marquez
ivan-marquez / .jshintrc
Created August 14, 2016 01:33
Js Hint config file
{
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"es3": false,
"esversion": 6,
"forin": true,
"freeze": true,
"immed": true,
@ivan-marquez
ivan-marquez / .jscsrc
Created August 14, 2016 01:32
Jscs config file
{
"excludeFiles": ["node_modules/**", "bower_components/**"],
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
@ivan-marquez
ivan-marquez / npm-cheat-sheet.md
Created August 12, 2016 19:12 — forked from AvnerCohen/npm-cheat-sheet.md
Node.js - npm Cheat Sheet

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

##List of less common (however useful) NPM commands

######Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

@ivan-marquez
ivan-marquez / webpack.config.js
Created July 19, 2016 01:54
Webpack config file sample
var path = require('path');
var webpack = require('webpack');
var CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
module.exports = {
devtool: 'source-map',
debug: true,
entry: {
'app': './src/app/main'
},