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
class App < Sinatra::Base | |
include Jazzband | |
get '/' do | |
session['username'] = params['username'] | |
haml session['username'] ? :chat : :select_username | |
end | |
get '/send' do | |
return 403 unless session['username'] |
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
<dict> | |
<key>name</key> | |
<string>Git Modified Line</string> | |
<key>scope</key> | |
<string>git.changes.x</string> | |
<key>settings</key> | |
<dict> | |
<key>background</key> | |
<string>#272852</string> | |
</dict> |
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
# This Patch makes it possible to retrieve row-locked records from data-objects repositories | |
# Sample Usage: User.locked.get(1) | |
# #=> SELECT [...] WHERE `id` = 1 ORDER BY `id` LIMIT 1 FOR UPDATE | |
# In user.rb | |
def self.locked | |
all(:with_locking => true) | |
end | |
# The actual patch |
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
# In config/initializers/haml_filters.rb | |
module Haml | |
module Filters | |
module Client | |
include Base | |
def compile(precompiler, text) | |
return if precompiler.options[:suppress_eval] | |
precompiler.instance_eval do | |
push_silent <<-FIRST.gsub("\n", ';') + text + <<-LAST.gsub("\n", ';') |
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 DataMapper | |
module Resource | |
def taint! property | |
self.persisted_state = State::Dirty.new(self) unless self.persisted_state.kind_of?(State::Dirty) | |
self.persisted_state.original_attributes[properties[property]] = Object.new | |
end | |
end | |
end | |
# Example: |
NewerOlder