Skip to content

Instantly share code, notes, and snippets.

Avatar

Tavis Booth tinyrobot

View GitHub Profile
View process_restore_helpers.sh
restore_pane_process() {
local pane_full_command="$1"
local session_name="$2"
local window_number="$3"
local pane_index="$4"
local dir="$5"
if _process_should_be_restored "$pane_full_command" "$session_name" "$window_number" "$pane_index"; then
# These two commands don't seem to be needed if addressing session:window.pane absolutely (see below)
tmux switch-client -t "${session_name}:${window_number}"
tmux select-pane -t "$pane_index"
View TouchInput.hx
/** Simple touch input helper class that provides similar data to HaxePunk's mouse.
takes arguments defining a box within which to register touches. Only registers first touch.
*/
class TouchInput{
public var pressed:Bool = false;
public var released:Bool = false;
public var down:Bool = false;
public var touchX:Float = 0;
public var touchY:Float = 0;
@tinyrobot
tinyrobot / gist:5515012
Created May 3, 2013
Ideas for selector based server side templating with node
View gist:5515012
//data
var person = {name: "Dave", exampleattr: "true", friends: ["one","two","three"]};
//map data to selectors
var mapping = {
name: "#people .person",
exampleattr: {"#people .person" : "someattr"},
friends: "#people .friends"
};
//input
@tinyrobot
tinyrobot / gamefuncs.clj
Created May 4, 2012
Playing with game related functions in clojure
View gamefuncs.clj
;; Testing some potential basic game functions
;; moved-by : list list -> list
;; computes a new position by adding an x,y pair to an x,y pair
;; example: (moved-by '(1,1) '(0,1)) -> '(1,2)
(defn moved-by [position amount]
(map + position amount))
;; test moved-by: (moved-by '(1,1) '(0,1)) -> '(1,2)
(println (= '(1 2) (moved-by '(1,1) '(0,1))))
@tinyrobot
tinyrobot / underscore_games.js
Created Jan 27, 2012
Partial Application / javascript games with underscore.js
View underscore_games.js
//our simple data structure
function Spatial(x,y,vx,vy){
this.x = x;
this.y = y;
this.vx = vx || Math.random();
this.vy = vy || Math.random();
}
//use partial application here so that we can compose this in our main update
function processEvents(keys){
You can’t perform that action at this time.