Skip to content

Instantly share code, notes, and snippets.

View cacciatc's full-sized avatar

Chris Cacciatore cacciatc

View GitHub Profile
@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
@cacciatc
cacciatc / generate_debug_lua.rb
Last active September 24, 2015 00:05
Scans source for comment annotations and create a Lua script to be used with FCEUX
debug_prints = []
# scan all source files for ;! annotations
(Dir.glob("src/**/*.h") + Dir.glob("src/**/*.s")).each do |file|
File.open(file, "r") do |file|
capture_next_line = false
file.readlines.each do |line|
if capture_next_line
debug_prints[-1][:name] = line.strip.split(":").first
capture_next_line = false