Skip to content

Instantly share code, notes, and snippets.

Creating epic shit!

Romel Pérez romelperez

Creating epic shit!
View GitHub Profile
romelperez / array.methods.js
Created Feb 1, 2015
JavaScript Array Methods
View array.methods.js
// array.concat(item...)
var a = ['a', 'b', 'c'];
var b = ['x', 'y', 'z'];
var c = a.concat(b, true);
// c is ['a', 'b', 'c', 'x', 'y', 'z', true]
// array.join(separator)
var a = ['a', 'b', 'c'];
romelperez / throttle.js
Last active Aug 4, 2016
A throttle function for JavaScript.
View throttle.js
* Returns a function that will be called once in an interval of time right
* away when it is called.
* @param {Function} func - The function to throttle.
* @param {Number} interval - Time in milliseconds.
* @param {Function} gate - The function to validate the throttle. If it return
* true, we prevent the throttle.
* @return {Function}
romelperez /
Last active Nov 21, 2016



  • Cómo elegir la metodología correcta para cada equipo de desarrollo? Cuál es tu experiencia con metologías ágiles?
  • Cuál es tu herramienta favorita para llevar el tracking del proceso de desarrollo y la comunicación con los clientes?


  • Sobre testing: Cómo decidir qué testear? Teniendo en cuenta: tamaño, complejidad e inversión.
romelperez / jquery.plugin.js
Last active Nov 22, 2016
A jQuery plugin boilerplate
View jquery.plugin.js
const NAME = 'pluginName';
const methods = {
method1: function () {
const conf =`${NAME}-config`);
if (!conf) return this;
romelperez / atom.keymap.cson
Last active Feb 5, 2017
Atom keybinding map
View atom.keymap.cson
# Your keymap
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
View atom.styles.less
* Your Stylesheet
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
romelperez / demos.html
Last active Jun 25, 2017 — forked from demonio/kuwy.css
KuWy from KumbiaPHP developers
View demos.html
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="./kuwy.css">
body { margin: 20px; font-family: sans-serif; }
# backup
mongodump --db=mydb --archive=./backups/mydb.mongodump --authenticationDatabase=mydb -u username -p
# restore
mongorestore --drop --archive=./backups/mydb.mongodump --authenticationDatabase=mydb -u username -p
# export
mongoexport --db mydb --collection users --out ./test/fixtures/users.json --pretty --jsonArray
# import
romelperez /
Last active Dec 28, 2017
Linux shortcuts commands
# Line count
find ./ -name '*.js' | xargs wc -l
# Convert webp files whithin directory to png
find ./ -name "*.webp" -exec dwebp {} -o {}.png \;
# Generate random string
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;
romelperez / validator.js
Created Mar 11, 2018
Quick validation library
View validator.js
import isLength from 'validator/lib/isLength';
import isEmail from 'validator/lib/isEmail';
import isInt from 'validator/lib/isInt';
import isFloat from 'validator/lib/isFloat';
import matches from 'validator/lib/matches';
const required = value => !!value;
const isLengthMin = (value, min) => isLength(value, { min });
const isLengthMax = (value, max) => isLength(value, { max });