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
/** | |
* Very simple way to check if a file exists on this domain. | |
* Use with the jQuery library. | |
* | |
* Important: Works only on the same domain. | |
* Cross-domain-requests have to be done in another way (see JSONP)! | |
* | |
* Use: console.log( "/data/list.json".fileExists() ); | |
*/ | |
String.prototype.fileExists = function() { |
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
SELECT ca.* , | |
(SELECT count(u.id) | |
FROM psd_user_event u | |
WHERE u.periodoEscolhido = 'manhã' and u.idEvento = ca.id) as totalUsersManha, | |
(SELECT count(u.id) | |
FROM psd_user_event u | |
WHERE u.periodoEscolhido = 'tarde' and u.idEvento = ca.id) as totalUsersTarde | |
FROM psd_calendario ca | |
group by ca.id |
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
if ($.browser.mozilla) { | |
$('.tag').css({ | |
'background-position': 'center 0px', | |
'-moz-transition': 'all 1500ms ease' | |
}) | |
} else { | |
$('.tag').animate({ | |
'background-position-y': 0 | |
}, 1500); | |
} |
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 | |
class Pager | |
{ | |
public $path; | |
public $page = 1; | |
public $perPage = 15; | |
public $offset; | |
public $totalPages; |
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
public static function containString($string, $maxLength, $append = "...") { | |
if(strlen($string) <= $maxLength) { | |
return $string; | |
} | |
$lastPos = strrpos(substr($string, 0, $maxLength), " "); | |
$lastPos or $lastPos = $maxLength; | |
return substr($string, 0, $lastPos).$append; | |
} |
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 | |
$result= array( | |
array('id'=>1, 'name'=>'teste 1', 'date'=>'2013-03-15'), | |
array('id'=>2, 'name'=>'teste 2', 'date'=>'2013-03-16'), | |
array('id'=>3, 'name'=>'teste 3', 'date'=>'2013-03-17'), | |
array('id'=>4, 'name'=>'teste 4', 'date'=>'2013-03-18'), | |
array('id'=>5, 'name'=>'teste 5', 'date'=>'2013-03-19'), | |
array('id'=>6, 'name'=>'teste 6', 'date'=>'2013-03-20'), | |
array('id'=>7, 'name'=>'teste 7', 'date'=>'2013-03-21'), | |
array('id'=>8, 'name'=>'teste 8', 'date'=>'2013-03-22'), |
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 | |
function scriptAjax($id_form, $resposta){ | |
?> | |
<script type="text/javascript"> | |
var $jquery = jQuery.noConflict(); | |
$jquery(document).ready(function($) { | |
$('#<?php echo $id_form; ?>').submit(function(e) { | |
e.preventDefault(); | |
var img = "<img src='<?php bloginfo('template_url'); ?>/images/ajax-loader.gif' alt='Aguarde...' />"; |
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 | |
function dateTimeDiff($date1, $date2) { | |
$alt_diff = new stdClass(); | |
$alt_diff->y = floor(abs($date1->format('U') - $date2->format('U')) / (60*60*24*365)); | |
$alt_diff->m = floor((floor(abs($date1->format('U') - $date2->format('U')) / (60*60*24)) - ($alt_diff->y * 365))/30); | |
$alt_diff->d = floor(floor(abs($date1->format('U') - $date2->format('U')) / (60*60*24)) - ($alt_diff->y * 365) - ($alt_diff->m * 30)); | |
$alt_diff->h = floor(floor(abs($date1->format('U') - $date2->format('U')) / (60*60)) - ($alt_diff->y * 365*24) - ($alt_diff->m * 30 * 24 ) - ($alt_diff->d * 24) ); | |
$alt_diff->i = floor(floor(abs($date1->format('U') - $date2->format('U')) / (60)) - ($alt_diff->y * 365*24*60) - ($alt_diff->m * 30 * 24 *60) - ($alt_diff->d * 24 * 60) - ($alt_diff->h * 60) ); | |
$alt_diff->s = floor(floor(abs($date1->format('U') - $date2->format('U'))) - ($alt_diff->y * 365*24*60*60) - ($alt_diff->m * 30 * 24 *60*60) - ($alt_diff->d * 24 * 60*60) - ($alt_diff->h * 60*60) - ($alt_diff->i * 60) ) |
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
function(){ | |
var alertTpl = Handlebars.compile($("#alert-tpl").html()); | |
$.fn.alertIntra = function(message, _class){ | |
_class = _class || "alert-info"; | |
var icon_class = "icon-info-sign"; | |
if(_class == "alert-warning"){ | |
icon_class = "icon-exclamation-sign"; | |
}else if(_class == "alert-error"){ |
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
var formData = new FormData() || false; | |
$.fn.uploadIntra = function(callback){ | |
var elem = $(this).get(0); | |
var i = 0, | |
len = elem.files.length, | |
reader, file; | |
for ( ; len--; i++ ) { | |
file = elem.files[i]; |