Skip to content

Instantly share code, notes, and snippets.

View mariano-aguero's full-sized avatar
:octocat:
Focusing

Mariano Aguero mariano-aguero

:octocat:
Focusing
View GitHub Profile
@mariano-aguero
mariano-aguero / RestControllerTrait.php
Last active March 3, 2016 10:44 — forked from beanmoss/RestControllerTrait.php
Playing with Laravel Lumen: simple RESTful trait.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
trait RestControllerTrait {
/**
* Manage index request
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Routing\Middleware;
use Illuminate\Http\Response;
class CORS implements Middleware {
/**
* Handle an incoming request.
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
/**
* If the incoming request is an OPTIONS request
* we will register a handler for the requested route
*/
class CatchAllOptionsRequestsProvider extends ServiceProvider {
@mariano-aguero
mariano-aguero / .eslintrc
Created October 23, 2015 13:03 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@mariano-aguero
mariano-aguero / monitrc
Created October 30, 2015 12:51 — forked from franck/monitrc
monit config file (nginx, mysql, redis, tomcat)
###############################################################################
## Monit control file
###############################################################################
##
## Comments begin with a '#' and extend through the end of the line. Keywords
## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
##
## Below you will find examples of some frequently used statements. For
## information about the control file, a complete list of statements and
## options please have a look in the monit manual.
@mariano-aguero
mariano-aguero / remove-accents.js
Created June 6, 2016 19:36 — forked from monkeymonk/remove-accents.js
AngularJS `removeAccents` filter
angular.module('utils.filters', [])
.filter('removeAccents', removeAccents);
function removeAccents() {
return function (source) {
var accent = [
/[\300-\306]/g, /[\340-\346]/g, // A, a
/[\310-\313]/g, /[\350-\353]/g, // E, e
/[\314-\317]/g, /[\354-\357]/g, // I, i
/[\322-\330]/g, /[\362-\370]/g, // O, o
@mariano-aguero
mariano-aguero / homestead_extras.sh
Created September 18, 2016 13:09 — forked from kuroski/homestead_extras.sh
Script for the installation of MSSQL in Laravel Homestead (read the comments)
#!/bin/bash
#Install Laravel Homestead (http://laravel.com/docs/5.0/homestead)
#ssh into Homestead "homestead ssh"
#Run the script using "sudo bash homestead_extras.sh"
#Leave all the default options sugested during the installation, and do not modify any files!!
apt-get update
#Additional Packages
apt-get install -y php5-ldap php5-mssql
@mariano-aguero
mariano-aguero / KeystoneApiExample.md
Created January 10, 2017 18:14 — forked from JedWatson/KeystoneApiExample.md
Example of how to scaffold API endpoints for Posts in a Keystone project (based on the yo keystone example).

This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.

It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)

Gists don't let you specify full paths, so in the project structure the files would be:

routes-index.js        -->    /routes/index.js         // modified to add the api endpoints
routes-api-posts.js    -->    /routes/api/posts.js     // new file containing the Post API route controllers
@mariano-aguero
mariano-aguero / better-nodejs-require-paths.md
Created January 11, 2017 16:34 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@mariano-aguero
mariano-aguero / gist:cf4be684d86e843071957598eaaac922
Created October 31, 2017 17:18 — forked from elamperti/gist:3111691
RegEx para teléfonos de Argentina
/(?<=\s|:)\(?(?:(0?[1-3]\d{1,2})\)?(?:\s|-)?)?((?:\d[\d-]{5}|15[\s\d-]{7})\d+)/