View count_recursive.php
<?php | |
// Sample array. From now own I'll just use lyrics :D | |
$array = [ | |
"name" => "John Doe", | |
"document" => "01234567890", | |
"age" => "29", | |
"sex" => "male", | |
"addresses" => [ | |
[ | |
"street" => "Jane Doe St.", |
View asymmetric_flatten.php
<?php | |
/** | |
* If you want people to love you, don't do this to your data. | |
* | |
* Sample input array | |
*/ | |
$array = [ | |
"key1" => "NOME", | |
"key2" => "RG", | |
"key3" => "CPF", |
View file_download.php
<?php | |
function fileDownload($url, $destination, $headers) { | |
$ch = curl_init($url); | |
$tempnam = tempnam($destination, 'chtmp_'); | |
$fp = fopen($tempnam, 'wb+'); | |
curl_setopt($ch, CURLOPT_FILE, $fp); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
// set the headers if needed |
View basic_auth.php
<?php | |
/** | |
* Returns a base64 enconded string to use as basic auth token | |
* | |
* @param string $user Username | |
* @param string $password Password | |
* | |
* @return string Base64-encoded string | |
*/ | |
private function basicAuth($user, $password) { |
View clean_string.php
<?php | |
function clean_string($string) { | |
return preg_replace('/[^A-Za-z0-9\-\n]/', '', str_replace(' ', '-', $string)); | |
} |
View array_flatten.php
<?php | |
function array_flatten($originalArray = null) { | |
if (!$originalArray) { | |
// doesn't make sense to you? for me neither, lets kill it before I have more ideas | |
$originalArray = [ | |
'a' => 1, 'b' => 2, 'c' => 'aa', ['d' => 3, 'e' => 4, 'f' => 5, 'g' => 'bb', ['h' => 6, 'i' => 7], 'j' => 8, 'k' => 9], | |
'l' => 10,'m' => 11,'n' => 'cc', ['o' => 12, 'p' => 13, 'q' => 14, 'r' => 'dd', ['s' => 15, 't' => 16, 'u' => 'ee', ['v' => 17, 'w' => 18], 'x' => 19]], | |
'y' => 20 | |
]; |
View jsgrid-bootstrap-pagination.css
.jsgrid-pager { | |
padding-left: 0; | |
display: flex; | |
list-style: none; | |
border-radius: .25rem; | |
} | |
.jsgrid-pager-page, .jsgrid-pager-nav-button { | |
position: relative; | |
display: block; |
View web.config
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<clear /> | |
<rule name="TempRewriteToWeb" stopProcessing="false"> | |
<match url="^(public/)?(.*)$" /> | |
<action type="Rewrite" url="public/{R:2}" logRewrittenUrl="true" /> | |
</rule> |