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
# app/models/user_extensions/admin.rb | |
module UserExtensions | |
module Admin | |
extend ActiveSupport::Concern | |
ADMIN = 'admin' | |
module ClassMethods |
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
# CANDY Extension | |
PROMPT_PREFIX="%{$fg[blue]%}[%{$reset_color%}" | |
PROMPT_SUFFIX="$fg[blue]%}]%{$reset_color%}" | |
HOST_PROMPT="%{$fg_bold[green]%}%n@%m" | |
DATE_PROMPT="$PROMPT_PREFIX%{$fg[red]%}%D{%I:%M:%S}$PROMPT_SUFFIX" | |
PWD_PROMPT="$PROMPT_PREFIX%{$fg[white]%}%~$PROMPT_SUFFIX" | |
LEADER_PROMPT="%{$fg_bold[blue]%}\$%{$reset_color%}" | |
# Get the current ruby version in use with RVM: |
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
# Use local clones if possible. | |
# If you want to use your local copy, just symlink it to vendor. | |
def custom_gem(name, options = Hash.new) | |
local_path = File.expand_path("../vendor/#{name}", __FILE__) | |
if File.exist?(local_path) | |
gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) } | |
else | |
gem name, options | |
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
ActiveRecord::Base.class_eval do | |
public :callback | |
def self.define_background_callback(callback_name) | |
class_eval <<-RUBY | |
define_callbacks :background_#{callback_name} # define_callbacks :background_after_create | |
# | |
#{callback_name} do |object| # after_create do |object| | |
object.queue_background_callbacks(:#{callback_name}) # object.queue_background_callbacks(:after_create) | |
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
# Don't need passwords in test DB to be secure, but we would like 'em to be | |
# fast -- and the stretches mechanism is intended to make passwords | |
# computationally expensive. | |
module Devise | |
module Models | |
module DatabaseAuthenticatable | |
protected | |
def password_digest(password) | |
password |
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
RSpec.configure do |config| | |
config.around(:each, :caching) do |example| | |
caching = ActionController::Base.perform_caching | |
ActionController::Base.perform_caching = example.metadata[:caching] | |
example.run | |
Rails.cache.clear | |
ActionController::Base.perform_caching = caching | |
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
module MyModule | |
extend ActiveSupport::Concern | |
# removed code that modified User when | |
# including this module in Article | |
end | |
module OrderedByCounter | |
extend ActiveSupport::Concern | |
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
<!DOCTYPE html> | |
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title></title> | |
<meta name="description" content=""> |
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
<!DOCTYPE html> | |
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title></title> | |
<meta name="description" content=""> |
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
include Trello | |
include Trello::Authorization | |
Trello::Authorization.const_set :AuthPolicy, OAuthPolicy | |
OAuthPolicy.consumer_credential = OAuthCredential.new('user_key', 'user_secret') | |
threads = [] | |
tokens = %w[ not_rosstas_token rosstas_token ] | |
tokens.each_with_index do |token, i| |