This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class GetrsSetrs { | |
public function __call($name, $arguments) { | |
$action = substr($name, 0, 3); | |
if ($action == 'get') { | |
return $this->get(lcfirst(substr($name, 3))); | |
} | |
else if ($action == 'set') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DB { | |
/** | |
* @var DB | |
*/ | |
private static $instancia = NULL; | |
/** | |
* @var Mysql link identifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: https://davidwalsh.name/video-preview | |
# sample in PHP => https://gist.github.com/AkgunFatih/88c2241865c25e40a50edc4e24679a94 | |
sourcefile=$1 | |
destfile=$2 | |
# Overly simple validation | |
if [ ! -e "$sourcefile" ]; then | |
echo 'Please provide an existing input file.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
Function Base64Encode(sText) | |
Dim oXML, oNode | |
Set oXML = CreateObject("Msxml2.DOMDocument.3.0") | |
Set oNode = oXML.CreateElement("base64") | |
oNode.dataType = "bin.base64" | |
oNode.nodeTypedValue = Stream_StringToBinary(sText) | |
Base64Encode = oNode.text | |
Set oNode = Nothing | |
Set oXML = Nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function adicionaDiasUteis(int $numDias=0, DateTime $data):DateTime { | |
$dataFim = clone $data; | |
$umdia = new DateInterval('P1D'); // intervalo fixo | |
for ($i=0; $i<$numDias; $i++) { | |
$dataFim->add($umdia); | |
if ($dataFim->format('w') == "0" || $dataFim->format('w') == "6") { | |
$i--; // retorna o contador, caso seja sábado ou domingo | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// only for CakePHP 2.x | |
$lastquery = end($this->getDatasource()->getLog()['log'])['query']; | |
debug($lastquery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
html, | |
body { | |
font-family: Helvetica, Arial, sans-serif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that "matheuseduardo.id" is my Blockstack ID. https://onename.com/matheuseduardo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.counter span { | |
float:left; | |
width:22px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
keep() { | |
# check arguments | |
if [ $# -ne 1 ]; | |
then | |
echo -e "Wrong arguments specified. Usage:\nkeep /tmp/test.md\ncat /tmp/test.md | keep test.md" | |
return 1 | |
fi | |
# get temporary filename, output is written to this file so show progress can be showed | |
tmpfile="$( mktemp -t keepXXX )" |