Skip to content

Instantly share code, notes, and snippets.

View matheuseduardo's full-sized avatar
:octocat:
coding

Matheus Eduardo matheuseduardo

:octocat:
coding
View GitHub Profile
@matheuseduardo
matheuseduardo / adicionar-dias-uteis.php
Created June 26, 2018 19:10
função para adicionar determinado dias úteis - #php
<?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
}
@matheuseduardo
matheuseduardo / cakephp-last-executed-query
Last active June 5, 2018 18:44 — forked from mikedamoiseau/cakephp-last-executed-query
CakePHP - Display last executed SQL query
// only for CakePHP 2.x
$lastquery = end($this->getDatasource()->getLog()['log'])['query'];
debug($lastquery);
<!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;
Verifying that "matheuseduardo.id" is my Blockstack ID. https://onename.com/matheuseduardo
<!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;
@matheuseduardo
matheuseduardo / keep.sh
Last active January 15, 2024 21:08
script to use transfer.sh website
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 )"
@matheuseduardo
matheuseduardo / .gitconfig
Created May 22, 2017 11:08
git util aliases
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\.
@matheuseduardo
matheuseduardo / never-settle.md
Created March 7, 2017 17:06
never settle ascii
/*                                                         __    __    ___             
*                                                         /\ \__/\ \__/\_ \            
*    ___     __   __  __     __   _ __         ____     __\ \ ,_\ \ ,_\//\ \      __   
*  /' _ `\ /'__`\/\ \/\ \  /'__`\/\`'__\      /',__\  /'__`\ \ \/\ \ \/ \ \ \   /'__`\ 
* /\ \/\ \/\  __/\ \ \_/ |/\  __/\ \ \/      /\__, `\/\  __/\ \ \_\ \ \_ \_\ \_/\  __/ 
* \ \_\ \_\ \____\\ \___/ \ \____\\ \_\      \/\____/\ \____\\ \__\\ \__\/\____\ \____\
*  \/_/\/_/\/____/ \/__/   \/____/ \/_/       \/___/  \/____/ \/__/ \/__/\/____/\/____/                                                                                     
*/
@matheuseduardo
matheuseduardo / start-all-packages.bat
Last active August 17, 2016 17:57
start all packages from android via script
@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";
@matheuseduardo
matheuseduardo / adb.sh
Created August 14, 2016 04:37
android adb commands
# 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