Skip to content

Instantly share code, notes, and snippets.

View sajmoni's full-sized avatar
🧑‍💻

Simon Lagos sajmoni

🧑‍💻
  • Unity Technologies
  • Sweden
View GitHub Profile
// TODO: Redo this
export const debouncedKey = (
key: Key,
callback: () => void,
debounceTime: number,
): (() => void) => {
let timer = debounceTime
const unsubscribe = tinykeys(
window,
@sajmoni
sajmoni / change-author.md
Created May 3, 2022 10:44
Change git author
git clone --bare https://github.com/user/repo.git
#!/bin/sh

git filter-branch --env-filter '
export type Ok<T> = {
type: 'Ok'
value: T
}
export type Error = {
type: 'Error'
message: string
}
import * as l1 from 'l1'
import * as PIXI from 'pixi.js'
let lastTimeStamp = null
app.ticker.add((deltaTime) => {
const before = performance.now()
l1.update(deltaTime)
@sajmoni
sajmoni / keyboard.js
Last active September 29, 2019 07:55
/* Keyboard input */
const pressed = {};
// Call this function each game update to get the state of a key
// Arguments
// key (String): The key to check.
// Returns
// (Boolean): If the key is pressed or not.
export function isKeyDown(keyCode) {
// TODO: Fix this file
export class L1ControllerPreset {
constructor() {
this.buttonAliases = new Map();
this.analogAliases = new Map();
this.buttonInversions = [];
this.analogInversions = [];
}
@sajmoni
sajmoni / getTexture.js
Last active May 28, 2019 21:16
Function to get a texture from Pixi's resource loader
// "app" is an instance of PixiJS Application
export default app => (filename) => {
const {
resources,
} = app.loader;
const texture = Object
.values(resources)
.filter(resource => resource.textures)
.flatMap(resource => Object.entries(resource.textures))
alias ll='ls -laG'
alias gst="git status"
alias gp="git push"
alias gpr="git pull --rebase"
alias gsh="git stash"
alias gshp="git stash pop"
alias gco="git checkout"
alias gsync="gsh && gpr && gshp"
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
@sajmoni
sajmoni / .vimrc
Created September 19, 2017 20:47
syntax on
autocmd Filetype gitcommit setlocal spell textwidth=72