Skip to content

Instantly share code, notes, and snippets.

View bil-bas's full-sized avatar

Bil Bas bil-bas

View GitHub Profile
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
module GC
def self.count_objects_by_class
@@runs ||= []
run = Hash.new 0
@@runs << run
# Count objects of each class.
ObjectSpace.each_object do |obj|
run[obj.class.name.to_sym] += 1
end
def pitch(angle)
a = angle.degrees_to_radians
@velocity = Matrix[[Math::cos(a), -Math::sin(a)], [Math::sin(a), Math::cos(a)]] * @velocity
end
def pitch_up; pitch 3; end
def pitch_down; pitch -3; end
compile '/images/screenshots/*/', rep: :thumbnail do
filter :thumbnailize, factor: 0.25
end
route '/images/screenshots/*/', rep: :thumbnail do
item.identifier.chop + '-thumbnail.' + item[:extension]
end
-------------------
# layouts/screenshot.html.haml
Relapse::Builders::OsxApp
+ asserts folder_suffix is equal to "OSX"
+ asserts icon= with arguments(s): ["test_app.ico"] raises Relapse::ConfigError with message /icon must be a .icns file/
+ denies gemspecs is empty
Relapse::Builders::OsxApp no wrapper
+ asserts generate_tasks raises Relapse::ConfigError with message /wrapper not set/
Relapse::Builders::OsxApp invalid wrapper
+ asserts generate_tasks raises Relapse::ConfigError with message /wrapper not valid/
Relapse::Builders::OsxApp no url
+ asserts generate_tasks raises Relapse::ConfigError with message /url not set/
@bil-bas
bil-bas / gist:1667592
Created January 24, 2012 03:23
Library names
Keywords: Ruby, Application, Package, Release, Standalone
ReleasePackager - A bit wordy and bland. I want a memorable word/pun/acronym
Crate/Box/Luggage - all sorts of "package" type words are taken.
RelApps - Same as Relapse.
Relapse - too many negative connotations
LUMP => Lump is the Ultimate Multi-platform Packager
RUMP => Ruby's Ultimate Multi-platform Packager (rump exists: https://bitbucket.org/sterlingcamden/rump)
RASP => Ruby Application Standalone Packager
SAP StandaloneApplicationPackager. Sadly SAP is used by webby geezers.
@bil-bas
bil-bas / patience.rb
Created December 15, 2011 17:02
kyrylo patience
always do
on :mouse_press do
@clicked_card = @deck.cards.find { |card| card.received_click?(mouse_pos) }
end
on :mouse_release do
@clicked_card = nil
end
@clicked_card.drag(mouse_pos) if @clicked_card
@bil-bas
bil-bas / gist:1467397
Created December 12, 2011 14:18
spooner.github.com compilation
Loading site data...
Compiling site...
Removing draft pages...
delete /games/alpha_channel/releases/v1_2_5_draft/
delete /games/hoops/releases/v1_0_0_draft/
Creating tags...
generate /tags/zed-and-ginger/
generate /tags/game/
generate /tags/ray/