Skip to content

Instantly share code, notes, and snippets.

View codeandcats's full-sized avatar

Benji codeandcats

  • Australia
View GitHub Profile
@codeandcats
codeandcats / array.d.ts
Last active October 16, 2025 06:49
Array.filter(Boolean)
declare global {
interface Array<T> {
filter(predicate: typeof Boolean): Exclude<T, undefined | null | false | 0 | ''>[]
}
}
export default global
@codeandcats
codeandcats / fps.ts
Created July 19, 2020 05:18
FPS Counter (Frames Per Second)
export class FpsCounter {
constructor(private maxSamples: number = 100) {}
private samples: number[] = [];
sample() {
this.samples.push(Date.now());
if (this.samples.length > this.maxSamples) {
this.samples.shift();
}
@codeandcats
codeandcats / keybindings.json
Last active April 29, 2019 23:09
VSCode Custom Key Bindings
[
{
"key": "cmd+enter",
"command": "workbench.action.terminal.focus",
"when": "!terminalFocus"
},
{
"key": "cmd+enter",
"command": "workbench.action.terminal.toggleTerminal",
"when": "terminalFocus"
@codeandcats
codeandcats / AutoHotKey.ahk
Last active June 22, 2016 08:07
AutoHotKey file to simulate common OSX shortcuts in Windows
; Force AHK to replace already running instance of this script with newer version if script is opened again while already running
#SingleInstance force
; --------------- Windows ---------------
; Win+Tab = Alt+Tab
<#Tab::AltTab
>#Tab::AltTab
; --------------- Navigation ---------------