Skip to content

Instantly share code, notes, and snippets.

View bvelastegui's full-sized avatar
🎯
Focusing

Bryan Velastegui bvelastegui

🎯
Focusing
  • Quito, Ecuador
View GitHub Profile
@cbmd
cbmd / default.conf
Created December 9, 2012 21:13
nginx config - dynamic virtual hosts
server {
index index.php;
set $basepath "/var/www";
set $domain $host;
# check one name domain for simple application
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}";
@satsura
satsura / Doctrine.xml
Created February 26, 2013 07:54
PHPStorm Doctrine Command Line Tools
<?xml version="1.0" encoding="UTF-8"?>
<framework xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schemas/frameworkDescriptionVersion1.1.3.xsd" name="Doctrine"
invoke="$PhpExecutable$ $ProjectFileDir$/application/doctrine-cli.php" alias="doctrine-cli" enabled="true"
version="2">
<command>
<name>help</name>
<help><![CDATA[Displays help for a command]]></help>
</command>
<command>
@vickoman
vickoman / validar_cedula_ecuador.js
Created December 5, 2013 05:53
Algoritmo para validar cedulas ecuatorianas.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
<script>
$(function(){
/**
* Algoritmo para validar cedulas de Ecuador
* @Author : Victor Diaz De La Gasca.
* @Fecha : Quito, 15 de Marzo del 2013
* @Email : [email protected]
* @Pasos del algoritmo
@eduardoromero
eduardoromero / separar_nombres_apellidos.php
Last active December 11, 2023 05:30
Tratando de separar nombres y apellidos de un campo. Se separa el nombre completo por palabras, se procesa cada palabra, si es una palabra que forma parte de un nombre o apellido compuesto se guarda para anexarla hasta el siguiente ciclo. Al final se tiene que tomar una decisión sobre que hacer para separar los nombres si son más de dos. Si son …
<?php
/* separar el nombre completo en espacios */
$tokens = explode(' ', trim($full_name));
/* arreglo donde se guardan las "palabras" del nombre */
$names = array();
/* palabras de apellidos (y nombres) compuetos */
$special_tokens = array('da', 'de', 'del', 'la', 'las', 'los', 'mac', 'mc', 'van', 'von', 'y', 'i', 'san', 'santa');
$prev = "";
<?php
function array_keys_multi(array $array)
{
$keys = array();
foreach ($array as $key => $value) {
$keys[] = $key;
if (is_array($array[$key])) {
$keys = array_merge($keys, array_keys_multi($array[$key]));
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@jclosure
jclosure / docker_reverting
Created June 5, 2015 08:07
How to revert a docker container to a previous commit
$ docker history imagename
IMAGE CREATED CREATED BY SIZE
f770fc671f11 12 seconds ago apt-get install -y curl 21.3 MB
28445c70c2b3 39 seconds ago apt-get install ping 11.57 MB
8dbd9e392a96 7 months ago 131.5 MB
$ docker tag 2844 imagename # <-- that's the secret right there
$ docker history imagename
IMAGE CREATED CREATED BY SIZE
@vluzrmos
vluzrmos / App_Http_VideoStream.php
Last active October 22, 2024 21:47
Laravel VideoStream.
<?php
namespace App\Http;
/**
* Description of VideoStream
*
* @author Rana
* @link https://gist.github.com/vluzrmos/d5682ad426525196d069
*/
@emamut
emamut / parroquias-quito.json
Last active January 21, 2020 22:08
Listado de parroquias urbanas y rurales de Quito
[
"Belisario Quevedo",
"Alangasi",
"Carcelen",
"Amaguaña",
"Centro Historico",
"Atahualpa",
"Chilibulo",
"Calacali",
"Chillogallo",
@taylorotwell
taylorotwell / weather.sh
Last active August 27, 2019 13:40
Weather CLI
alias weather='curl -s wttr.in | sed -n "1,7p"'