Skip to content

Instantly share code, notes, and snippets.

View bil-bas's full-sized avatar

Bil Bas bil-bas

View GitHub Profile
class RawDataController < ApplicationController
helper_method :sort_column, :sort_direction
def index
end
protected
def sort_column
logger.debug self.class::SORT_MODEL.inspect
translate -@camera_x, -@camera_y do
@map.draw
@player.draw
end
translate 10, 10 do
score_text = "Collected: #{@player.items}"
score_width = @score_font.text_width score_text
draw_quad 0, 0, 0xaa000000,
@bil-bas
bil-bas / gist:3049003
Created July 4, 2012 19:12
programatically define a method that accepts a block
class Test
def self.define_me_a_method(name)
self.send(:define_method, name, proc { |&block|
block.call
})
end
define_me_a_method 'awesome'
end
class Table < ActiveRecord::Base
self.table_name = "magi.tables"
has_many :headers
#--------------------------------------------------------------------------------------------------#
def self.generate
@tables = Table.select([:id, :source_database, :current_name, :magi_name])
@headers = Header.select([:id, :table_id, :current_name, :magi_name]) #refactor to call this in the loop
@bil-bas
bil-bas / gist:2907195
Created June 10, 2012 20:18
generator
require 'thor'
require 'thor/actions'
class App < Thor
include Thor::Actions
end
@run = App.new
require 'ray'
ImageWidth = 640
ImageHeight = 480
image = Ray::Image.new [ImageWidth, ImageHeight]
Ray::ImageTarget.new image do |target|
target.shader.compile(:frag => StringIO.new(<<eof))
#version 110
@bil-bas
bil-bas / bacon.rb
Created October 26, 2010 16:06 — forked from banister/bacon.rb
require 'rubygems'
require '../lib/remix'
require 'bacon'
describe 'Test basic remix functionality' do
before :each do
class Module
public :include
end