Skip to content

Instantly share code, notes, and snippets.

View cacciatc's full-sized avatar

Chris Cacciatore cacciatc

View GitHub Profile
@cacciatc
cacciatc / vis.js
Created January 10, 2013 20:26
JavaScript to be used with ScriptCraft to create static sorting algorithm visualizations in Minecraft.
load($SCRIPT_DIR + "/../drone.js");
var arr = [{i:1,b:'35:1'},{i:5,b:'35:5'},{i:3,b:'35:3'},{i:2,b:'35:2'},{i:4,b:'35:4'},{i:7,b:'35:7'},{i:8,b:'35:8'},
{i:6,b:'35:6'},{i:0,b:35},{i:14,b:'35:14'},{i:13,b:'35:13'},{i:12,b:'35:12'},{i:10,b:'35:10'},{i:9,b:'35:9'},{i:11,b:'35:11'}];
var render = function(a,d){
d.up(a.length);
for(var k =0;k< a.length;k++){
d.box(a[k].b).down();
}
@cacciatc
cacciatc / clearance_users_controller_with_invite.rb
Created July 16, 2011 22:56 — forked from mchung/clearance_users_controller_with_invite.rb
Fix: so a user can only use their own invite code
class UsersController < Clearance::UsersController
# Override and add in a check for invitation code
def create
@user = User.new params[:user]
invite_code = params[:invite_code]
@invite = Invite.find_redeemable(invite_code)
# Invite code is present, there is an associated invite, and it is the user's invite
if invite_code && @invite && @invite.email == @user.email