Skip to content

Instantly share code, notes, and snippets.

View ahoulgrave's full-sized avatar

Agustín Houlgrave ahoulgrave

  • New Relic
  • Barcelona, España
View GitHub Profile
@ahoulgrave
ahoulgrave / slugify.php
Created December 7, 2015 20:23
Slugify
function slugify($text)
{
// replace non letter or digits by -
$text = preg_replace('~[^\\pL\d]+~u', '-', $text);
// trim
$text = trim($text, '-');
// transliterate
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
@ahoulgrave
ahoulgrave / time_elapsed_string.func.php
Created December 1, 2015 17:43
Tiempo transcurrido en español
function time_elapsed_string($datetime, $full = false) {
$now = new \DateTime;
$ago = $datetime;
$diff = (array) $now->diff($ago);
$diff['w'] = floor($diff['d'] / 7);
$diff['d'] -= $diff['w'] * 7;
$string = array(
'y' => 'año',
mysql -u username -p database_name < file.sql
@ahoulgrave
ahoulgrave / main.cpp
Last active December 22, 2015 19:59
Matriz de 5x5...
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int m[5][5] = {
{1,2,3,4,5},
{6,7,8,9,10},
@ahoulgrave
ahoulgrave / puntos.py
Created August 22, 2013 22:49
Metemática 1 - Guía 1 - Ej. 2
__author__ = 'hormiga'
rango = [10,11]
verdulerias = [
[0,3],
[2,3],
[1,8],
[7,9],
[7,1],
@ahoulgrave
ahoulgrave / main.cpp
Created August 22, 2013 22:48
Ajedrez
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
int pos[2] = {1,1};
while (pos[0] != 8 || pos[1] != 8) {
@ahoulgrave
ahoulgrave / main.cpp
Created August 21, 2013 13:54
Exponentes
#include <cstdlib>
#include <iostream>
using namespace std;
int potencia(int base, int exp);
int main(int argc, char *argv[])
{
@ahoulgrave
ahoulgrave / main.cpp
Created August 14, 2013 13:41
arrays
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int B[5][5] = {
{1,2,3,7,5},
{4,5,6,8,4},
@ahoulgrave
ahoulgrave / ejercicio_3.py
Last active December 20, 2015 15:39
Programación de computadoras, TP3 (ej3)
# -*- coding: utf-8 -*-
from random import randint, uniform
#DESCOMENTAR PARA GENERAR LA LISTA DE DATOS QUE INGRESAN
#ingresos = []
#for i in range(0,30):
# ingresos.append({'mozo':randint(1,2),'mesa':randint(1,4),'importe':uniform(0,200),'cantidad_de_personas':randint(1,10)})
#print ingresos
ingresos = [{'cantidad_de_personas': 3, 'mesa': 2, 'mozo': 2, 'importe': 11.680529678994134}, {'cantidad_de_personas': 1, 'mesa': 3, 'mozo': 2, 'importe': 145.38676459634559}, {'cantidad_de_personas': 7, 'mesa': 4, 'mozo': 1, 'importe': 147.23374683869713}, {'cantidad_de_personas': 7, 'mesa': 1, 'mozo': 1, 'importe': 79.99672355340462}, {'cantidad_de_personas': 2, 'mesa': 2, 'mozo': 2, 'importe': 146.44670501620328}, {'cantidad_de_personas': 7, 'mesa': 2, 'mozo': 1, 'importe': 163.22603363847838}, {'cantidad_de_personas': 9, 'mesa': 1, 'mozo': 2, 'importe': 176.76862989793597}, {'cantidad_de_personas': 10, 'mesa': 4, 'mozo': 1, 'importe': 133.26449672637062}, {'cantidad_de_personas': 10, 'mesa': 2, 'mozo': 1, 'importe
@ahoulgrave
ahoulgrave / ejercicio2.presudo.cod
Created July 25, 2013 20:57
Programación de computadoras - TP3 - Ej 2
Algoritmo = Sueldos
Var
int:
cantidad_de_empleados_categoria_1, cantidad_de_empleados_categoria_2, cantidad_de_empleados_categoria_3, categoria_sueldo_maximo, cantidad_empleados_totales, categoria
float:
sumatoria_de_sueldos_categoria_1, sumatoria_de_sueldos_categoria_2, sumatoria_de_sueldos_categoria_3,
promedio_de_sueldos_categoria_1, promedio_de_sueldos_categoria_2, promedio_de_sueldos_categoria_3,
sueldo_maximo, sueldo_aux