Skip to content

Instantly share code, notes, and snippets.

@PaulBGD
PaulBGD / kofi-cleaner.js
Last active August 29, 2023 23:45
script to move out of stock ko-fi items to the end of the page
// ==UserScript==
// @name ko-fi cleaner
// @namespace Violentmonkey Scripts
// @match https://ko-fi.com/*/shop
// @grant none
// @version 1.0
// @author paulbgd
// @description 8/29/2023, 6:18:50 PM
// ==/UserScript==
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
@PaulBGD
PaulBGD / Model.ts
Created May 20, 2017 19:34
Some sort of routing system in an MVP (this is just MP) pattern
type Listener<T> = () => any;
type Canceller = () => void;
export interface Depends {
[key: string]: Model<any, any>;
}
abstract class Model<T, D extends Depends> {
private _listeners: Listener<T>[];
private _cancel: Canceller[]; // from old code, is this supposed to do something? maybe unload all data from a specific page?
@PaulBGD
PaulBGD / hacky-preact-inject.ts
Created June 10, 2016 19:45
Files required to use preact in typescript
/// <reference path="typings/preact.d.ts"/>
import {h} from 'preact';
export function createElement<P>(type: any, props?: P, ...children: any[]): any {
return h(type, props, children);
}
@PaulBGD
PaulBGD / .esconfig.json
Last active June 5, 2016 00:14
Vim Files
{
"indent": {
"value": " ",
"FunctionExpression": 1,
"ArrayExpression": 1,
"ObjectExpression": 1
},
"plugins": [
"esformatter-jsx"
],
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'itchyny/lightline.vim'
@PaulBGD
PaulBGD / connect-smart-redis.d.ts
Created January 4, 2016 00:27
TypeScript definition for the NPM module connect-smart-redis
/// <reference path="../express-session/express-session.d.ts" />
declare module 'connect-smart-redis' {
import Session = require('express-session');
module s {
interface SmartRedisOptions {
ttl: number;
client: any;
prefix?: string;
@PaulBGD
PaulBGD / client-api.tsx
Last active January 2, 2016 08:28
Easy Validation
/// <reference path="../../typings/tsd.d.ts" />
import {Router, Request, Response} from 'express';
import * as ArtisanValidator from 'artisan-validator';
import {DatabaseClient, DatabaseError} from '../database';
let ClientAPI: Router = Router();
let validator: ArtisanValidator.Validator = ArtisanValidator();
@PaulBGD
PaulBGD / artisan-validator.d.ts
Last active December 5, 2015 23:15
Artisan Validator TypeScript Definition + Example
/// <reference path="../bluebird/bluebird.d.ts" />
declare module ArtisanValidator {
class Validator<R> {
try(checking: any, rules: R): Promise<ValidatorResult<R>>;
validators: ArtisanValidator.Validators;
}
interface ValidatorResult<R> {
updateSelector() {
if (this.running) {
return this.selector.style.display = 'none';
}
let lines = this.lines;
let length = this.input.value.length;
if (!this.running) {
length += this.prefix.length;
}
length -= this.input.value.length - this.input.selectionStart;