Skip to content

Instantly share code, notes, and snippets.

@alyti
alyti / bookmarklet
Last active April 3, 2024 20:44
Download mods from ageofempires.com
javascript:(function() {
let id = parseInt(location.pathname.match("([0-9]{1,5})")[0], 10); if (id === NaN) {return};
fetch("https://api.ageofempires.com/api/v1/mods/Download", {"credentials": "include", "headers": { "Content-Type": "application/json" }, "body": JSON.stringify({id, boolValue: true}), "method": "POST", "mode": "cors"}).then(r => r.json()).then(r => {location.href = r.value.downloadUrl}).catch(e => console.log(e));
})()
@fatcerberus
fatcerberus / monads4all.md
Last active February 24, 2024 07:58
Monads for the Rest of Us

Monads for the Rest of Us

by Bruce Pascoe - 1 May, 2019

"A monad is just a monoid in the category of endofunctors. What's the problem?" ~James Iry[^1]

The problem... is that there are several problems.

It's been said that monads bear a dreadful curse. Once you finally understand what they are, you begin to see them everywhere--but somehow become completely incapable of explaining them to anyone else. Many tutorial writers have tried to break the Great Curse--the Web is lousy with bold attempts and half successes that attest to this--and just as many have failed. Well, I'm here to address the elephant in the room[^2] and tell you that I intend to break the Great Curse once and for all.

There are basically two ways a monad tutorial tends to go. One is a paragraph or two of minimal descriptions of one or two common monads (Haskell's Maybe in particular is very popular), followed by a lot of intimidating Haskell syntax trying to explain--precisely--how it all fits together. This is well

@sibelius
sibelius / webpack+4.23.0.patch
Created January 18, 2019 13:44
Webpack 4.23.0 patch to make import eager instead of lazy to make wp4 development mode faster
patch-package
--- a/node_modules/webpack/lib/dependencies/ImportParserPlugin.js
+++ b/node_modules/webpack/lib/dependencies/ImportParserPlugin.js
@@ -28,7 +28,8 @@ class ImportParserPlugin {
const param = parser.evaluateExpression(expr.arguments[0]);
let chunkName = null;
- let mode = "lazy";
+ // let mode = "lazy";
+ let mode = "eager";
@G-Rath
G-Rath / definitions.ts
Last active May 6, 2019 23:43
useful typescript types & files
/*
Lets you extract the properties of an interface that are of a specific type,
such as "this parameter takes the name of any propert of T that maps to a string value".
See "groupObjectsByProperty.ts" for an example.
*/
// region ExtractPropertiesOfType
type FilterFlags<O, T> = { [K in keyof O]: O[K] extends T ? K : never };
type AllowedNames<O, T> = FilterFlags<O, T>[keyof O];
@bdwyertech
bdwyertech / wsl_chefdk.ps1
Last active April 21, 2022 09:52
Windows Subsystem for Linux - ChefDK
# Update to Latest Windows 10 Spring Refresh
# Install WSL
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
# Get Ubuntu installed - https://docs.microsoft.com/en-us/windows/wsl/install-on-server
wsl.exe
# Install ChefDK deb package
@SimonMeskens
SimonMeskens / Setting up TS for Node.md
Last active April 22, 2019 09:44
TypeScript Guides

Setting up TS for Node

tsconfig.json:

{
    "compilerOptions": {
        "module": "commonjs",
        "moduleResolution": "node",
        "target": **TARGET**,
 ...
@joshschmelzle
joshschmelzle / remove-gamebar-powershell-win10.md
Last active April 3, 2024 14:09
How to Remove the Xbox Game Bar with Powershell on Windows 10

You've probably stumbled upon this researching how to remove the Xbox Game Bar. This gist includes a few different methods you can try. Please note that some of these first options are probably not be available unless you are running an older version of Windows 10.

Uninstalling/Removing the Game Bar (old Windows 10 build GUI options)

(this is no longer an option on any recent Windows 10 build)

  1. Press Windows Key or click on the Start menu.
  2. Start typing Xbox or Game Bar, until you get the Xbox Game Bar app to appear in the results.
  3. Right-click on the app and pick Uninstall. Answer Yes to the prompt, and wait for the process to finish.
/// <reference path="typings/node/node.d.ts" />
/// <reference path="typings/typescript/typescript.d.ts" />
import ts = require("typescript");
import fs = require("fs");
import path = require("path");
function transform(contents: string, libSource: string, compilerOptions: ts.CompilerOptions = {}) {
// Generated outputs
var outputs = [];