Skip to content

Instantly share code, notes, and snippets.

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
# 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.
//Useful Error Handling for dev mode JavaScript
jQuery().ajaxError(function(event, xhr) {
jQuery().html(xhr.responseText);
});
selector = '$'
property = ':'
mixin = '+'
color = '#'
values = '='
sibling = 'enter'
child = 'shift+enter'
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 {\
# 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"
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
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?
Element.first(:node_type => :body, :id.starts_with => 'project').all(:node_type => :input, :id.ends_with => 'at')
require 'authlogic'
require 'metaid'
class User
include DataMapper::Resource
attr_accessor :password_confirmation
class << self
def < klass