This file contains 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 | |
for i in *.jpg | |
do | |
convert -thumbnail 120x120 $i ${i/.jpg/.thumb.jpg} | |
done |
This file contains 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 | |
abstract class Automovel | |
{ | |
// template method - design pattern | |
final public function viaja(IntegerObject $km) | |
{ | |
$this->ligaAutomovel(); | |
$this->encheTanque(); | |
$this->anda($km); |
This file contains 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 | |
// based on http://snipplr.com/view.php?codeview&id=69588 | |
function unregister_globals() | |
{ | |
if (ini_get('register_globals') == 0) { | |
return; | |
} | |
$variables = array( |
This file contains 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
// License: MIT | |
// | |
// Long version | |
// | |
// function rndString(size) { | |
// var randomFloat = Math.random(), | |
// randomInt = Math.floor(randomFloat * 1E40), | |
// randomLongString = randomInt.toString(36), | |
// randomCuttedString = randomLongString.substr(0, size); | |
// return randomCuttedString.toUpperCase(); |
This file contains 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 | |
// php -S localhost:8080 routing.php | |
if (isset($_SERVER) && preg_match('/^\/?(public)/', $_SERVER['REQUEST_URI'])) { | |
return false; | |
} else { | |
include __DIR__ . '/index.php'; | |
} |
This file contains 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 [[ $(git diff --cached | \grep -P '^(\+\s*(console|debugger))') ]] | |
then | |
cat <<\EOF | |
Error: console found! | |
Maybe you want to try | |
# git commit --no-verify |
This file contains 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
# just run ;) | |
# cat file | python -mjson.tool > /dev/null |
This file contains 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 | |
node -e 'grunt=require("grunt");require("./Gruntfile")(grunt);console.log(Object.keys(grunt.config.data).join(" "))' |
This file contains 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
/*jslint node: true*/ | |
var grunt = require('grunt'), | |
gruntFile = require('./Gruntfile.js'), | |
task, | |
tasks; | |
gruntFile(grunt); | |
task = process.argv.length > 2 ? process.argv[2] : ''; |
This file contains 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 session_start(); ?> | |
<form action="/manda-email.php"> | |
<textarea name="texto">Gostaria de fazer um orçamento para os seguintes produtos: | |
<?php | |
if (isset($_SESSION['produtos'])) { | |
echo implode("\n", $_SESSION['produtos']); | |
} | |
?></textarea></form> |
OlderNewer