Skip to content

Instantly share code, notes, and snippets.

View britg's full-sized avatar
🖖
Building games

Brit Gardner britg

🖖
Building games
View GitHub Profile

Keybase proof

I hereby claim:

  • I am britg on github.
  • I am britg (https://keybase.io/britg) on keybase.
  • I have a public key ASD3eqHnvrmgfpG5_HFfEZCq5dxHggVV2kB9FyiKvZcC1Qo

To claim this, I am signing this object:

class Triplet
# Class methods
# these generate Triplet _instances_
def self.up_to max
valid = []
(1..max).each do |x|
y = x+1
z = y+1
def possible_win_combo(board, combos)
combos.each do |combo|
multiple_x = board.select {|space,value| combo.include?(space) && value == 'X'}
if multiple_x.length == 2
return combo if (board[combo[0]] != 'O' && board[combo[1]] != 'O' && board[combo[2]] != 'O')
end
end
nil #return not necessary, implicit
end
@britg
britg / original.rb
Last active August 29, 2015 14:22
ruby warrior level
class Player
def initialize
@health = 20
@clear_behind = false
@wounded = false
end
def play_turn(warrior)
warrior_wounded?(warrior)
@britg
britg / gist:9572946
Created March 15, 2014 19:52
Screen to world point with oblique camera
Vector2 mousePos = Input.mousePosition;
if (lastMousePos.Equals(mousePos)) {
return;
}
lastMousePos = mousePos;
Ray ray = Camera.main.ScreenPointToRay(mousePos);
float dist;
Plane plane = new Plane(Vector3.up, Vector3.right, Vector3.down);
plane.Raycast(ray, out dist);
Vector3 worldPoint = Camera.main.ScreenToWorldPoint(new Vector3(mousePos.x, mousePos.y, dist));
@britg
britg / cap_deploy-quick
Created May 29, 2013 18:23
Sometimes you just want to update from git and restart
namespace :deploy
task :quick do
run "cd #{current_path}; git pull origin #{branch}"
system("cap #{stage} deploy:restart")
end
end
Apps
http://www.reflectionapp.com/
http://flexibits.com/fantastical
http://cheddarapp.com
http://appifywp.com/
http://www.mint.com
https://www.braintreepayments.com/
https://codeclimate.com/
https://cardspring.com/
http://nezumiapp.com/
@britg
britg / activate.js
Created January 15, 2012 16:47
Bonus strike CSS
$('#bar').removeClass('new').addClass('activated');
class Player < ActiveRecord::Base
# ...
def skills
@skills ||= (Skill.where(:player_id => self.id).first || \
Skill.create(:player_id => self.id))
end
end
@britg
britg / jquery.touch.js
Created January 5, 2012 16:29
jQuery touch events
/**
* touch for jQuery
*
* Copyright (c) 2008 Peter Schmalfeldt (ManifestInteractive.com) <manifestinteractive@gmail.com>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,