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
function type() | |
{ | |
var str = text.substr(0, currentChar); | |
var last = str.substr(str.length -1, str.length); | |
if(last != '<' && last != '>' & last != '/') { | |
$("#consoleText").html(str); | |
} | |
currentChar++; | |
if(currentChar <= text.length) | |
{ |
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 | |
function calculate_score($votes, $item_hour_age, $gravity=1.8) { | |
return ($votes - 1) / pow(($item_hour_age+2), $gravity); | |
} |
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
<script language="javascript" type="text/javascript"> | |
var OSName="Unknown OS"; | |
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows"; | |
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS"; | |
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX"; | |
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux"; | |
document.write('Your OS: '+OSName); | |
</script> |
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 | |
$file = Validation::factory($_FILES); | |
$file->rules( | |
'curriculo', | |
array( | |
array(array('Upload', 'valid')), | |
array(array('Upload', 'not_empty')), | |
array('Upload::type', array(':value', array('jpg', 'png', 'gif'))) | |
) |
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
<IfModule mod_rewrite.c> | |
RewriteBase / | |
RewriteEngine On | |
# Check if mobile=1 is set and set cookie 'mobile' equal to 1 | |
RewriteCond %{QUERY_STRING} (^|&)mobile=1(&|$) | |
RewriteRule ^ - [CO=mobile:1:%{HTTP_HOST}] | |
# Check if mobile=0 is set and set cookie 'mobile' equal to 0 | |
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$) |
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
function validaCPF($cpf) { | |
$cpf = str_pad(ereg_replace('[^0-9]', '', $cpf), 11, '0', STR_PAD_LEFT); | |
if (strlen($cpf) != 11 || $cpf == '00000000000' || $cpf == '11111111111' || $cpf == '22222222222' || $cpf == '33333333333' || $cpf == '44444444444' || $cp | |
return false; | |
} else { | |
for ($t = 9; $t < 11; $t++) { | |
for ($d = 0, $c = 0; $c < $t; $c++) { | |
$d += $cpf{$c} * (($t + 1) - $c); |
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
if (preg_match('/(iphone|android|webos|blackberry|ipod|ipad|mobile)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) { | |
header('Location: http://m.site.com/index.php?id='.$HTTP_GET_VARS["id"]); | |
} |
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 defined('SYSPATH') or die('No direct script access.'); | |
class Form extends Kohana_Form{ | |
public static function select_from_model($name, array $collection, array $config = null , $selected = NULL, array $attributes = NULL) | |
{ | |
$base_config = 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
#!/bin/sh | |
echo 'gerando o dump dos bancos'; | |
mysqldump --all-databases -h 127.0.0.1 -u root > /tmp/dump.sql | |
echo 'compactando o dump'; | |
NOW=$(date +"%Y_%m_%d"); | |
zip "backup_db_$NOW.zip" /tmp/dump.sql | |
echo 'removendo arquivos temporários'; |
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 defined('SYSPATH') or die('No direct script access.'); | |
//ie session bug-fix | |
header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"'); | |
// -- Environment setup -------------------------------------------------------- | |
// Load the core Kohana class | |
require SYSPATH.'classes/Kohana/Core'.EXT; |
OlderNewer