Skip to content

Instantly share code, notes, and snippets.

Avatar

Tyler JavadocMD

View GitHub Profile
@JavadocMD
JavadocMD / UniRxCharacterV3.cs
Created Jul 20, 2016
Developing a first person controller for Unity3D with UniRx: Part 3
View UniRxCharacterV3.cs
using UnityEngine;
using UniRx;
using UniRx.Triggers;
namespace Assets.Scripts.v3 {
public class InputsV3 : MonoBehaviour {
// Singleton.
public static InputsV3 Instance { get; private set; }
@JavadocMD
JavadocMD / CompileIndicator.cs
Last active May 26, 2021
A Unity script to play a sound effect when script compiling starts and ends.
View CompileIndicator.cs
using System;
using System.Reflection;
using UnityEditor;
using UnityEngine;
// I recommend dropping this script in an Editor folder.
// You should have two audio clips somewhere in the project.
// You'll need to edit-in the paths of those clips (from your project root folder) in the static initializer below.
// Example path: "Assets/Editor/CompileIndicator/start.mp3"
@JavadocMD
JavadocMD / UniRxCharacterV1.cs
Last active Jan 6, 2021
Developing a first person controller for Unity3D with UniRx: Part 1
View UniRxCharacterV1.cs
using UnityEngine;
using UniRx;
using UniRx.Triggers;
// NOTE: Unity won't actually let you put two MonoBehaviours in one file.
// They're both listed here just for convenience.
namespace Assets.Scripts.v1 {
public class InputsV1 : MonoBehaviour {
@JavadocMD
JavadocMD / chrome_open_bookmark.py
Created Nov 12, 2016
A script to open Chrome bookmarks or entire folders of bookmarks by name. (Windows)
View chrome_open_bookmark.py
#!/usr/bin/env python
import os, subprocess, json
# Get all bookmarks matching the given name(s)
def get_bookmarks(profile_dir, names):
with open(os.path.join(profile_dir, 'Bookmarks')) as f:
j = json.load(f)
results = []
# There are two root-level bookmark folders: one for the bookmark bar and one for all others.
@JavadocMD
JavadocMD / UniRxCharacterV2.cs
Last active Sep 17, 2020
Developing a first person controller for Unity3D with UniRx: Part 2
View UniRxCharacterV2.cs
using UnityEngine;
using UniRx;
using UniRx.Triggers;
// NOTE: Unity won't actually let you put two MonoBehaviours in one file.
// They're both listed here just for convenience.
namespace Assets.Scripts.v2 {
public class InputsV2 : MonoBehaviour {
@JavadocMD
JavadocMD / index.js
Created Aug 3, 2020
Follow a Blaseball game for the given team and print updates to the console.
View index.js
import { default as Socket } from 'socket.io-client'
// dependencies: socket.io-client
// Usage example:
// $ node ./dist/index.js "Philly Pies" | espeak-ng -v en-us -s 120
function main() {
const team = process.argv[2] || 'Philly Pies'
const socket = Socket('https://blaseball.com')
@JavadocMD
JavadocMD / dedupe.ts
Created Aug 1, 2020
Removes repeated lines from the input.
View dedupe.ts
import { Transform } from 'stream'
import { StringDecoder } from 'string_decoder'
const split = (r: RegExp = /\r?\n/) => {
const enc = 'utf8'
const dec = new StringDecoder(enc)
let prev: string = ''
return new Transform({
defaultEncoding: enc,
transform(chunk, e, callback) {
View DrawingGame.java
package com.javadocmd.drawing;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Pixmap;
@JavadocMD
JavadocMD / api.ts
Created Aug 24, 2019
Express handler type constraints.
View api.ts
import { Request, NextFunction } from 'express'
interface JsonResponse<T> {
status(code: number): JsonResponse<T>
json(value: T): JsonResponse<T>
}
type JsonHandler<T> = (
req: Request,
res: JsonResponse<T>,
@JavadocMD
JavadocMD / window.d.ts
Created Aug 23, 2019
Extending Window in Typescript.
View window.d.ts
// This file would go in your source path, e.g.: src/window.d.ts
declare interface Window {
foo: string
}