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
module ApplicationHelper | |
def e_tag(model) | |
eval("link_to image_tag(\'pencil.png\'), edit_#{model.class.name.underscore}_path(model)") | |
end | |
def d_tag(model) | |
eval("link_to image_tag(\'delete.png\'), model, :confirm => \'Are you sure?\', :method => :delete") | |
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
TherapistReport.send(:with_exclusive_scope) { | |
@last_tr = TherapistReport.find(:all, :conditions => ["report_id = ? AND therapist_id = ? AND report.territory_id = ? ", self.report.previous, self.therapist_id, self.report.territory_id], :include => [:report]) | |
} |
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
module ActionView | |
module Helpers | |
class InstanceTag | |
def to_check_box_tag(options = {}, checked_value = "1", unchecked_value = "0") | |
options = options.stringify_keys | |
options["type"] = "checkbox" | |
options["value"] = checked_value | |
if options.has_key?("checked") | |
cv = options.delete "checked" | |
checked = cv == true || cv == "checked" |
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
Let's make a list of Sinatra-based apps! | |
Apps: | |
- http://github.com/cschneid/irclogger "Sinatra based irclogger.com" | |
- http://github.com/rtomayko/wink "minimalist blogging engine" | |
- http://github.com/foca/integrity "The easy and fun Continuous Integration server" | |
- http://github.com/sr/git-wiki "git-powered wiki" | |
- http://github.com/entp/seinfeld "Seinfeld-inspired productivity calendar to track your public github commits." | |
- http://github.com/karmi/marley "Marley, the blog engine without <textareas>." | |
- http://github.com/ichverstehe/gaze "Serve up your Markdown files with this tiny Sinatra app!" |
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
[08:48 AM:gist-99771(master)] $ irb -rubygems -r myapp.rb -r rack/test | |
>> app = Rack::Test::Session.new(Sinatra::Application) | |
=> #<Rack::Test::Session:0x17e8820 @headers={}, @app=Sinatra::Application> | |
>> app.get '/' | |
=> #<Rack::Response:0x17ad4dc @block=nil, @writer=#<Proc:0x0189f7b4@/opt/local/lib/ruby/gems/1.8/gems/rack-0.9.1/lib/rack/response.rb:24>, header{"Content-Type"=>"text/html", "Content-Length"=>"7"}, body["testing"], length7, status200 | |
>> app.body | |
NoMethodError: undefined method `body' for #<Rack::Test::Session:0x17e8820> | |
from (irb):3 |
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
var Favorite = { | |
client_name: "", | |
client_id: "", | |
user_id: "", | |
add_or_remove: "", | |
getID: function(params){ | |
this.client_name = params.attr("client_name"); | |
this.client_id = params.attr("client_id"); | |
this.user_id = params.attr("user_id"); |
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
(function($) { | |
$("#assign_pub_to_trans").click(function(){ | |
$(this).removeClass("unselected").addClass("selected").val("1"); | |
$("#assign_age_to_trans").removeClass("selected").addClass("unselected").val("0"); | |
}); | |
$("#assign_age_to_trans").click(function(){ | |
$(this).removeClass("unselected").addClass("selected").val("1"); | |
$("#assign_pub_to_trans").removeClass("selected").addClass("unselected").val("0"); |
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
;(function($) { | |
$.fn.soon = function(what, when) { | |
var $this, args; | |
if (typeof when == "undefined") when = 5000; | |
args = $.makeArray(arguments).slice(2); | |
$this = $(this); | |
setTimeout(function() { | |
$this[what].apply($this,args); | |
}, when); | |
return $this; |
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
(function( $ ) { | |
$.event.special.hashchange = { | |
setup: function( data, namespaces) { | |
if ( 'onhashchange' in window ) { | |
// sweet, native support... short-circuit | |
return false; | |
} | |
// onhashchange is not natively supported ... work around it :( | |
fakeHashChange(); | |
}, |
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
# 9 workers and 1 master | |
worker_processes 9 | |
# Load rails+github.git into the master before forking workers | |
# for super-fast worker spawn times | |
preload_app true | |
# Restart any workers that haven't responded in 30 seconds | |
timeout 30 |
OlderNewer