Skip to content

Instantly share code, notes, and snippets.

View fernandovaller's full-sized avatar
🏠
Working from home

Fernando Valler fernandovaller

🏠
Working from home
View GitHub Profile
@fernandovaller
fernandovaller / Sublime Text 3 - Get and Set
Last active March 4, 2016 15:02
Geração automática dos gets e sets de clases
#Tools > New Snippet
Troque o texto por esse e salve:
<snippet>
<content><![CDATA[public function get${1/(.*)/\u$1/}()
{
return \$this->${1:$SELECTION};
}
@fernandovaller
fernandovaller / gist:69c4a572586f46646453
Created February 29, 2016 16:09 — forked from viniciusteles/gist:556029
Sete Atitudes para Hackear a Indústria de Software
Sete Atitudes para Hackear a Indústria de Software
By Klaus Wuestefeld
1) Torne-se excelente.
Seja realmente bom em alguma coisa. Não fique só choramingando ou
querendo progredir às custas dos outros. Não pense q pq vc sentou 4
anos numa faculdade ouvindo um professor falar sobre software q vc
sabe alguma coisa. Jogador de futebol não aprende a jogar bola tendo
@fernandovaller
fernandovaller / Sublime Text 3 - Identar código
Last active January 13, 2021 22:09
Sublime Text 3 - Identar código
Em Preferences > Key Bindings User
[
{ "keys": ["ctrl+t"], "command": "run_macro_file", "args": {"file": "Packages/User/convert_tabs_to_spaces.sublime-macro"} },
{ "keys": ["ctrl+shift+r"], "command": "reindent" , "args": {"single_line": false}}
]
<?php
function size($size, $precision = 2){
$base = log($size, 1024);
//$suffixes = array('', 'K', 'M', 'G', 'T');
$suffixes = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
return round(pow(1024, $base - floor($base)), $precision) .' '. $suffixes[floor($base)];
}
@fernandovaller
fernandovaller / List Programs
Created June 9, 2017 15:24
My list program
Firefox;
Chrome;
FileZilla;
# Project Title
One Paragraph of project description goes here
## Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
### Prerequisites
#!/bin/bash
USER="zend"
PASSWORD=""
#OUTPUT="/Users/rabino/DBs"
#rm "$OUTPUTDIR/*gz" > /dev/null 2>&1
databases=`mysql -u $USER -p$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
Usando o cloud Flare aplicar essa regra
#Se a requisição não for https force https
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#se na requisição nao tiver www force www
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
<?php
$a = '
Uma tentativa de estupro foi interrompida quando a mulher recitou a passagem de João 3:16 e orou pelo agressor, livrando-se assim do abuso sexual.
O caso aconteceu na Florida, Estados Unidos, e segundo a polícia, Charlie Christopher Bates foi morto horas depois numa perseguição policial.
A tentativa de estupro se deu quando Charlie invadiu o apartamento de sua vítima, e com uma arma, forçou-a a se despir e acariciá-lo. Quando ele estava prestes a consumar o ato, a vítima recitou um dos versículos mais conhecidos da Bíblia e passou a orar pelo agressor.
<?php
$url = 'https://www.youtube.com/watch?v=aTsMTIofG2Q&feature=player_embedded&as=s';
$host = parse_url($url);
print_r($host);
$param = explode("&", $host['query']);
foreach($param as $p)
if($p[0]=='v')
$cod = str_replace("v=", '', $p);