Skip to content

Instantly share code, notes, and snippets.

View thinkverse's full-sized avatar
🦖

Kim Hallberg thinkverse

🦖
View GitHub Profile
@thinkverse
thinkverse / node-polyfill-fetch.js
Created April 24, 2023 20:55
A undici fetch Polyfill shamelessly ripped from Next.js
import Undici from "undici";
// Polyfill fetch() in the Node.js environment
// Simplified from https://github.com/vercel/next.js/blob/canary/packages/next/src/server/node-polyfill-fetch.ts
if (!global.fetch) {
function getFetchImpl() {
return Undici;
}
@thinkverse
thinkverse / bleet.json
Last active April 16, 2023 11:59
Bleet made with Rich Text
{
"text": "This bleet to @shinyakato.dev can be found on this Gist. 👍",
"facets": [
{
"index": { "byteStart": 14, "byteEnd": 29 },
"features": [
{
"$type": "app.bsky.richtext.facet#mention",
"did": "did:plc:iijrtk7ocored6zuziwmqq3c"
}
@thinkverse
thinkverse / gallery.css
Last active June 8, 2021 02:59
Single-line images gallery with `array_*` functions and `scandir`.
@thinkverse
thinkverse / generatePasswords.php
Created January 19, 2021 10:14
Useful snippet for generating quick random passwords
<?php
$keyspace = '123456789abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
$keyspaceLength = mb_strlen($keyspace, 'utf-8') - 1;
$numberOfPasswords = 8;
$numberOfChars = 16;
$passwords = [];
@thinkverse
thinkverse / ProductController.php
Created December 2, 2020 06:34
laravel-die-dump
class ProductController extends Controller
{
public function show(Request $request, string $product)
{
dd($product, $request);
}
}
@thinkverse
thinkverse / tailwind-v1.config.js
Last active July 12, 2023 12:12
Useful TailwindCSS config that saves paddings and margins upon build
// https://v1.tailwindcss.com/docs/controlling-file-size#purge-css-options
module.exports = {
future: {
removeDeprecatedGapUtilities: true,
purgeLayersByDefault: true,
},
purge: {
content: ['./public/**/*.html'],
options: {
whitelistPatterns: [
@thinkverse
thinkverse / git-understanding-qs.md
Created September 6, 2020 19:02 — forked from githubteacher/git-understanding-qs.md
Questions to check your understanding of some Git and GitHub concepts.

Beginner: Check for understanding

  1. (multiple answer) Git is:

    • a. A version control system
    • b. Centralized
    • c. Distributed
    • d. The same as GitHub
  2. (T/F) Git and GitHub are the same thing.

@thinkverse
thinkverse / TabComplete.java
Created March 14, 2020 16:22
Tab Complete
@Override
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
return (args.length == 1) ? Bukkit.getServer().getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList()) : Collections.emptyList();
}
@thinkverse
thinkverse / PotionCommand.java
Last active February 4, 2020 14:54
Spawn SplashPotion on Player
public final class PotionCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
final Player PLAYER = ((Player) sender).getPlayer();
final World WORLD = PLAYER.getWorld();
// Give player the Splash Potion.
// PLAYER.getInventory().addItem(makeSplashPotionItemStack(PotionType.INSTANT_HEAL, false, true));