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" |
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
<?php | |
define('_JEXEC', 1); | |
define('JPATH_BASE', dirname(__FILE__)); | |
require_once(JPATH_BASE . '/includes/defines.php'); | |
require_once(JPATH_BASE . '/includes/framework.php'); | |
echo "<strong>Password: </strong>" . JUserHelper::hashPassword('adam'); | |
?> |
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 | |
define( '_JEXEC', 1 ); | |
define('JPATH_BASE', dirname(__FILE__) ); | |
define( 'DS', DIRECTORY_SEPARATOR ); | |
/* Required Files */ | |
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); | |
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); | |
$app = JFactory::getApplication('site'); |
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 | |
/** | |
* Joomla! External authentication script | |
* | |
* @author vdespa | |
* Version 1.0 | |
* | |
* Code adapted from /index.php | |
* | |
* @package Joomla.Site |
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)); |
OlderNewer