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
# Disable Rails's static asset server (Apache or nginx will already do this) | |
config.serve_static_assets = true | |
config.middleware.insert_after(::Rack::Lock, "::Rack::Auth::Basic", "Staging") do |u, p| | |
[u, p] == [ENV['BASIC_AUTH_USER'], ENV['BASIC_AUTH_PASSWORD']] | |
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
set t_Co=256 | |
set shell=bash | |
set nocompatible " be iMproved | |
filetype off " required! | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
Bundle 'gmarik/vundle' | |
if filereadable(expand('~/.vim/Vunfile')) | |
source ~/.vim/Vunfile |
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
# alias to macvim for ruby support | |
alias vim='/Applications/MacVim.app/Contents/MacOS/Vim' |
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
def fill_in_tinymce(frame_id, options) | |
page.execute_script(%{tinyMCE.editors['tinymce-#{frame_id}'].setContent('#{options[:with]}')}) | |
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
def wait_for_ajax(timeout = 5) #Timeout in seconds | |
page.wait_until(timeout) do | |
page.evaluate_script "angular.element.active == 0 && jQuery.active == 0" | |
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
class User < ActiveRecord::Base | |
def update_with_password(params, *options) | |
_current_password = params[:current_password] | |
_password = params[:password] | |
_password_confirmation = params[:password_confirmation] | |
unless _current_password.blank? | |
if _password.blank? | |
errors.add(:password, "can't be blank") | |
false | |
else |
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
private | |
def force_ssl | |
if Rails.env.production? | |
if !request.ssl? | |
redirect_to :protocol => 'https' | |
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
# Gemfile | |
… | |
gem 'uuidtools' | |
… |
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
angular.module("app.Standards", []) | |
.config(function($httpProvider, $locationProvider) { | |
$locationProvider.html5Mode(false); | |
$locationProvider.hashPrefix('!'); | |
$httpProvider.defaults.headers. | |
common['X-CSRF-Token'] = $('meta[name=csrf-token]').attr('content'); | |
}) |
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 TablelessModel | |
include ActiveModel::Validations | |
include ActiveModel::Conversion | |
extend ActiveModel::Naming | |
def initialize(attributes = {}) | |
attributes.try(:each) do |name, value| | |
send("#{name}=", value) | |
end | |
end |