Skip to content

Instantly share code, notes, and snippets.

Diego Mármol dmmarmol

Block or report user

Report or block dmmarmol

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dmmarmol / redux-middleware.ts
Created Dec 30, 2017
An example of a typed react-redux middleware using Typescript
View redux-middleware.ts
import { Action } from 'redux/store-types';
import { Dispatch, MiddlewareAPI, Store } from 'redux';
export const authMiddleware = (_api: MiddlewareAPI<Store<void>>) => (
next: Dispatch<void>
) => <A extends Action>(action: A) => {
return next(action);
dmmarmol /
Last active Dec 30, 2017
Email RegEx validation

Email RegEx Validations

Based on


Validate email syntax in JavaScript


Email Is valid
dmmarmol / arrayMove.js
Created May 16, 2017
Move items inside an array and reorder (ES6)
View arrayMove.js
const arrayMove = (array, from, to) => {
// Clone the original array
let newArray = array.slice();
// Get the item that will be moved
const movingItem = newArray.splice(from, 1)[0];
// Replace that item in the 'to' position
newArray.splice(to, 0, movingItem);
return newArray;
dmmarmol / Permutations.js
Created Apr 4, 2017
Create permutations from two or more given list
View Permutations.js
* Create permutations from two or more given list
* Based on Heap's Algorithm
function permutations() {
var r = [], arg = arguments, max = arg.length-1;
function helper(arr, i) {
for (var j=0, l=arg[i].length; j<l; j++) {
var a = arr.slice(0); // clone arr
dmmarmol / run-mongodb.bat
Last active Mar 20, 2017
Simple Batch file for running MongoDB on a windows computer
View run-mongodb.bat
if not exist "C:\mongodb\data\db\" mkdir C:\mongodb\data\db
if not exist "C:\mongodb\data\log\" mkdir C:\mongodb\data\log
@echo off
:: Update the 3.4 if you have another version
cd C:\Program Files\MongoDB\Server\3.4\bin
::set default port variable
set port=27017
:: add this line at the end of the ~mongod.exe to write the log on a separated file
dmmarmol / gulp-iconfont.js
Last active Jun 23, 2016
Gulpfile made for creating your custom icon fonts from .svg files.
View gulp-iconfont.js
var gulp = require('gulp');
var iconfont = require('gulp-iconfont');
var iconfontCss = require('gulp-iconfont-css');
var ICONFONT = 'font-file-name';
// Working Dir
var APP = {
ICONS: APPFOLDER+'/src/icons',
dmmarmol / Material-Buttons.markdown
Last active Feb 2, 2016
Material design click animation effect using SCSS + JS
View Material-Buttons.markdown
You can’t perform that action at this time.