Skip to content

Instantly share code, notes, and snippets.

@disco0
disco0 / userscript.code-snippets
Created December 19, 2020 04:22
Userscript Meta TextMate Snippet
{
"Userscript Meta":
{
"description": "Userscript meta heading",
"prefix": "!meta",
"scope": "typescript,javascript",
"body":
[
"// ==UserScript==",
"// @name ${1}",
@disco0
disco0 / index.ts
Created December 18, 2020 12:08
TypeScript - Callable Constructor Wrapper
const samples: any[] = [];
//#region Components
class Point2DClass
{
constructor(public x: number, public y: number) { }
toString(): string { return `x: ${this.x}\ny: ${this.y}` }
}
console.delayLog = function(delayMs, message) {
var style =
"color: rgb(249, 162, 34);" +
"font-size: 60px;" +
"font-weight: bold;" +
"text-shadow: 1px 1px 5px rgb(249, 162, 34);" +
"filter: dropshadow(color=rgb(249, 162, 34), offx=1, offy=1);";
setTimeout(function() {
console.log(message, style);
}, delayMs);
@disco0
disco0 / metamethods.md
Last active December 1, 2020 04:10 — forked from thibaultcha/metamethods.txt
Lua metamethods Compatibility

via Sean Conner on lua-l

Metamethod 5.1 5.2 5.3 Syntax Notes
__add ✔️ ✔️ ✔️ a + b
__sub ✔️ ✔️ ✔️ a - b
__mul ✔️ ✔️ ✔️ a * b
__div ✔️ ✔️ ✔️ a / b
__mod ✔️ ✔️ ✔️ a % b
__pow ✔️ ✔️ ✔️ a ^ b
@disco0
disco0 / monaco-appendActions.js
Created November 24, 2020 03:08
Monaco Editor - Text Append + Editor Action Enumeration Example
/**
* For use with [Monaco Editor Playground](https://microsoft.github.io/monaco-editor/playground.html),
* otherwise monaco must be loaded via import or another method
*/
//#region Initialize
//#region Document Intial Text
let jsCode = /* js */ `
@disco0
disco0 / Update-mpvWindowsBuild-DesktopEdition.ps1
Created November 18, 2020 10:01
mpv-player-windows Build Updater
#Requires -PSEdition Desktop
#Requires -Module 7Zip4Powershell
<#
.SYNOPSIS
Download and install the latest available mpv Windows build
.DESCRIPTION
Script can either be invoked directly for an immeditate update with default
configuration or sourced to access the component functions. Currently only 64 bit builds
are enumerated, but the urls can be easily switched in `Get-Latestx64mpvWinBuildUrl`
@disco0
disco0 / index.pug
Last active November 17, 2020 06:00 — forked from zeddash/index.pug
Footer blobs #codepen
-
var base = 2,
exp = 8,
listEnts = false;
div.main
div.footer
div.bubbles
-
for (var i = 0; i < Math.pow(base, exp); i++) //Small numbers looks nice too
@disco0
disco0 / index.ts
Last active October 27, 2020 05:16
TypeScript - Async Constructor Workaround Example
/**
* Original code from [comment in microsoft/TypeScript issue #13355](https://github.com/microsoft/TypeScript/issues/13355#issuecomment-313847099)
*/
function loooooongTask() {
return new Promise<string>(resolve => {
setTimeout(() => {
resolve("world");
}, 3000);
})
/**
* Extension: fabiospampinato.vscode-highlight
* For use in user's main/project settings file (settings.json).
*/
{
// ...
// @region Decorators / Styling
// Highlight Decorator - highlight.options
"highlight.maxMatches": 500,
"highlight.decorations": { "rangeBehavior": 1 },
@disco0
disco0 / GM_download_emu.user.js
Last active October 21, 2020 12:27 — forked from derjanb/GM_download_emu.user.js
GM_download Alternate
// ==UserScript==
// @name GM_download emulation
// @namespace http://tampermonkey.net/
// @version 0.1
// @description emulate GM_download functionality
// @require https://github.com/eligrey/FileSaver.js/blob/master/dist/FileSaver.min.js
// @grant GM_xmlhttpRequest
// @copyright 2014, Jan Biniok
// ==/UserScript==