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
| Alloy.Globals.insertViewAt = function(parent, element, index) { | |
| var children = parent.children.slice(0); | |
| for(var i = 0; i < children.length; ++i){ | |
| parent.remove(children[i]); | |
| } | |
| if(index >= 0) { | |
| var tmp = children.slice(0, index); | |
| tmp.push(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
| working_directory "<%= current_path %>" | |
| pid "<%= unicorn_pid %>" | |
| stderr_path "<%= unicorn_log %>" | |
| stdout_path "<%= unicorn_log %>" | |
| listen "/tmp/unicorn.<%= application %>.sock" | |
| worker_processes <%= unicorn_workers %> | |
| timeout 30 | |
| preload_app true |
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_default(:unicorn_user) { user } | |
| set_default(:unicorn_pid) { "#{current_path}/tmp/pids/unicorn.pid" } | |
| set_default(:unicorn_config) { "#{shared_path}/config/unicorn.rb" } | |
| set_default(:unicorn_log) { "#{shared_path}/log/unicorn.log" } | |
| set_default(:unicorn_workers, 2) | |
| namespace :unicorn do | |
| desc "Setup Unicorn initializer and app configuration" | |
| task :setup, roles: :app do | |
| run "mkdir -p #{shared_path}/config" |
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
| #!/bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: unicorn | |
| # Required-Start: $remote_fs $syslog | |
| # Required-Stop: $remote_fs $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Manage unicorn server | |
| # Description: Start, stop, restart unicorn server for a specific application. | |
| ### END INIT INFO |
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 | |
| def user_type | |
| "system_admin" | |
| end | |
| def self.user_types_for user | |
| types = [] | |
| case user.user_type | |
| when "system_admin" | |
| types << "system_admin" |
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
| cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> ~/.ssh/authorized_keys' |
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 'spec_helper' | |
| describe Account do | |
| context "#validations" do | |
| it{ FactoryGirl.build(:account).should be_valid } | |
| it{ FactoryGirl.build(:account, name: "").should be_invalid } | |
| it{ | |
| FactoryGirl.build(:account, contact_email: "[email protected]").should be_valid |
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
| begin | |
| rails_env = Rails.env | |
| # Load the redis.yml configuration file | |
| redis_config = YAML.load_file(Rails.root + 'config/leaderboard_redis.yml')[rails_env] | |
| # Connect to Redis using the redis_config host and port | |
| if redis_config | |
| redis = Redis.new(host: redis_config['host'], port: redis_config['port']) | |
| redis_options = {:redis_connection => redis} | |
| HIGHSCORE_LB = Leaderboard.new('highscores', Leaderboard::DEFAULT_OPTIONS, redis_options) |
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
| #USER MODEL [just the relevant parts] | |
| has_many :sent_invitations, :class_name=>"Invitation", :foreign_key=>:sender_id | |
| validate :check_for_invitation, :on=>:create | |
| private | |
| def check_for_invitation | |
| errors.add :email, 'has not been invited' unless Gxtended::Invitation.where(:recipient_email=>email).exists? | |
| end | |
| #INVITATION MODEL |
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
| //Model - acknowledges validation but never approves it | |
| validates :agreed_to_terms, :acceptance => true, :allow_nil => false | |
| //Model - completely ignores validation | |
| validates :agreed_to_terms, :acceptance => true | |
| //Full Model | |
| class User < ActiveRecord::Base | |
| self.table_name = 'users' | |