This file contains hidden or 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
~. ..~.. | |
/´¯/) CHOO CHOO! | |
,/¯ / | |
/ /´¯/'¯¯'/´¯¯¯`·¸ | |
________ / / / / /¨¯\________________ | |
\ ('( ´ ´ ¯~/' ') / | |
\ O O O \ O O O O O O O O O O O / O O O O O O / | |
\ '' \ _ ·´ / | |
~~~\ \ ( /~~~~~~~~~~~~~~~~~~~~ | |
\________\______________\________________/ |
This file contains hidden or 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
Yoyo everyone, Workflow has a Lighthouse now: | |
http://workflow.lighthouseapp.com/projects/17476-workflow | |
So you'se can file your bugs for me to work on! :) |
This file contains hidden or 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
module Modelling | |
class << self | |
def append_features(receiver) | |
initialize_members_classvar(receiver) | |
bind_attributes_meta_method(receiver) | |
bind_maps_meta_method(receiver) | |
bind_collection_meta_method(receiver) | |
bind_default_constructor(receiver) |
This file contains hidden or 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
Hack.run! :port => 5555 do | |
get '/' | |
'Hello!' | |
end | |
end |
This file contains hidden or 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
The point of this prototype is to launch the rails app, and then hit it with urls with a | |
bunch of parameters to see the library in action: | |
* http://localhost:3000/roles/index (200) | |
* http://localhost:3000/roles/reviewer_stuff (404) | |
* http://localhost:3000/roles/reviewer_stuff?reviewer=1 (200) | |
* http://localhost:3000/roles/reviewer_stuff?admin=1 (200) | |
* http://localhost:3000/roles/admin_stuff (404) |
This file contains hidden or 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
special_ability :edit_item do |item| | |
admin? or site_manager? or reviewer? or (item.author == self) | |
end |
This file contains hidden or 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
special_ability :edit_item do |item| | |
admin? or site_manager? or reviewer? or (item.author == self) | |
end |
This file contains hidden or 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
# DRY temporary variables that require single use only, without assignment... seems | |
# useful for configuration files perhaps? urgh. | |
class Object | |
def with(object) | |
yield(object) | |
end | |
end | |
@reports = [] |
This file contains hidden or 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
# a retarded attempt to make a lighttpd monitor, i don't think this ever worked | |
%w(timeout logger).each { |lib| require lib } | |
open '/var/log/lighty-rebooter.log', 'a' do |logfile| | |
@log = Logger.new(logfile) | |
@log.info "Starting up!" | |
logfile.flush | |
loop do | |
begin | |
response = Timeout.timeout 10 do |
This file contains hidden or 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
# I don't tend to like writing this kind of code: | |
if Rails.env == 'development' or Rails.env == 'staging' | |
# ... | |
end | |
# So, an alternative Ruby way to do this is: | |
if %w(development staging).include?(Rails.env) | |
# ... |
OlderNewer