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
## afer installing ruby 2.2.0 with ruby_build_ruby | |
## and setting | |
# default['passenger']['ruby_bin'] = '/usr/local/bin/ruby' | |
# in my cookbook's attributes/default.rb | |
[vagrant@default-centos-65 ~]$ cat /etc/httpd/mods-enabled/passenger.conf | |
PassengerRoot /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/passenger-4.0.53 | |
PassengerRuby /usr/local/bin/ruby | |
PassengerMaxPoolSize 6 |
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
application 'foo' do | |
path '/srv/ads/rails/foo' | |
owner 'rails' | |
group 'rails' | |
repository 'git@bitbucket.org:...' | |
revision 'master' | |
rollback_on_error false | |
# Apply the rails LWRP from application_ruby |
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
In the parent cookbook's attributes/default.rb: | |
default['dev-django-skeleton']['database']['host'] = "127.0.0.1" | |
In my wrapper cookbook's attributes/default.rb: | |
normal['dev-django-skeleton']['database']['host'] = "an RDS name" | |
In my kitchen.yml for the local Vagrant: | |
attributes: { dev-django-skeleton: { database: { host: "127.0.0.1" } } } | |
When I run 'kitchen converge'', this if statement is consistently evaluating to the RDS 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
cat import_experts.rake | |
# | |
#use FasterCSV for importing from our file | |
require 'fastercsv' | |
# We are working from an FMP export that should contain the following fields: | |
# | |
# Person id | |
# Caltech UID | |
# First name (with middle initial) |
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
require File.dirname(__FILE__) + '/../test_helper' | |
class EditorActionsTest < ActionController::IntegrationTest | |
# CNK not sure if we are going to use fixtures | |
# I would prefer to use factories but am having trouble with that | |
# fixtures :users, :roles, :roles_users, :pages | |
def setup | |
@home_page = Factory.create_home_page | |
@editor = Factory.create_user_with_role('editor', :login => 'abenter', :email => 'abenter@caltech.edu', :password => 'abenter', :password_confirmation => 'abenter') |
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 | |
# devise configuration info omitted | |
# admin column is defined with :default => false | |
attr_accessible :email, :password, :password_confirmation | |
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
.rvmrc | |
if [[ -s "/home/cnk/.rvm/environments/ruby-1.9.3-p194@Ride-Bum" ]] ; then | |
. "/home/cnk/.rvm/environments/ruby-1.9.3-p194@Ride-Bum" | |
else | |
rvm --create use "ruby-1.9.3-p194@Ride-Bum" | |
fi |
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
seen = StudentMaterialIndividualization.objects.filter(student=student_id, | |
material__knowledge_goal=knowledge_goal) \ | |
.order_by('started_at') | |
for item in seen: | |
material = MaterialVersion.objects.filter(material_key=item.material_key, version=item.version) | |
# I am trying to end up with a list of materials so would like to query MaterialVersion but based on restrictions from StudentMaterialIndividualization |
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
require 'RMagick' | |
class BackgroundImage < ActiveRecord::Base | |
attr_accessible :parent_id, :uploaded_data, :filename | |
has_one :child, :class_name => "BackgroundImage", :foreign_key => :parent_id | |
# You may want to pass other options to has_attachment. | |
# See the attachment_fu README. | |
has_attachment :content_type => :image, |
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
. | |
---------------------------------------------------------------------- | |
Ran 1 test in 0.412s | |
OK | |
BUT if I change from force_authentication to the login line, | |
403 | |
{'detail': 'CSRF Failed: CSRF cookie not set.'} |
OlderNewer