Skip to content

Instantly share code, notes, and snippets.


Luke Hutscal girasquid

View GitHub Profile
View guard_rail_spec.rb
context "making sure we don't accidentally take the site down" do
EXPECTED_NUMBER_OF_WORKERS = 10 # copy this value from the other place it's defined; this shouldn't be dynamic, repeating yourself is better
it "reminds the user of side effects" do
rescue RSpec::Expectations::ExpectationNotMetError => error
error.message << "\n"
error.message << <<~HEREDOC
📎 Oh hi there! It looks like you changed the value of MySystem::NUMBER_OF_WORKERS.
girasquid / Timer.cs
Created Jul 14, 2018
Simple countdown timer for Unity projects that updates a Text (you supply the Text and how many seconds to start at)
View Timer.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CountdownTimer : MonoBehaviour {
public Text timerText;
public int startingSeconds;
girasquid /
Created Nov 26, 2016
Get all words that are between 3 and 6 characters long from your system's dictionary, and then format them so that you can drop them into an array.
cat /usr/share/dict/words | grep '.\{3\}' | grep -v '.\{6\}' | sed 's/^/"/;s/$/",/' | pbcopy
girasquid /
Created Jul 19, 2016
Bash script that calculates age of each folder in a directory, based on git commits
#!/usr/bin/env bash
human() {
local seconds=$1
if ((seconds < 0)); then
((seconds *= -1))
local times=(
girasquid /
Created Sep 29, 2015
Kinda-bad keyboard button tracking class with a similar interface to
package controllers {
import com.junkbyte.console.ConsoleChannel;
import starling.display.Stage;
public class Keyboard {
private static const channel:ConsoleChannel = new ConsoleChannel("Keyboard");
private static var stage:Stage;
private static var trackingKeys:Object = {};
girasquid /
Last active Sep 17, 2015
Kinda-bad multi-controller helper library, loosely modelled off KeyActionBinder but simpler. Supports XBone, PS3 DS, and Logitech F310 (DirectInput mode) on OS X.
package controllers {
import com.junkbyte.console.ConsoleChannel;
import flash.ui.GameInput;
import flash.ui.GameInputDevice;
public class Controllers {
private static const channel:ConsoleChannel = new ConsoleChannel("Controllers");
private static var _input:GameInput;
package {
import starling.core.Starling;
import starling.animation.Transitions;
import starling.animation.Tween;
public class Utils {
// This function accepts an originalX and originalY so that you can shake things that
// are on screen but not necessarily originally located at 0, 0 (compared to the original
// implementation which only ever moved things back to 0, 0)
public static function screenShake(drawable:Shakeable, shakeDuration:Number, intensity:Number, originalX:Number, originalY:Number):void {
View How to connect a PS3

How to connect PS3 controller on Mac OSX, PC, etc.

This is how you connect PS3 controller to Mac OSX, PC, etc. when previously connected to a PS3. You will need a Mini USB cable. Overcome your laziness and go get one!

A big misconception is that keep holding PS button will reset the controller's pairing. It doesn't! From my testing, the controller pairs with the last machine it was CONNECTED VIA A USB CABLE.

Here are the real Steps:

View datamapper_query_counter.rb
require 'data_objects'
require 'data_mapper'
require 'dm-core'
require 'dm-do-adapter'
require 'do_postgres'
module DataMapper
class << self
attr_accessor :query_count
package text {
import flash.text.TextFormat;
public class SimpleFormat extends TextFormat {
public function SimpleFormat(options:Object):void {
for(var k:Object in options) {
if(this.hasOwnProperty(k)) {
this[k] = options[k];
You can’t perform that action at this time.