This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require '../lib/remix' | |
require 'bacon' | |
describe 'Test basic remix functionality' do | |
before :each do | |
class Module | |
public :include | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thor' | |
require 'thor/actions' | |
class App < Thor | |
include Thor::Actions | |
end | |
@run = App.new | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RawDataController < ApplicationController | |
helper_method :sort_column, :sort_direction | |
def index | |
end | |
protected | |
def sort_column | |
logger.debug self.class::SORT_MODEL.inspect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
# Read the list of hosts. | |
hosts = {} | |
CSV.open('./datafile.csv', 'r') do |fields| | |
hosts[fields[0]] = { :location => fields[1], :device_type => fields[3] } | |
end | |
# Find out the date to report on. | |
report_file = './report.csv' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# code.rb contains: | |
# class Frog | |
# end | |
module MyModule | |
class_eval File.read("./code.rb"), "code.rb", 1 | |
end | |
p MyModule::Frog # Will succeed. | |
p Frog # Will fail. |
OlderNewer