I hereby claim:
- I am dan-lee on github.
- I am danlee (https://keybase.io/danlee) on keybase.
- I have a public key ASB-wIoYlALYLZ_eR0FSy77P3T4XfYIR5tfjmu6cRJ1KTAo
To claim this, I am signing this object:
export class ThrowingDate extends Date { | |
constructor(...args: ConstructorParameters<typeof Date>) { | |
super(...args) | |
const date = new Date(...args) | |
if (isNaN(+date)) { | |
throw new Error('Invalid date') | |
} | |
return date |
const zip = <A, B>(a: A[], b: B[]): Array<[A, B]> => a.map((k, i) => [k, b[i]]); |
const windows = <T>(array: T[], slice = 2): T[][] => | |
Array.from({ length: array.length - slice }).reduce<T[][]>((result, _, i) => { | |
return [...result, array.slice(i, slice + i)] | |
}, []) |
import NodeEnvironment from 'jest-environment-node' | |
export default class CustomTestEnvironment extends NodeEnvironment { | |
async setup() { | |
await super.setup() | |
;['atob', 'btoa', 'AbortSignal'].forEach((fn) => { | |
if (typeof this.global[fn] === 'undefined') { | |
this.global[fn] = global[fn] | |
} | |
}) |
const getAbsoluteHeight = el => { | |
const computedStyle = window.getComputedStyle(el) | |
return Math.ceil( | |
el.offsetHeight + | |
parseInt(computedStyle.getPropertyValue('margin-top'), 10) + | |
parseInt(computedStyle.getPropertyValue('margin-bottom'), 10) | |
) | |
} |
let getReplacement = char => | |
/[\s\n]/.test(char) ? char : String.fromCharCode(char.charCodeAt(0) - 1); | |
let deobfuscate = text => | |
text | |
.trim() | |
.split('') | |
.reduce((prev, curr) => prev + getReplacement(curr), ''); | |
I hereby claim:
To claim this, I am signing this object:
--- ext/dom/node.c 2012-08-06 17:49:48.826716692 +0800 | |
+++ ext/dom/node.c 2012-08-06 17:52:47.633484660 +0800 | |
@@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNA | |
RETVAL_FALSE; | |
} else { | |
if (mode == 0) { | |
+#ifdef LIBXML2_NEW_BUFFER | |
+ ret = xmlOutputBufferGetSize(buf); | |
+#else | |
ret = buf->buffer->use; |