/* __ __ ___
* /\ \__/\ \__/\_ \
* ___ __ __ __ __ _ __ ____ __\ \ ,_\ \ ,_\//\ \ __
* /' _ `\ /'__`\/\ \/\ \ /'__`\/\`'__\ /',__\ /'__`\ \ \/\ \ \/ \ \ \ /'__`\
* /\ \/\ \/\ __/\ \ \_/ |/\ __/\ \ \/ /\__, `\/\ __/\ \ \_\ \ \_ \_\ \_/\ __/
* \ \_\ \_\ \____\\ \___/ \ \____\\ \_\ \/\____/\ \____\\ \__\\ \__\/\____\ \____\
* \/_/\/_/\/____/ \/__/ \/____/ \/_/ \/___/ \/____/ \/__/ \/__/\/____/\/____/
*/
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 )" |
This file contains hidden or 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
alias.lg log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative | |
alias.alias config --get-regexp ^alias\. |
This file contains hidden or 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
@echo off | |
:: list all packages (-3 = only thidy parts) | |
adb shell 'pm list packages -3 > /sdcard/packages.txt'; | |
:: get file | |
adb pull -p "/sdcard/packages.txt" "packages.txt"; |
This file contains hidden or 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
# Toggle Airplane Mode | |
# http://stackoverflow.com/questions/10506591/turning-airplane-mode-on-via-adb | |
am start -a android.settings.AIRPLANE_MODE_SETTINGS && input keyevent 19 && input keyevent 23 && input keyevent 4 | |
# Turn on: | |
adb shell settings put global airplane_mode_on 1 | |
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true |