Skip to content

Instantly share code, notes, and snippets.

View tmathews's full-sized avatar
🌠
Gotta go fast.

Tom tmathews

🌠
Gotta go fast.
View GitHub Profile
@tmathews
tmathews / nine-patch.go
Created July 14, 2023 18:28
Ebiten 9 Patch
package main
import (
"image"
"github.com/hajimehoshi/ebiten/v2"
)
type NinePatch struct {
tiles [9]*ebiten.Image
@tmathews
tmathews / greeting.go
Created January 6, 2021 20:32
Greeting
func Greeting() string {
greeting := "こんにちわ!"
now := time.Now().Hour()
if now > 2 && now < 10 {
greeting = "おはよう!"
} else if now >= 18 {
greeting = "こんばんわ"
}
return greeting
}

Keybase proof

I hereby claim:

  • I am tmathews on github.
  • I am tmathews (https://keybase.io/tmathews) on keybase.
  • I have a public key whose fingerprint is A6E6 1D6B B14A DE88 DFB1 0AB7 2AE3 3D5A FF67 1924

To claim this, I am signing this object:

@tmathews
tmathews / postgres-stdout.sql
Created January 13, 2018 00:06
Postgres STDOUT
copy (QUERY)
to stdout with csv header delimiter E'\t';
./Engine/Binaries/Linux/UE4Editor ~/Documents/UnrealProjects/spine-ue4/SpineUE4.uproject
Increasing per-process limit of core file size to infinity.
LogInit: Display: Running engine for game: SpineUE4
LogPlatformFile: Not using cached read wrapper
LogInit: Display: RandInit(-918469634) SRandInit(-918469633).
LogInit: Read version file with build ID '621a30dd-264e-4237-aae5-f4bb2de8487f'
LogInit: Registered custom module enumerator with build ID '621a30dd-264e-4237-aae5-f4bb2de8487f'
LogTaskGraph: Started task graph with 5 named threads and 14 total threads with 3 sets of task threads.
LogStats: Stats thread started at 0.044868
LogPluginManager: Mounting plugin FacialAnimation
function k (c, b) {
var x = c.concat()
window.addEventListener('keyup', function(e) {
if (x.shift() != e.keyCode) x = c.concat()
if (!x.length && x.concat(c)) b()
})
}
k([38,38,40,40,37,39,37,39,66,65], alert.bind(null, 'hi'))
// Define modules.
need("cookie", function ( need ){
function Cookie ( type ) {
this.type = type;
}
Cookie.prototype.getName = function () {
return this.type + " Cookie";
}
@tmathews
tmathews / download-mp3s.js
Last active August 29, 2015 14:01
Download all mp3 links on a html page.
var http = require("http");
var fs = require("fs");
var url = "http://f.starfox-online.net/sf64/voiceclips/";
var request = http.get(url, function ( response ) {
var body = "";
response.on("data", function ( chunk ) {
body += chunk;
});
MMM
MMMMM
MMMMMM
MM MMMMMMM
MMMMM MMMMMMMMMMMMMMMM
MMMMMM MMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMM MMMMMMMMMMM
MMMMMMMMM MMMMMMMMMMMM
MMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMM
function hex ( n ) {
//See: http://www.javascripter.net/faq/rgbtohex.htm
n = parseInt(n,10);
if (isNaN(n)) return "00";
n = Math.max(0,Math.min(n,255));
return "0123456789ABCDEF".charAt((n-n%16)/16)
+ "0123456789ABCDEF".charAt(n%16);
}