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
@britg
britg / Procfile
Created June 3, 2011 03:02
My Procfile
web: bundle exec thin start
worker: bundle exec rake jobs:work
log: tail -f -n 0 log/development.log
watchr: bundle exec rake watchr
[52/70] cxx: src/node.cc -> build/default/src/node_6.o
../src/node.cc: In function ‘void node::CheckIdleness(ev_timer*, int)’:
../src/node.cc:135: error: no matching function for call to ‘v8::V8::IdleNotification()’
default/deps/v8/include/v8.h:2331: note: candidates are: static bool v8::V8::IdleNotification(bool)
../src/node.cc: In function ‘void node::NotifyIdleness(ev_idle*, int)’:
../src/node.cc:149: error: no matching function for call to ‘v8::V8::IdleNotification()’
default/deps/v8/include/v8.h:2331: note: candidates are: static bool v8::V8::IdleNotification(bool)
../src/node.cc: In function ‘ssize_t node::DecodeWrite(char*, size_t, v8::Handle<v8::Value>, node::encoding)’:
../src/node.cc:376: error: ‘HINT_MANY_WRITES_EXPECTED’ is not a member of ‘v8::String’
../src/node.cc:381: error: ‘HINT_MANY_WRITES_EXPECTED’ is not a member of ‘v8::String’
@britg
britg / gist:244160
Created November 27, 2009 18:36 — forked from bscofield/gist:181842
# mongo_template.rb
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"
run "rm public/javascripts/dragdrop.js"
run "rm public/javascripts/effects.js"
run "rm public/javascripts/prototype.js"
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));
function upload_img($id = null)
{
$this->layout = 'empty';
//Configure::write('debug', 0);
if(empty($this->data)) {
die();
}
$full = $this->JqImgcrop->uploadImage($this->data['Listing']['image'], 'img/listings/full/', time());