Skip to content

Instantly share code, notes, and snippets.

@thecodewarrior
thecodewarrior / Log binding benchmark.md
Last active January 4, 2024 01:19
Benchmark for different console.log.bind() styles - https://jsbench.me/wxlqydjuo0/1

These are various ways of supporting prefixed logs while preserving line numbers and allowing custom additions to the format string. The importance of the custom format string is that if you wanted to do custom css, using a plain console.log.bind() wouldn't work, since you need %c to apply css, and that must occur in the first parameter.

// plaintext
console.log.bind("%cwarn%c >", "color: yellow", "")("something")
// trying to use a format string in the bound method doesn't work
console.log.bind("%cwarn%c >", "color: yellow", "")("%c%s", "color: red", "RED!")
// appending the format string to the first argument does
@thecodewarrior
thecodewarrior / CurseForgeDownloadScraper.js
Last active August 17, 2024 04:57
CurseForge download scraper
// ==UserScript==
// @name CurseForge mod download scraper
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Scrapes the download count from CurseForge mod pages
// @author You
// @match https://www.curseforge.com/minecraft/mc-mods/*
// @match https://authors.curseforge.com/dashboard
// @match https://authors.curseforge.com/dashboard/projects
// @icon https://www.google.com/s2/favicons?domain=curseforge.com
@thecodewarrior
thecodewarrior / AutoTwitchBonus.js
Last active May 30, 2024 15:15
Automatically collect channel bonus points
// ==UserScript==
// @name Auto Twitch Bonus
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Automatically collect channel points
// @author thecodewarrior
// @match https://www.twitch.tv/*
// @downloadURL https://gist.githubusercontent.com/thecodewarrior/00e5654956eee23fcc2e8baae634ad2c/raw/AutoTwitchBonus.js
// ==/UserScript==
@thecodewarrior
thecodewarrior / App Icon Template.svg
Last active December 14, 2024 13:42
An SVG template for creating macOS app icons, including guides and the standard drop shadow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thecodewarrior
thecodewarrior / comparison.gif
Last active March 1, 2023 10:23
CurseForge logo SVG
comparison.gif
@thecodewarrior
thecodewarrior / BeeMovieAllDay.java
Last active August 10, 2018 08:45
What would happen if every identifier was the bee movie? 🤔
// take every occurance of `zz` and replace it with the entirety of the bee
// movie script, which every non-alphanumeric character replaced with `_`
// the end result is below, which compiles and runs despite the ludicrous names
public class BeeMovieAllDay {
public static void main(String[] zz) {
BeeMovieAllDay zz1 = new BeeMovieAllDay();
zz1.zz3();
}
@ durak > Also using Arch in an office sounds like an IT disaster.
> Just wait until pacman breaks something right before a major deadline.
> Also they can't make anyone set up Arch on their own time, can they?
> So they're just wasting company money.
> It'd be cheaper to buy everyone MacBooks than pay engineers for a week to get Arch all set up
@ Jay > yeah it actually would
> hell, windows 98 would be more safe than arch
> or any other linux distro
@ veksen > It's no mystery that companies just handout Macbooks
> shit just works
#!/usr/bin/env python
# copy into the gimp console until I make it any more proper
unifont_image = gimp.image_list()[0]
unifont_main_layer = unifont_image.layers[0]
print("Converting to RGB...")
pdb.gimp_image_convert_rgb(unifont_image)
pdb.gimp_image_resize(unifont_image, 4096, 4096, -32, -64)
import net.minecraftforge.gradle.user.TaskSourceCopy
import net.minecraftforge.gradle.user.patcherUser.forge.ForgeExtension
import net.minecraftforge.gradle.user.patcherUser.forge.ForgePlugin
import org.gradle.api.internal.HasConvention
import org.gradle.internal.impldep.bsh.commands.dir
import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel
import org.jetbrains.kotlin.contracts.model.structure.UNKNOWN_COMPUTATION.type
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
http://www.falstad.com/ripple/Ripple.html
the format for the import/export from text
$ 1 <resolution> <A> ? <wave type> <brightness> <scale factor>
// World start, each side is <resolution> units long
// <resolution>/<A> ~= 8
// 65.2*<scale factor> ~= world side length