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
<pre> | |
<?php | |
/** | |
* A simple PHP .htpasswd and .htaccess generator | |
* If already present, .htpasswd is overwrittern but .htaccess is prepended with Access clousure if not found | |
* | |
* @author Krzysztof Przygoda, 2018 | |
* @version 1.0 | |
*/ |
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 SimpleXMLElementExtended extends SimpleXMLElement | |
{ | |
/** | |
* Removes or keeps nodes with given attributes | |
* | |
* @param string $attributeName | |
* @param array $attributeValues | |
* @param bool $keep TRUE keeps nodes and removes the rest, FALSE removes nodes and keeps the rest | |
* @return integer Number o affected nodes |
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 | |
abstract class Json | |
{ | |
public static function getLastError($asString = FALSE) | |
{ | |
$lastError = \json_last_error(); | |
if (!$asString) return $lastError; | |
// Define the errors. |
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
/* | |
Embracing iOS WebKit weirdness with iframes | |
**iOS WebKit iframe bug description**: | |
https://bugs.webkit.org/show_bug.cgi?id=155198 | |
**My current findings**: | |
1. iOS WebKit resizes iframes to the full size of their content - it's a bug known since 2016 and still not resolved in iOS 11. | |
2. To fit iframe contents, its div container must have w/h defined in pixels - any relative measures (like %, vw/vh) doesn't work. |
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
// Based on: http://bonsaiden.github.io/JavaScript-Garden/#types | |
var types = [ | |
{n: 'Array', c: Array, o: []}, | |
{n: 'new Array', c: Array, o: new Array()}, | |
{n: 'String', c: String, o: ''}, | |
{n: 'new String', c: String, o: new String()}, | |
{n: 'Number', c: Number, o: 0}, | |
{n: 'new Number', c: Number, o: new Number()}, | |
{n: 'Function', c: Function, o: function(){}}, | |
{n: 'new Function', c: Object, o: new function(){}}, |