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 | |
for($i = 1; $i <= 100; $i++){ | |
$print = $i % 3 ? 'Fizz' : ''; | |
if($i % 5) $print .= 'Buzz'; | |
echo '<p>'.(empty($print) ? $i : $print).'</p>'; | |
} |
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 lang="pt-Br"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<style> | |
table { | |
border: none; | |
} |
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
ifdef SUDO_USER | |
USER=$(SUDO_USER) | |
endif | |
INSTALL=apt-get install -y | |
INSTALL_LIB=$(INSTALL) lib$(1)-dev | |
REMOVE = \ | |
apt-get purge -y $(1)*; \ |
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 | |
ini_set('date.timezone','America/Sao_Paulo'); | |
class DateFormatter extends DateTime | |
{ | |
private $parts = array( | |
array(31104000, 'ano', 'anos'), | |
array(2592000, 'mês', 'meses'), | |
array(86400, 'dia', 'dias'), |
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
#!/bin/bash | |
if [ ! -d './downloaded_tweets' ]; then | |
mkdir downloaded_tweets | |
if [ ! -d './downloaded_tweets' ]; then | |
echo "Can't create output dir." > /dev/stderr | |
exit 1 | |
fi | |
fi | |
cd downloaded_tweets |
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
#!/bin/bash | |
decode() { | |
to_decode='s:%([0-9A-Fa-f][0-9A-Fa-f]):\\x\1:g' | |
printf "%b" `echo $1 | sed 's:&:\n:g' | grep "^$2" | cut -f2 -d'=' | sed -r $to_decode` | |
} | |
data=`wget http://www.youtube.com/get_video_info?video_id=$1\&hl=pt_BR -q -O-` | |
url_encoded_fmt_stream_map=`decode $data 'url_encoded_fmt_stream_map' | cut -f1 -d','` | |
signature=`decode $url_encoded_fmt_stream_map 'sig'` | |
url=`decode $url_encoded_fmt_stream_map 'url'` | |
test $2 && name=$2 || name=`decode $data 'title' | sed 's:+: :g;s:/:-: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
<!DOCTYPE HTML> | |
<html lang="pt-BR"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<form action="" method="get"> | |
<fieldset> | |
<legend>Busca de CEP do Correio Control</legend> |
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
# program to remove a leading UTF-8 BOM from a file | |
# works both STDIN -> STDOUT and on the spot (with filename as argument) | |
if ($#ARGV > 0) { | |
print STDERR "Too many arguments!\n"; | |
exit; | |
} | |
my @file; # file content | |
my $lineno = 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
#!/bin/bash | |
if [ ! -d /opt/Sublime* ]; then | |
if [ ! -f $HOME/Downloads/Sublime*.bz2 ]; then | |
echo "Ops! You must visit http://www.sublimetext.com/ and download the *.bz2 file to $HOME/Downloads." | |
exit | |
else | |
echo 'Installing Sublime Text...' | |
sudo mv $HOME/Downloads/Sublime*.bz2 /opt |
OlderNewer