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(isNode) { | |
'use strict'; | |
var Public = function(options) { | |
// Public() -> new Public() | |
if (!(this instanceof Public)) |
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 strtotime_months($num, $timestamp = null) { | |
$num = (int)$num; | |
$timestamp = $timestamp ? (int)$timestamp : time(); | |
$result = strtotime("last day of $num month", $timestamp); | |
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
var http = require('http'), | |
url = require('url'), | |
querystring = require('querystring'); | |
search('filetype:php', 0, handler); | |
function handler(word, page, addreses) { | |
var regex = /<b>warning<\/b>:\s*(.*?)<br \/>/mgi, |
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
SELECT ROUND(2.5); /* 3 */ | |
SELECT ROUND('2.5'); /* 2 */ | |
SELECT ROUND(1.5); /* 2 */ | |
SELECT ROUND('1.5') /* 2 */ | |
SELECT ROUND(0.5); /* 1 */ | |
SELECT ROUND('0.5') /* 0 */ | |
SELECT ROUND( |
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
'string'.substr(-2); // 'ng' (IE <= 9 returns 'string') | |
'string'.slice(-2); // 'ng' (all browsers) |
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
guess(0, 255, function(num, query) { | |
query(confirm('x > ' + num)); | |
}, function(num) { | |
document.write('Number is ' + num); | |
}); |
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
// Timestamp | |
parseInt(new Date()/1000); // 1316009556 |
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
str2argv( 'name(password), long(8, 16), error(Password incorrect)' ); | |
// { "name": ["password"], "long": [8, 16], "error": ["Password incorrect"] } | |
str2argv( 'one(hello), two(8.698), three( false , "9.6" , 5,), one(world)' ); | |
// { "one": ["world"], "two": [8.698], "three": [false, "9.6", 5, null] } | |
str2argv( 'numbers(5 , 8)' )['numbers']; // [5, 8] | |
str2argv( 'nullnumber(,6)' )['nullnumber']; // [null, 6] | |
str2argv( 'nullnumber( ,6)' )['nullnumber']; // [null, 6] | |
str2argv( 'null( )' )['null']; // [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
// Desplazar array | |
var x = ['a', 'b', 'c', 'd']; | |
x.push(x.shift()); // ['d', 'b', 'c', '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
// Último elemento | |
var x = 'a,b,c,d'; | |
x.split(',').pop(); // d |
NewerOlder