Skip to content

Instantly share code, notes, and snippets.


Lenin Jose Meza Zarco merolhack

View GitHub Profile
merolhack / readline.js
Created Aug 25, 2018
Read the user input
View readline.js
const mongoClient = require('mongodb').MongoClient;
const rl = require('readline');
const url = 'mongodb://localhost:27017';
const dbName = 'foo-bar';
const TWEETS_COLLECTION = 'tweets';
const USERS_COLLECTION = 'users';
const ask = function(question, callback) {
var r = rl.createInterface({
merolhack / axios-meetups.js
Last active Jul 7, 2018
ES6 Functional programming
View axios-meetups.js
const axios = require('axios');
// Declare a method to consume the API
const getMeetups = (lon, lat) => axios
.post('', { lon, lat })
.then(({data}) => data);
// Call the method and get the name of each meetup
Promise.all([getMeetups(-103.4054534, 20.6737777), getMeetups(-99.1709761, 19.426063)])
.then((myArray) => {
merolhack /
Created Dec 7, 2016
Set SELinux, ACL and common permissions to Drupal 8 over CentOs 7
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
# set -o xtrace
echo "0.- Reestablecer el contexto"
sudo restorecon -Rv /var/www/html
echo "1.- Cambiar propietario del webroot de Apache"
merolhack / app.js
Last active Nov 7, 2020 — forked from rnkoaa/app.js
A simple angularjs with angular-ui modal form which includes validation on the client side.Thanks
View app.js
var app = angular.module("modalFormApp", ['ui.bootstrap']);
app.controller("modalAccountFormController", ['$scope', '$uibModal', '$log',
function ($scope, $uibModal, $log) {
$scope.showForm = function () {
$scope.message = "Show Form Button Clicked";
var uibModalInstance = ${
merolhack / backup-mysql.bat
Created Apr 14, 2016
Windows: Backup all databases in a MySQL server.
View backup-mysql.bat
@ECHO off
REM Windows Batch script to backup all mysql databases in a server
REM @author: Lenin Meza <>
REM Database information
SET dbhost=""
SET dbuser="root"
merolhack / Arduino IDE - First
Created Apr 2, 2016
If Arduino cant open the USB
View Arduino IDE - First
merolhack / slugify.js
Last active Jul 10, 2020 — forked from mathewbyrne/slugify.js
Javascript Slugify: For accents and other latin characters
View slugify.js
function slugify(text)
var from = "ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;";
var to = "aaaaaeeeeeiiiiooooouuuunc------";
_.each( from, function( character, i ) {
text = text.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
return text
.toString() // Cast to string
.toLowerCase() // Convert the string to lowercase letters
merolhack / Ionic 2 & AngularJs 2.markdown
Last active Apr 21, 2016
First steps with Ionic 2 and AngularJS 2 over Android device emulator
View Ionic 2 & AngularJs 2.markdown

Download and install "Android Studio":

Ensure that have the next environment variables in your PATH: ANDROID_HOME JAVA_HOME

Create an Android device emulator with the "AVD Manager" or with: $ android avd

merolhack / Symfony LTS
Last active Dec 8, 2015
Installation and configuration of Symfony LT(2.8)
View Symfony LTS
# curl -LsS -o ./symfony
# ./symfony new chipotle lts
✔ Symfony 2.8.0 was successfully installed.
# chown -R apache:apache ./chipotle/*
# chmod -R 775 ./chipotle/*
# cd chipotle
# nano app/config/parameters.yml
# /bin/php app/console doctrine:database:create
Created database `symfony_lts` for connection named default
You can’t perform that action at this time.