Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
SYMFONY_FOLDER=$1
METHOD=$2
HTTPDUSER=$3
if [[ ! -d $SYMFONY_FOLDER || ! -e ${SYMFONY_FOLDER}/app/AppKernel.php ]]
then
echo "No es una capeta Symfony"
exit 1
@jesusgoku
jesusgoku / RutValidator.php
Created July 17, 2014 18:50
Rut Constraint
<?php
namespace Acme\DemoBundle\Validator\Contraints;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
class RutValidator extends ConstraintValidator
{
public function validate($value, Constraint $constraint)
@jesusgoku
jesusgoku / .gitignore
Created August 13, 2014 12:55
Gitignore for Symfony2 Proyect
# -- Symfony2 -----------------------------------------
app/bootstrap.php.cache
app/bootstrap_cache.php.cache
app/config/parameters.ini
app/config/parameters.yml
app/cache/*
app/logs/*
vendor/*
web/bundles/*
web/css/*
@jesusgoku
jesusgoku / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jesusgoku
jesusgoku / hostednetwork.bat
Created November 5, 2014 11:25
Hosted Network on Windows 7
@echo off
set ssid=%1
set key=%2
IF [%1]==[] (set ssid=entelwifi) ELSE (set ssid=%1)
IF [%2]==[] (set key=angelitolindo) ELSE (set key=%2)
netsh wlan set hostednetwork mode=allow ssid=%ssid% key=%key%
netsh wlan stop hostednetwork
netsh wlan start hostednetwork
@jesusgoku
jesusgoku / flock_example.sh
Created November 5, 2014 11:27
Example to utilize flock to run script only if not previous running
#!/bin/bash
{
flock -x -w 200 || exit 1
yes First
yes Second
yes Third
} 200>~/.lock/my_yes_command
@jesusgoku
jesusgoku / minesweeper.py
Created November 20, 2014 18:03
Mines Weeper
#!/usr/bin/env python
import math
import sys
from random import randrange
class MinesWeeper:
CELL_BLANK = None
CELL_MINE = "M"
@jesusgoku
jesusgoku / generators.sql
Created November 21, 2014 15:13
MySQL Generators
CREATE OR REPLACE VIEW generator_16
AS SELECT 0 n UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL
SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL
SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL
SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL
SELECT 12 UNION ALL SELECT 13 UNION ALL SELECT 14 UNION ALL
SELECT 15;
CREATE OR REPLACE VIEW generator_256
AS SELECT ( ( hi.n << 4 ) | lo.n ) AS n
(function () {
function addThousandSeparators(num, thousandSeparator) {
if (null == thousandSeparator) {
thousandSeparator = '.';
}
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
})();
@jesusgoku
jesusgoku / jquery.validation-regexp.js
Created March 10, 2015 14:47
Regexp validator to jQuery Validation Plugins
$.validator.addMethod('regexp', function (value, element, params) {
return this.optional(element) || params.test(value);
}, 'Por favor, escribe un formato valido.');