This is not an article.
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 myfunc(): number { | |
return 42; | |
} | |
const tmp = (false as true) && myfunc(); | |
type MyType = typeof tmp; // MyType is correctly number |
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
sleep 1500 && notify-send break |
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
const provider = Symbol(); | |
export function provide(key: symbol, value: any, ctx?: HTMLElement) { | |
const node: any = ctx || document.body; | |
let providers = node[provider]; | |
if (!providers) { | |
node[provider] = providers = {}; | |
node.addEventListener('di-provider', (event: CustomEvent) => { | |
event.detail.provider = providers[event.detail.key]; | |
event.preventDefault(); |
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
class Embree < Formula | |
homepage "http://embree.github.io/" | |
url "https://github.com/embree/embree/releases/download/v2.13.0/embree-2.13.0.x86_64.macosx.tar.gz" | |
sha256 "09107fa9cfb5f2a17f366d745e01e6bacaae20cd5e52dbb3aaf8579f4bbce302" | |
def install | |
lib.install Dir["lib/libembree.2.dylib"] | |
include.install Dir["include/*"] | |
system "ln", "-s", (lib/"libembree.2.dylib"), (lib/"libembree.dylib") | |
end |
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
export interface Empty {} | |
export interface Class<T> { | |
new(): T; | |
} | |
export type Super = Class<Empty>; | |
export interface Mixin<M, S> { | |
<T extends S>(s: Class<T>): Class<T & M>; |
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 b64encode(arr) { | |
return btoa(String.fromCharCode.apply(null, arr)); | |
} | |
function b64decode(str) { | |
return atob(str).split('').map(function (c) { return c.charCodeAt(0); }); | |
} |
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 seed = 1; | |
function random() { | |
var x = Math.sin(seed++) * 10000; | |
return x - Math.floor(x); | |
} |
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
# http://graphicdesign.stackexchange.com/questions/20908/how-to-remove-every-second-frame-from-an-animated-gif | |
gifsicle "$1" --unoptimize $(seq -f "#%g" 0 2 $numframes) -O2 -o "$2" |
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
<!-- Conditionally load WC polyfills --> | |
<script> | |
if ('registerElement' in document | |
&& 'createShadowRoot' in HTMLElement.prototype | |
&& 'import' in document.createElement('link') | |
&& 'content' in document.createElement('template')) { | |
// We're using a browser with native WC support! | |
} else { | |
document.write('<script src="/bower_components/webcomponentsjs/webcomponents.js"><\/script>'); | |
} |
NewerOlder