Skip to content

Instantly share code, notes, and snippets.

View gmoqa's full-sized avatar
💀
The Soul is in the Software

Guillermo Quinteros gmoqa

💀
The Soul is in the Software
View GitHub Profile
@gmoqa
gmoqa / normalize-port.js
Created February 12, 2019 11:54
Normalize port Javascript
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
const port = parseInt(val, 10);
if (isNaN(port)) {
return val;
}
@gmoqa
gmoqa / locations-CL.json
Created December 19, 2018 16:33
Chile, Regions, Provinces and Communes in JSON
{
"regions":[
{
"id":1,
"name":"Tarapac\u00e1",
"ISO":"CL-TA"
},
{
"id":2,
"name":"Antofagasta",
@gmoqa
gmoqa / logger.js
Created December 8, 2018 15:13
Logger file for node js
require('dotenv').config()
const { createLogger, format, transports } = require('winston');
require('winston-daily-rotate-file');
const fs = require('fs');
const path = require('path');
const dir = 'logs'
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir)
@gmoqa
gmoqa / Amazing BaseFixture for Symfony4
Last active October 26, 2018 15:05
Amazing BaseFixture for Symfony4
<?php
namespace App\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Faker\Factory;
use Faker\Generator;
/**
@gmoqa
gmoqa / RetrieveEmailCommand.php
Last active August 25, 2017 13:37
Symfony2 command to retrieve and save, emails by IMAP, save the email, attachments and analize a email content for set a specific Entity.
<?php
namespace AppBundle\Command;
use AppBundle\Entity\Evento;
use AppBundle\Entity\EventoAdjunto;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@gmoqa
gmoqa / Sublime-keybindings
Created May 22, 2015 16:32
Sublime text Keybindings
[
{ "keys": ["ctrl+shift+l"],
"command": "insert_snippet",
"args": {
"contents": "console.log(${1:}$SELECTION);${0}"
}
},
{ "keys": ["ctrl+shift+v"],
"command": "insert_snippet",