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
# Installation --- | |
# 1. In Bitbucket, add $FTP_USERNAME $FTP_PASSWORD and $FTP_HOST as environment variables. | |
# 2. Commit this file to your repo | |
# 3. From Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:Init (this will | |
# push everything and initial GitFTP) | |
# | |
# Usage --- | |
# - On each commit to master branch, it'll push all files to the $FTP_HOST | |
# - You also have the option to 'init' (from Bitbucket Cloud) - pushes everything and initialises | |
# - Finally you can also 'deploy-all' (from Bitbucket Cloud) - if multiple deploys fail, you |
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
# Geral | |
du -cha --max-depth=1 / | grep -E "M|G" | |
# By dir | |
du -cha --max-depth=1 /var | grep -E "M|G" |
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 | |
// REACT_NATIVE_PACKAGER_HOSTNAME=$(ifconfig | awk '/wlp2s0/{getline; print}' | php get-ip.php) npm start | |
echo array_values( | |
array_filter( | |
explode(' ', fgets(STDIN)), | |
function($var){ | |
if ( | |
preg_match('#\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b#', | |
$var, | |
$match) |
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
(ns http) | |
(defn http-get [url] | |
(def client (java.net.URL. url)) | |
(def response (slurp (.openStream client))) | |
(println response)) | |
(http-get "http://proclnas.github.io") |
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 | |
// Exemplo de refatoraço | |
interface Style {} | |
interface PptStyle extends Style {} | |
interface PdfStyle extends Style {} | |
class Style { | |
// Propriedades |
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 | |
// Forma procedural | |
function getPdoHandle() { /* ... */ } | |
function fetchAll($handle, $tabela) { | |
// Whitelist simples de tabelas permitidas | |
$tabelasPermitidas = ['produtos', 'lojas', 'marcas']; | |
if (!in_array($tabela, $tabelasPermitidas)) return false; |
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
/* | |
Licensed to the Apache Software Foundation (ASF) under one | |
or more contributor license agreements. See the NOTICE file | |
distributed with this work for additional information | |
regarding copyright ownership. The ASF licenses this file | |
to you under the Apache License, Version 2.0 (the | |
"License"); you may not use this file except in compliance | |
with the License. You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |
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 | |
/** | |
* Monta string à partir de um array de chave/valor | |
*/ | |
// rodrigo@blue-wind[~/repositorios/php] $ php reduce.php | |
// <a href="http://google.com" id="java" class="php"/> | |
$a = [ |
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 | |
$request = ['id_usuario' => 1, 'id_campo' => 2, 'id_loja' => 3, 'id_campanha' => 4]; | |
$colunasModelA = ['id_usuario', 'id_campo']; | |
$colunasModelB = ['id_loja', 'id_campanha']; | |
$dadosParseados = [ | |
'modelA' => [], | |
'modelB' => [] | |
]; |
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 | |
// run with php7 | |
// php ex-pthreads.php -t thread | |
$opt = getopt('t:'); | |
if (!isset($opt['t'])) | |
exit (sprintf('php %s -t threads' . PHP_EOL, $argv[0])); | |
$myArray = [ | |
'http://wikipedia.org', | |
'http://yahoo.com', |
NewerOlder