Skip to content

Instantly share code, notes, and snippets.

View marcomo's full-sized avatar

Marco Morales marcomo

  • Ingrooves
  • Portland, OR
View GitHub Profile
@marcomo
marcomo / reduxLogger.js
Created April 25, 2017 19:52
Module for redux console output in development
/*
Redux console output for development
*/
const addLoggingToDispatch = (store) => {
const rawDispatch = store.dispatch;
if (!console.group) {
return rawDispatch;
}
return (action) => {
@marcomo
marcomo / node-server.js
Last active February 18, 2017 04:33
Basic set-up for a node web server with routes.
"use strict";
const HTTP = require("http");
const PATH = require("path");
const URL = require("url");
const FS = require("fs");
const PORT = 8080;
let headers = { "Content-Type": "text/html" };
@marcomo
marcomo / email_validator.js
Last active August 29, 2015 14:24
Javascript Email Validator: Releases submit button if Email is valid (and password is greater than 7 characters)
function EmailAddress(email) {
this.parts = email.split("@");
this.local = this.parts[0];
this.domain = this.parts[1];
this.domainParts = this.domain ? this.domain.split(".") : "";
this.host = this.domainParts ? this.domainParts[0] : "";
this.tld = this.domainParts ? this.domainParts[this.domainParts.length - 1] : "";
}
EmailAddress.prototype = {
@marcomo
marcomo / loading_js.js
Created June 25, 2015 07:12
Four ways of loading Javascript
// Four ways to load JS:
// The jQuery way:
$(document).ready(function() {
// code to load
});
// The jQuery Shorthand way:
$(function() {
// code to load