Skip to content

Instantly share code, notes, and snippets.

View edilsoncichon's full-sized avatar
🚀

Edilson Cichon edilsoncichon

🚀
View GitHub Profile
@jasny
jasny / image-embed-html.php
Created October 23, 2012 10:40
Create base64 encoded image to embed in HTML
<?php
$files = array_slice($argv, 1);
foreach ($files as $file) {
$picture = file_get_contents($file);
$size = getimagesize($file);
// base64 encode the binary data, then break it into chunks according to RFC 2045 semantics
$base64 = chunk_split(base64_encode($picture));
@menzerath
menzerath / backup.php
Last active February 18, 2024 19:33
PHP: Recursively Backup Files & Folders to ZIP-File
<?php
/*
* PHP: Recursively Backup Files & Folders to ZIP-File
* MIT-License - 2012-2018 Marvin Menzerath
*/
// Make sure the script can handle large folders/files
ini_set('max_execution_time', 600);
ini_set('memory_limit', '1024M');
@jpatters
jpatters / HeidiDecode.js
Last active May 17, 2024 12:41
Decodes a password from HeidiSQL. HeidiSQL passwords can be found in the registry. Use File -> Export Settings to dump all settings. Great for if you forget a password.
function heidiDecode(hex) {
var str = '';
var shift = parseInt(hex.substr(-1));
hex = hex.substr(0, hex.length - 1);
for (var i = 0; i < hex.length; i += 2)
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16) - shift);
return str;
}
document.write(heidiDecode('755A5A585C3D8141786B3C385E3A393'));
@barryvdh
barryvdh / _ide_helper.php
Last active May 6, 2024 07:45
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
@fideloper
fideloper / install.sh
Last active October 30, 2023 20:03
Vagrant Provisioning Script for PHP applications. This installs a LAMP stack.
#!/usr/bin/env bash
echo ">>> Starting Install Script"
# Update
sudo apt-get update
# Install MySQL without prompt
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
@bcole808
bcole808 / numberAbbreviation.php
Created March 5, 2014 17:18
Shorten large numbers into abbreviations (i.e. 1,500 = 1.5k)
<?php
/**
* Shorten large numbers into abbreviations (i.e. 1,500 = 1.5k)
*
* @param int $number Number to shorten
* @return String A number with a symbol
*/
function numberAbbreviation($number) {
$abbrevs = array(12 => "T", 9 => "B", 6 => "M", 3 => "K", 0 => "");
@leocomelli
leocomelli / git.md
Last active July 2, 2024 14:46
Lista de comandos úteis do GIT

GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda

@Michael-Brooks
Michael-Brooks / passwordValidation.php
Last active February 16, 2024 09:29
Laravel Password validation Regex (Contain at least one uppercase/lowercase letters and one number)
<?php
/*
* Place this with the rest of your rules.
* Doesn't need to be in an array as there are no pipes.
* Password is required with a minimum of 6 characters
* Should have at least 1 lowercase AND 1 uppercase AND 1 number
*/
$rules = [
'password' => 'required|min:6|regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).+$/'
];
@acfreitas
acfreitas / cpfCnpjRandom.php
Last active March 7, 2024 13:54
Gerador de CPF e CNPJ aleatório
/**
* Método para gerar CNPJ válido, com máscara ou não
* @example cnpjRandom(0)
* para retornar CNPJ sem máscar
* @param int $mascara
* @return string
*/
public static function cnpjRandom($mascara = "1") {
$n1 = rand(0, 9);
$n2 = rand(0, 9);
@subodhghulaxe
subodhghulaxe / creditcardvalidation.php
Created March 4, 2015 11:00
Validate credit card number in PHP
<?php
error_reporting(E_ALL);
/**
* Validate credit card number
* Returns true if $ccNum is in the proper credit card format.
*
* @param string $ccNum credit card number to validate
* @param string|array $type if $type is set to 'fast', it validates the data against the major credit cards’ numbering formats.
* If $type is set to 'all', it validates the data against with all the credit card types.