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
def generate_password(length=6) | |
chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ23456789' | |
password = '' | |
length.times { password << chars[rand(chars.length)] } | |
password | |
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
ActiveAdmin.register User do | |
index do | |
column :id | |
column :full_name, sortable: :last_name | |
column :status | |
default_actions | |
end | |
filter :first_name |
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 | |
before_filter :set_rand_cookie | |
private | |
def set_rand_cookie | |
return if cookies[:rand_seed].present? | |
cookies[:rand_seed] = {value: rand(100), expires: Time.now + 900} | |
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
<%= form_tag form_submit_path do %> | |
<fieldset> | |
<legend>Contact Info</legend> | |
<div class="form-group"> | |
<%= label_tag :name %> | |
<%= text_field_tag :name %> | |
</div> | |
<div class="form-group"> |
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
ActiveAdmin.register User do | |
# ...truncated code... | |
controller do | |
def create | |
super do |format| | |
redirect_to collection_url and return if resource.valid? | |
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
# handle api errors | |
$.ajaxSetup | |
statusCode: | |
401: -> | |
# authentication error | |
404: -> | |
# not found | |
500: -> | |
# application error |
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
if application "Rdio" is running then | |
tell application "Rdio" to playpause | |
else if application "iTunes" is running then | |
tell application "iTunes" to playpause | |
end if | |
if application "Rdio" is running then | |
tell application "Rdio" to next track | |
else if application "iTunes" is running then | |
tell application "iTunes" to next track |
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
guard "spork", rspec_env: { "RAILS_ENV" => "test" }, rspec_port: 8999 do | |
watch("config/application.rb") | |
watch("config/environment.rb") | |
watch("config/environments/test.rb") | |
watch(%r{^config/initializers/.+\.rb$}) | |
watch("Gemfile") | |
watch("Gemfile.lock") | |
watch("spec/spec_helper.rb") { :rspec } | |
watch(%r{^spec/factories/.+\.rb$}) | |
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
{ | |
"auto_complete": false, | |
"binary_file_patterns": | |
[ | |
"*.dds", | |
"*.eot", | |
"*.gif", | |
"*.ico", | |
"*.jar", | |
"*.jpeg", |
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 User < ActiveRecord::Base | |
belongs_to :organization | |
has_many :projects | |
validates :name, :presence => true | |
validates :email, :uniqueness => true | |
end |
OlderNewer