Skip to content

Instantly share code, notes, and snippets.

View jacricelli's full-sized avatar

Jorge Alberto Cricelli jacricelli

  • VEMO S.A
  • Zárate, Buenos Aires, Argentina
View GitHub Profile
@jacricelli
jacricelli / gist:40cf20d719b98776f078f626eaa14dff
Created September 14, 2016 16:52
cakephp/cakephp issue #9435
george@vm-ijme Downloads % php -v
PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.8-0ubuntu0.16.04.2, Copyright (c) 1999-2016, by Zend Technologies
george@vm-ijme Downloads % composer create-project cakephp/app test
Installing cakephp/app (3.3.1)
- Installing cakephp/app (3.3.1)
Loading from cache
@jacricelli
jacricelli / dump.sh
Created September 27, 2016 03:42 — forked from andsens/dump.sh
Backup all MySQL databases into separate files
#!/bin/sh
## backup each mysql db into a different file, rather than one big file
## as with --all-databases. This will make restores easier.
## To backup a single database simply add the db name as a parameter (or multiple dbs)
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is
## Create the user and directories
# mkdir -p /var/backups/mysql/databases
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup
## Remember to make the script executable, and unreadable by others
@jacricelli
jacricelli / zerofree.sh
Created December 5, 2016 03:13
Using ZeroFree to shrink a VirtualBox Linux Image.
#!/usr/bin/env bash
set -e
sudo apt-get install -y zerofree
sudo mount -r /dev/sda1 /mnt
sudo zerofree -v /dev/sda1
sudo umount /dev/sda1
sudo poweroff
@jacricelli
jacricelli / barcode.php
Created February 13, 2017 15:25
Generar código de barras 'Interleaved 2 of 5'
<?php
require 'vendor/autoload.php';
use Zend\Barcode\Barcode;
header('Content-Type: image/gif');
$barcodeOptions = [
'text' => '202675653930240016120303473904220110529',
'barHeight' => '30',
'withChecksum' => true
@jacricelli
jacricelli / cuilt.php
Created February 13, 2017 15:26
Generar / Validar CUILT
<?php
public function generarCuilt($dni, $sexo)
{
if (!empty($dni)) {
$dni = (string)$dni;
$prefix = $sexo === 'F' ? '27' : '20';
$sum = ($prefix[0] * 5) + ($prefix[1] * 4);
foreach ([3, 2, 7, 6, 5, 4, 3, 2] as $key => $value) {
$sum += (int)$dni[$key] * $value;
@jacricelli
jacricelli / CustomValidator.php
Created February 13, 2017 15:28
Agregar opción 'last' a cada regla de validación si ésta no se ha definido
<?php
namespace App\Model\Validation;
use Cake\Validation\Validator;
/**
* [CustomValidator description]
*/
class CustomValidator extends Validator
{
@jacricelli
jacricelli / IWin32Window.cs
Created June 13, 2017 14:33
Implementación de IWin32Window
namespace App.UI
{
using System;
using System.Windows.Forms;
/// <summary>
/// Implementación de <see cref="IWin32Window"/>.
/// </summary>
internal class Win32Window : IWin32Window
{
@jacricelli
jacricelli / CueTextBox.cs
Created June 14, 2017 18:16 — forked from MatthewKing/CueTextBox.cs
A WinForms TextBox that has support for cue banners.
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
/// <summary>
/// A Windows text box control with a cue banner.
/// </summary>
public class CueTextBox : TextBox
{
/// <summary>
@jacricelli
jacricelli / Int32TextBox.cs
Created June 28, 2017 18:18
Caja de texto que solo admite valores enteros.
using System;
using System.Windows.Forms;
namespace ICSharpCode.TextEditor.UserControls
{
class Int32TextBox : TextBox
{
public int Min { get; set; }
public int Max { get; set; }
<?php
// Título
echo $this->Plataforma->obtenerTitulo(); // Tutorías
// Título con un texto adicional
echo $this->Plataforma->obtenerTitulo('texto adicional'); // Tutorías - texto adicional
// Comprobar si la instalación corresponde a Tutorías o Graduados
if ($this->Plataforma->esGraduados()) {
echo 'Graduados';