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() { | |
function baseConverter(number, base, desiredBase) { | |
var result; | |
function genericToDec (n, dB) { | |
return parseInt(n, dB); | |
} | |
function decToGeneric (n, dB) { |
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.prototype.cached = function() { | |
var self = this, //"this" refers to the original function | |
cache = {}; //our local, lexically scoped cache storage | |
return function(args) { | |
if(args in cache) return cache[args]; | |
return cache[args] = self(args); | |
}; | |
}; | |
Math.sin = Math.sin.cached(); |
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
// The magic | |
console.log(new Error().stack); | |
/* SAMPLE: | |
Error | |
at Object.module.exports.request (/home/vagrant/src/kumascript/lib/kumascript/caching.js:366:17) | |
at attempt (/home/vagrant/src/kumascript/lib/kumascript/loaders.js:180:24) | |
at ks_utils.Class.get (/home/vagrant/src/kumascript/lib/kumascript/loaders.js:194:9) | |
at /home/vagrant/src/kumascript/lib/kumascript/macros.js:282:24 |
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 reportError(error, message) { | |
message = message || ''; | |
console.error( | |
'ERROR: ' + message + ' [' + error.toString() + ']\n' + | |
'\nName:\t\t' + (error.name || '-') + | |
'\nMessage:\t' + (error.message || '-') + | |
'\nFile:\t\t\t' + (error.fileName || '-') + | |
'\nSource:\t\t' + ((error.toSource && error.toSource()) || '-') + | |
'\nLine #:\t\t' + (error.lineNumber || '-') + | |
'\nColumn #:\t' + (error.columnNumber || '-') + |
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 () { | |
// pobieramy wszystkie formularze na stronie | |
var forms = document.querySelectorAll('form'); | |
// pobieramy wszystkie pola formularzy na stronie | |
var inputs = document.querySelectorAll('.form__content__input'); | |
var isFilledClass = 'is-filled'; | |
// konwertujemy obiekt typu HTML NodeList do obiektu typu tablicowego | |
forms = Array.prototype.slice.call(forms); | |
inputs = Array.prototype.slice.call(inputs); |
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
UPDATE `sample_table` | |
SET city = CONCAT(UCASE(LEFT(city, 1)), | |
SUBSTRING(LCASE(city), 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
var map = Array.prototype.map; | |
var result = map.call("Hello World", function(x) { return x; }); |
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
HTMLDocument.prototype.ready = function () { | |
return new Promise(function(resolve, reject) { | |
if (document.readyState === 'complete') { | |
resolve(document); | |
} else { | |
document.addEventListener('DOMContentLoaded', function() { | |
resolve(document); | |
}); | |
} | |
}); |
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
; Maximum size of POST data that PHP will accept. | |
post_max_size = 256M | |
; Maximum allowed size for uploaded files. | |
upload_max_filesize = 256M | |
; Maximum execution time of each script, in seconds | |
max_execution_time = 600 | |
; Maximum amount of time each script may spend parsing request data |
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 parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
OlderNewer