Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Cauterite's full-sized avatar

Cauterite Cauterite

  • Australia
View GitHub Profile
@Cauterite
Cauterite / aaa
Created April 14, 2019 08:16
aaa
DOMParser error detection test suite
userAgent: "Mozilla/5.0 (Android 7.1.2; Mobile; rv:66.0) Gecko/66.0 Firefox/66.0"
running 2606 tests
2606/2606 tests passed
const chAt = ``.charCodeAt;
const parseArrayIndex = function(s) {
/* assumes s is a string
if s is a valid index, returns parseInt(s)
otherwise returns some negative integer
s is valid if:
/^(0|[1-9][0-9]*)$/.test(s) && 0 <= parseInt(s) <= 0x7fffffff
@Cauterite
Cauterite / ext-all-debug.js
Created November 12, 2017 11:10
ext-all-debug.js (Deluge Web UI)
This file has been truncated, but you can view the full file.
/**
* @class Ext.DomHelper
* Utility class for working with DOM and/or Templates. It transparently supports using HTML fragments or DOM.<br>
* This is an example, where an unordered list with 5 children items is appended to an existing element with id 'my-div':<br>
<pre><code>
var dh = Ext.DomHelper;
var list = dh.append('my-div', {
id: 'my-ul', tag: 'ul', cls: 'my-list', children: [
{tag: 'li', id: 'item0', html: 'List Item 0'},
{tag: 'li', id: 'item1', html: 'List Item 1'},
(() => {
var f, g;
var x = 1;
f = () => x;
var x = 2;
g = () => x;
console.log(`f(): ${f()}`); // 2
console.log(`g(): ${g()}`); // 2
})();
data:application/x-ns-proxy-autoconfig,function%20FindProxyForURL()%20{return%20"HTTPS%20example.com:3128;";}
$(`.form_datetime`).on(`dp.change`, X =>
$(`#epoch-start-time`).val(X.date.unix()));
--------------------------------------------------------------------------------
my ASUS P5Q-Premium, running Debian 8.8, has four ethernet ports. i only need to
use one at a time.
the labels "eth0", "eth1", etc. are assigned to these ports in seemingly random
order, and whether the numbering starts at 0 or 1 seems to be determined by the
presence of some other random PCI device present on the board, so it's hard to
know which eth# you're plugging the cable into.
set-strictmode -version 'latest'
$erroractionpreference = 'stop'
function main() {
$a = 'foo'
$f = {
$g = {$a}.getnewclosure()
& $g # "variable '$a' cannot be retrieved because it has not been set."
}.getnewclosure()
& $f
function a($f) {& $f}
function main() {
$f = {write-host 'success'}
a {& $f} # stack-overflow
a {& $f}.getnewclosure() # okay
}
[void] (main)
# ------------------------------------------------------------------------------
# Leopard Systems ? (2017)
# contributors: Adam Laing
# note: requires powershell 2.0 or later
set-strictmode -version 'latest'
$erroractionpreference = 'stop'