Skip to content

Instantly share code, notes, and snippets.

View rudwolf's full-sized avatar

rudwolf

View GitHub Profile
@rudwolf
rudwolf / codetest-rb.php
Created January 25, 2023 20:08
Coding test for rightbalance
<?php
/*
Let’s say we are dealing with sending data over the internet, to make it simple, assume this plain text, in order to save some bandwidth we want to compress it, according to the following function:
compress(aaaaca) -> ax4ca
compress(aaaaaabbbcaaa) -> ax6bx3cax3
compress(mississippi) -> misx2isx2ipx2i
*/
@rudwolf
rudwolf / .htaccess
Created September 15, 2022 15:16
Typo3 for Shared Hosts
#####
#
# Example .htaccess file for TYPO3 CMS - for use with Apache Webserver
#
# This file includes settings for the following configuration options:
#
# - Compression
# - Caching
# - MIME types
# - Cross Origin requests
function myFunction() {
var str = "a Raposa Matou o rato no NatO";
var res = str.toLowerCase().split(" ");
var htmlFinal = "";
for(let i = 0; i < res.length; i++){
palavra = res[i].split("");
for(let i2 = 0; i2 < palavra.length; i2++){
console.log(palavra[i2]);
}
}
@rudwolf
rudwolf / phoneValidate_BR.php
Last active May 27, 2019 15:56 — forked from boliveirasilva/phoneValidate_BR.php
Regex para validação de telefones (celular ou fixo) no Brasil. A expressão leva em conta o formato internacional/nacional, com ou sem o DDD, de telefones fixos e celulares.
<?php
// A função abaixo demonstra o uso de uma expressão regular que identifica, de forma simples, telefones válidos no Brasil.
// Nenhum DDD iniciado por 0 é aceito, e nenhum número de telefone pode iniciar com 0 ou 1.
// Exemplos válidos: +55 (11) 98888-8888 / 9999-9999 / 21 98888-8888 / 5511988888888
function phoneValidate($phone)
{
$regex = '/^(?:(?:\+|00)?(55)\s?)?(?:\(?([1-9][0-9])\)?\s?)?(?:((?:9\d|[2-9])\d{3})\-?(\d{4}))$/';
if (preg_match($regex, $phone) == false) {
@rudwolf
rudwolf / probleminha.php
Created April 3, 2018 15:26
Probleminha do HackerRank
<?php
$handle = fopen ("php://stdin", "r");
function equalizeArray($arr) {
$diff = 0;
$d = [];
foreach($arr as $item) {
@$d[$item]++;
}
@rudwolf
rudwolf / DbTraits.php
Created December 1, 2017 18:23
app/Traits/DbTraits.php
<?php
/**
* Trait to handle commom function used by DynamicController or anything that needs to access or run query in any Database
*/
namespace App\Traits;
use Config;
use Db;
@rudwolf
rudwolf / AbstractRequest.php
Created July 6, 2017 20:02
Request and Controllers
<?php
namespace App\Http\Requests;
use App\Http\Requests\Request;
use Illuminate\Contracts\Validation\Validator;
class AbstractRequest extends Request
{
$jsString = ob_get_contents();
ob_end_clean();
$unescaped = array("'", '"');
$escaped = array("\\x27", "\\x22");
echo str_replace($unescaped, $escaped, $jsString);
function validateEmail(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
emailCaptured = false;
(function($) {
$("input[type='text']").on('keyup', function (e) {
@rudwolf
rudwolf / Sublime Text 3 Build 3103 License Key - CRACK
Created May 2, 2017 18:35
Sublime Text 3 Build 3103 License Key - CRACK
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04