Skip to content

Instantly share code, notes, and snippets.

💃
Not much. You?

Tim mildmojo

💃
Not much. You?
Block or report user

Report or block mildmojo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mildmojo
mildmojo / gulpfile.js
Created May 30, 2019
Gulp task definition helper so all gulp tasks can have descriptions for `gulp -T`.
View gulpfile.js
'use strict';
const exec = require('child_process').exec;
// Quick shortcut for shortcomings in `gulp.task` API:
// 1. `gulp.task` doesn't accept a description, has to be a prop on the function.
// 2. Since description has to be on the task function, it's harder to add a
// description to tasks whose functions were created by a helper (e.g.
// `gulp.series` or `gulp.parallel`) since you didn't define the functions
// they return.
function gulpTask(name, desc, fn) {
@mildmojo
mildmojo / rotate-audio-output.sh
Last active Apr 9, 2019
Script for Linux to set the next available audio output as the default system output, switching all current streams over to it.
View rotate-audio-output.sh
#!/bin/bash
#
# rotate-audio-output.sh
#
# Switch to the next available audio output device and show a notification with
# all available devices and the one currently selected.
#
# You may need to edit /etc/pulse/default.pa and change the appropriate line to:
# load-module module-stream-restore restore_device=false
#
@mildmojo
mildmojo / bitsy-logic-operators-extended.js
Created Mar 4, 2018
More logic operators for bitsy. &&, ||, !==, &&!, and ||!
View bitsy-logic-operators-extended.js
/* Operator logic is at the bottom of this script; need to declare the toolkit first. */
/*
================================
SCRIPT HOOKS TOOLKIT (@mildmojo)
================================
HOW TO USE:
1. Paste this whole file in script tags at the bottom of your Bitsy
exported game HTML, after the last /script> tag.
@mildmojo
mildmojo / bitsy-import-external-game-data.js
Last active Feb 21, 2018
DEPRECATED! See notes in code and in first comment. (Bitsy game engine mod to load game data from an external file or URL)
View bitsy-import-external-game-data.js
/*
************************************************************************
THIS GIST IS OUTDATED
There's a new version published in the bitsy-hacks repo, which fixes
some bugs. Go get it instead!
Direct link to the external game data mod:
https://raw.githubusercontent.com/seleb/bitsy-hacks/master/external-game-data.js
@mildmojo
mildmojo / bitsy-dialog-exit-room.js
Last active Feb 21, 2018
DEPRECATED! See notes in code and in first comment. (Bitsy engine mod: dialog function to exit to another room)
View bitsy-dialog-exit-room.js
/*
************************************************************************
THIS GIST IS OUTDATED
There's a new version published in the bitsy-hacks repo, which changes
syntax to use parentheses instead of curly braces so the editor
doesn't eat your function calls! Go check out the new script and see
all the new stuff in the header comments.
bitsy-hacks repo at: https://github.com/seleb/bitsy-hacks
@mildmojo
mildmojo / html-annotate-filenames.js
Last active Sep 27, 2017
Webpack loader that inserts original source filenames as HTML comments
View html-annotate-filenames.js
/*
html-annotate-filenames
Webpack loader that surrounds generated HTML blocks with comments noting the
original source filename for the block.
To use, modify your webpack config with a `resolveLoader` that can find this
file and a rule for this loader. Example:
{
@mildmojo
mildmojo / unity-midi-input-ouput.diff
Created May 19, 2017
Patch to add MIDI output support to keijiro's MidiInput for Unity (https://github.com/keijiro/unity-midi-input)
View unity-midi-input-ouput.diff
--- a/UnityMidiReceiver/UnityMidiReceiver.cpp
+++ b/UnityMidiReceiver/UnityMidiReceiver.cpp
@@ -37,6 +37,7 @@ namespace
// MIDI device handle vector.
std::vector<HMIDIIN> handles;
+ std::vector<HMIDIOUT> outDeviceHandles;
// Incoming MIDI message queue.
std::queue<Message> messageQueue;
@mildmojo
mildmojo / highlight-forced-tweets.css
Created Jan 20, 2017
Highlight tweets from a user you don't follow
View highlight-forced-tweets.css
/*
Highlights in red, shrinks text, converts text to grey, and adds "NOT FOLLOWING" before username.
The user ID used here is for @POTUS, which will one day become @POTUS45.
Designed to help highlight tweets forced into your timeline by Twitter. Narrow execution.
*/
@-moz-document domain('twitter.com') {
.tweet[data-user-id="822215679726100480"][data-you-follow=false] {
background-color: #FDD;
color: grey;
@mildmojo
mildmojo / teensyduino_xinput.diff
Created Aug 10, 2016
Diff on Arduino 1.6.9 + TeensyDuino 1.29 adding XInput support per http://www.zlittell.com/2015/07/fightstick/
View teensyduino_xinput.diff
diff -ruw a2/arduino-1.6.9/hardware/teensy/avr/boards.txt arduino-1.6.9/hardware/teensy/avr/boards.txt
--- a2/arduino-1.6.9/hardware/teensy/avr/boards.txt Tue Aug 9 20:50:12 2016
+++ arduino-1.6.9/hardware/teensy/avr/boards.txt Mon Aug 8 05:20:42 2016
@@ -65,6 +65,9 @@
teensy31.menu.usb.flightsimjoystick=Flight Sim Controls + Joystick
teensy31.menu.usb.flightsimjoystick.build.usbtype=USB_FLIGHTSIM_JOYSTICK
teensy31.menu.usb.flightsimjoystick.fake_serial=teensy_gateway
+teensy31.menu.usb.xinput=[MSF] Shoryuken! (XINPUT DEVICE)
+teensy31.menu.usb.xinput.build.usbtype=USB_XINPUT
+teensy31.menu.usb.xinput.fake_serial=teensy_gateway
@mildmojo
mildmojo / setup_teardown_helper.js
Last active Nov 3, 2015
Jasmine-node helpers: per-describe `setup` and `teardown` functions
View setup_teardown_helper.js
/*
setup_teardown_helper.js
Setup and teardown helper functions for jasmine-node (jasmine 1.3).
IMNSHO, every damn test runner should provide the following hooks:
startup (global; runs once before any setups or specs begin)
setup (describe-local; runs once before any specs in a `describe`)
beforeEach (describe-local; runs once before each spec in a `describe`)
afterEach (describe-local; runs once after each spec in a `describe`)
You can’t perform that action at this time.