Skip to content

Instantly share code, notes, and snippets.

View jotson's full-sized avatar

John Watson jotson

View GitHub Profile
@jotson
jotson / gist:2877157
Created June 5, 2012 19:22
Sublime Text theme XML for setting HTML/PHP highlighting
<!--
PHP files are highlighted as text.html.basic source.php.embedded.block.html.
The following two entries reverse the highlighting in the Twilight theme
so that the HTML blocks are highlighted in PHP and the PHP code is not.
-->
<dict>
<key>name</key>
<string>HTML</string>
<key>scope</key>
<string>text.html.basic</string>
@jotson
jotson / gist:2877197
Created June 5, 2012 19:28
Sublime Text Python command to get scope at cursor position (for theme writing)
Run this in the Python console (Ctrl+`):
sublime.active_window().active_view().scope_name(sublime.active_window().active_view().sel()[0].a)
@jotson
jotson / .bashrc
Created November 7, 2012 18:36
Current bash prompt
###########################################################3
# Custom prompt with elapsed timer for last command
function command_timer_start {
timer=${timer:-$SECONDS}
}
function command_timer_stop {
last_command_elapsed_time=$(($SECONDS - $timer))
unset timer
}
@jotson
jotson / objectpool.js
Last active December 15, 2015 01:49
Crafty ObjectPool
var ObjectPool = {
/**
* Get a cached entity or create a new one
* @param string component Component string (e.g. "player")
* @return entity
*/
get: function(component) {
var objects = Crafty(component);
for(var i = 0; i < objects.length; i++) {
var e = Crafty(objects[i]);
@jotson
jotson / gist:87c1bba650024bd8512b
Last active August 29, 2015 14:09
Bash script to start dev container and cleanup after
#!/bin/bash
# Start a container
# jotson/webdev runs supervisord so this command waits until Ctrl+C
sudo docker run -p 80:80 jotson/webdev $*
# Delete container
echo "Cleaning up container..."
sudo docker rm $(sudo docker ps -a | grep 'webdev.*Exited.*second.*ago' | awk '{ print $1 }')
@jotson
jotson / gist:1716aa46797275cb0ea0
Created January 15, 2015 18:51
The story so far...
3 hours ago: Reduced alpha on debug overlay
3 hours ago: Updated font
11 hours ago: Fix gold chasing player problem
12 hours ago: Added bitmap font, reworked menu to scale across resolutions
18 hours ago: Added stageScale for UI positioning and size at different resolutions
19 hours ago: Basic text abstraction class
2 days ago: Notes
2 days ago: Basic bomb
3 days ago: Tweaked particle count
3 days ago: Added toplevel obfuscation option
@jotson
jotson / movie2gif
Created February 12, 2016 08:26
Python script for converting a movie to an animated GIF using ffmpeg and ImageMagick
#!/usr/bin/python3
import os
import sys
import subprocess
import optparse
import datetime
import re
import shutil
@jotson
jotson / gist:bbe63bcfa9682caccf604e819c67c1ee
Created August 9, 2017 01:47
Godot Engine 2.1: Creating bitmap font from PNG image
tool
extends Label
var font
onready var texture = load("res://fonts/main.png")
func _ready():
# Create font
font = BitmapFont.new()
@jotson
jotson / bping
Created June 28, 2018 00:59
Ping that beeps for Ubuntu
#!/bin/sh
UPSOUND=~/Dropbox/phone-sounds/notifications/Trek\ Beep\ 11.mp3
DOWNSOUND=~/Dropbox/phone-sounds/notifications/Trek\ Beep\ 03.mp3
while [ 1 = 1 ]
do
ping -q -c 1 -W 1 $1 >/dev/null
STATUS=$?
gource -e 1 --title "Gravity Ace Development" -a 0.1 -s 0.1 \
--file-show-filter "game/" --file-filter ".import" --bloom-multiplier 0.3 \
--fullscreen --crop vertical --hide filenames,progress,mouse