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 UserSession < Authlogic::Session::Base | |
| def self.twitter_consumer | |
| @twitter_consumer ||= OAuth::Consumer.new( | |
| TwitterOAuthConsumerKey, | |
| TwitterOAuthSecretKey, | |
| :site => "http://twitter.com" | |
| ) | |
| end | |
| def authorize_via_twitter |
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
| # Ended up overriding send. | |
| # Seems a bit intense, but action-args are too awesome to not use. | |
| class ActionController::Base | |
| class << self | |
| attr_accessor :action_argument_list | |
| alias_method :old_inherited, :inherited | |
| # Stores the argument lists for all methods for this class. |
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
| //Useful Error Handling for dev mode JavaScript | |
| jQuery().ajaxError(function(event, xhr) { | |
| jQuery().html(xhr.responseText); | |
| }); |
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
| selector = '$' | |
| property = ':' | |
| mixin = '+' | |
| color = '#' | |
| values = '=' | |
| sibling = 'enter' | |
| child = 'shift+enter' |
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
| function load_styles_jquery_tree() { | |
| jQuery("head").append("\ | |
| <style>\ | |
| \ | |
| li.tree_node label {\ | |
| display: inline; }\ | |
| li.tree_node label, li.tree_node input.tag_name {\ | |
| color: blue;\ | |
| font-weight: bold; }\ | |
| li.tree_node .element {\ |
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
| # staging specific code | |
| git diff staging config/initializers/current_host.rb | git apply -R | |
| # production specific code | |
| git diff production config/initializers/current_host.rb | git apply -R | |
| # stuff like storing base urls | |
| # BaseUrl = "staging.example.com" vs BaseUrl = "example.com" |
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 AbstractController | |
| class Base | |
| private | |
| # Modification of abstract controllers process action to take and | |
| # pass on any arguments to "send_action" (currently alias for "send") | |
| def process_action(*args) | |
| send_action(*args) | |
| end | |
| 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
| get 'http://github.com/githubapi'+window.location.href.match(/~(.*)/)[1] | |
| user.repositories.each fun repository | |
| $#repositories | |
| .append render(:repository, repository) | |
| def show_messages | |
| &.winner | |
| .removeClass :winner | |
| $.repository:not(.faded) | |
| &:unique? |
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
| Element.first(:node_type => :body, :id.starts_with => 'project').all(:node_type => :input, :id.ends_with => 'at') |
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
| require 'authlogic' | |
| require 'metaid' | |
| class User | |
| include DataMapper::Resource | |
| attr_accessor :password_confirmation | |
| class << self | |
| def < klass |