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
alias project='cd ~/path/to/project/; rm log/test.log && rm log/development.log; touch log/test.log && touch log/development.log && git branch' |
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
desc 'Run the sqlite dump after deploy' | |
task :sqlite_dump_dev do | |
rake = fetch(:rake, 'rake') | |
rails_env = fetch(:rails_env, 'development') | |
run "cd '#{current_path}' && #{rake} sqlite_dump RAILS_ENV=#{rails_env}" | |
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
$("form#new_note").bind("ajax:success", function(xhr, data, status){ | |
// this is where the success stuff goes | |
}); |
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
jQuery.fn.limitMaxlength = function(options){ | |
var settings = jQuery.extend({ | |
attribute: "maxlength", | |
onLimit: function(){}, | |
onEdit: function(){} | |
}, options); | |
// Event handler to limit the textarea | |
var onEdit = function(){ |
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 CreateAttributes < ActiveRecord::Migration | |
def change | |
end | |
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
<%-- This block checks the number of items in a contentloop | |
---------------------------------------------------------------------------------- --%> | |
<cms:contentaccess var="content" scope="page" /> | |
<c:set var="count" value="${fn:length(content.valueList['Bottom'])}" /> | |
<%-- End the check | |
----------------------------------------------------------------------------------- --%> |
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 ApplicationController < ActionController::Base | |
helper_method :current_account, :current_user # you may have others that go here too | |
private | |
# I added this so that way I can just use current_account just like current_user | |
def current_account | |
@current_account = Account.find_by_subdomain(request.subdomain) | |
return @current_account |
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 ApplicationController < ActionController::Base | |
helper_method :current_account, :current_user # you may have others that go here too | |
private | |
# I added this so that way I can just use current_account just like current_user | |
def current_account | |
@current_account = Account.find_by_subdomain(request.subdomain) | |
return @current_account |
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 UserSessionsController < ApplicationController | |
def new | |
@user_session = current_account.user_sessions.build | |
end | |
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
class Account < ActiveRecord::Base | |
has_many :users | |
authenticates_many :user_sessions, :scope_cookies => true | |
# Other code by you | |
end |