Skip to content

Instantly share code, notes, and snippets.

View RenanLazarotto's full-sized avatar
Transformando café em código

Renan "Firehawk" Lazarotto RenanLazarotto

Transformando café em código
View GitHub Profile
@deyvin
deyvin / jquery.serialize_replace.js
Created March 2, 2012 14:13
Forçar serialize() do jQuery reconhecer checkboxes mesmo não marcado
$(function() {
$.fn.serialize = function (options) {
return $.param(this.serializeArray(options));
};
$.fn.serializeArray = function (options) {
var o = $.extend({
checkboxesAsBools: false
}, options || {});
@Radiergummi
Radiergummi / Cryptor.php
Last active March 3, 2023 13:11
A PHP class to encrypt and decrypt strings using a static application secret. Input is converted to hex strings to enable easier handling
<?php
namespace Vendor\Library;
use function bin2hex;
use function hex2bin;
use function openssl_decrypt;
use function openssl_encrypt;
use function random_bytes;
@nurbek-ab
nurbek-ab / web.config
Last active March 28, 2023 12:28 — forked from lennart/gist:3787187
IIS rewrite rule for Symfony 2 (use at root directory)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="TempRewriteToWeb" stopProcessing="false">
<match url="^(web/)?(.*)$" />
<action type="Rewrite" url="web/{R:2}" logRewrittenUrl="true" />
</rule>
@zuhairkareem
zuhairkareem / search_partial_string_array.php
Last active May 19, 2023 15:14
Search partial string in an array in PHP
<?php
/**
* First Method.
*/
function array_search_partial($arr, $keyword) {
foreach($arr as $index => $string) {
if (strpos($string, $keyword) !== FALSE)
return $index;
}
}
@rafael-neri
rafael-neri / validar_cpf.php
Last active April 12, 2024 17:40
Validar CPF em PHP (Completo)
<?php
function validaCPF($cpf) {
// Extrai somente os números
$cpf = preg_replace( '/[^0-9]/is', '', $cpf );
// Verifica se foi informado todos os digitos corretamente
if (strlen($cpf) != 11) {
return false;