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 domReady = (function() { | |
var readyCallbacks = []; | |
function whenReady(callback) { | |
setTimeout(function() { | |
callback.call(document) | |
}); | |
} | |
function completed() { |
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
// Directly pass this as string | |
let xmlString = `<ern:NewReleaseMessage xmlns:ern="http://ddex.net/xml/ern/382" | |
MessageSchemaVersionId="ern/382" | |
LanguageAndScriptCode="en" | |
xs:schemaLocation="http://ddex.net/xml/ern/382 http://ddex.net/xml/ern/382/release-notification.xsd" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"></ern:NewReleaseMessage>`; | |
let parser = new DOMParser(); | |
let xmlDoc = parser.parseFromString(xmlString, "text/xml"); |
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 | |
BASE=$(dirname $(realpath $0))/.. | |
echo $BASE; |
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
/** | |
* Match request path with route style path. | |
* | |
* @param {string} reqpath The request path | |
* @param {string} routepath The route pattern path | |
* @return {Object|boolean} matches object if match or false if not match | |
* | |
*/ | |
function match(reqpath, routepath) { | |
if (reqpath === routepath) return {} |
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 base64url_encode($data) { | |
return $data ? rtrim(strtr(base64_encode($data), '+/', '-_'), '=') : ''; | |
} | |
function base64url_decode($data) { | |
return $data ? base64_decode(strtr((string)$data, '-_', '+/'), TRUE) : ''; | |
} |
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 | |
/** | |
* Run a single curl request | |
* | |
* @param string $url | |
* The url for request. | |
* @param array $options | |
* Map of options, expected key: | |
* - method string GET|POST|HEAD |
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 setInnerHTML(elm, html) { | |
elm.innerHTML = html; | |
elm.querySelectorAll("script").forEach(function(oldScriptEl) { | |
let newScriptEl = document.createElement("script"); | |
[].slice.call(oldScriptEl.attributes).forEach(function(attr) { | |
newScriptEl.setAttribute(attr.name, attr.value); | |
}); | |
newScriptEl.appendChild(document.createTextNode(oldScriptEl.innerHTML)); | |
oldScriptEl.parentNode.replaceChild(newScriptEl, oldScriptEl); | |
}); |
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
# cut video in middle | |
# In order to keep <start-15s> and <45s-end>, you need to | |
# keep all the frames which are "not between 15s and 45s": | |
ffmpeg -i input.mp4 \ | |
-vf "select='not(between(t,15,45))', setpts=N/FRAME_RATE/TB" \ | |
-af "aselect='not(between(t,15,45))', asetpts=N/SR/TB" \ | |
output.mp4 | |
#source https://stackoverflow.com/questions/64866231/remove-a-section-from-the-middle-of-a-video-without-concat |
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
<!DOCTYPE html> | |
<meta charset=utf-8> | |
<meta name=viewport content="width=device-width, initial-scale=1, minimal-ui"> | |
<title>Preact</title> | |
<div id=app> | |
<h1>Hello World!</h1> | |
<!-- comments --> | |
<p style="background-color: lime;">Preloading text...</p> | |
<p>Count = 0</p> |
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 to dump variables limited by depth and without circular issues. | |
* | |
* @param $thing The object. | |
* @param int $maxdepth Maximum depth to recurse. | |
* @param array $stack Stack to store the previous object. Ignore this. | |
* @param int $depth The current depth. Ignore this. |
NewerOlder