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 ($) { | |
"use strict"; | |
var wnd = $(window), | |
lastScrollTop = wnd.scrollTop(), | |
lastScrollLeft = wnd.scrollLeft(); | |
wnd.on("scroll", function (event) { | |
var scrollTop = wnd.scrollTop(), | |
scrollLeft = wnd.scrollLeft(), |
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
// check<Service>Status([ onSuccess, onFailure ]); | |
// i.e checkTaringaStatus(function () { alert('+10'); }); | |
(function () { | |
var checkServiceStatus = function (image, success, error) { | |
return function (success, error) { | |
var img = new Image(); | |
img.onload = success || function () {}; | |
img.onerror = error || function () {}; | |
img.src = image; | |
}; |
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
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char *argv[]) | |
{ | |
char *p = malloc(1024); | |
int l[10], j = 0, i = 0; | |
while (argv[1][i]) { | |
switch (argv[1][i++]) { |
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
<? $a='<? $a=\'%s\';printf($a,addslashes($a));';printf($a,addslashes($a)); |
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
$('body').on('submit', 'form.ajax', function () { | |
var form = $(this); | |
$.ajax({ | |
type: form.attr('method') || 'GET', | |
url: form.attr('action') || location.href, | |
data: form.serialize(), | |
success: function (data, textStatus, jqXHR) { | |
form.trigger('success', [data, textStatus, jqXHR]); | |
}, |
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 | |
/** | |
* Checks if a value exists in an array | |
* | |
* @param array $haystack | |
* @param mixed $needle | |
* @param bool $strict | |
* @return bool | |
*/ |
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 [ -z "$1" ] | |
then | |
echo "Usage $0 <token> [ip]" | |
exit | |
fi | |
if [ -n "$2" ] | |
then |
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 | |
class IDateTime extends \DateTime | |
{ | |
public function __construct($time = 'now', $timezone = null) | |
{ | |
if ($time === null || $time === 'now') { | |
$ts = microtime(true); | |
$micro = sprintf('%06d',($ts - floor($ts)) * 1000000); | |
$time = date('Y-m-d H:i:s.' . $micro, $ts); |
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 | |
class ObjectId | |
{ | |
/** @var string */ | |
private $value; | |
/** | |
* @param string $value | |
*/ |
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 | |
/** | |
* @param int $seconds | |
* @return string | |
*/ | |
function duration($seconds) | |
{ | |
foreach (['wk' => 604800, 'day' => 86400, 'hr' => 3600, 'min' => 60, 'sec' => 1] as $symbol => $subunit) { | |
$value = (int) floor($seconds / $subunit); |
OlderNewer