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 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 => '[email protected]', :password => 'abenter', :password_confirmation => 'abenter') |
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 | |
# devise configuration info omitted | |
# admin column is defined with :default => false | |
attr_accessible :email, :password, :password_confirmation | |
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
.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 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
## 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 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
application 'foo' do | |
path '/srv/ads/rails/foo' | |
owner 'rails' | |
group 'rails' | |
repository '[email protected]:...' | |
revision 'master' | |
rollback_on_error false | |
# Apply the rails LWRP from application_ruby |
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 ApplicationController < ActionController::Base | |
# omitted stuff | |
private | |
# Used to correct content type for files uploaded with bulkupload or from PicMonkey | |
def correct_content_type_for_octet_stream(filedata) | |
return nil if filedata.blank? | |
# see what the unix file command thinks this is | |
if filedata.content_type == 'application/octet-stream' | |
filedata.content_type = type_from_file_command(filedata.path) | |
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
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 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 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 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
$ chef-client --once --local-mode --config /\ | |
Users/cnk/Code/sandbox/customizing_chef/part3_examples/solo.rb --override-runlist testcookbook::default | |
Starting Chef Client, version 12.3.0 | |
[2015-07-09T17:08:42-07:00] WARN: Run List override has been provided. | |
[2015-07-09T17:08:42-07:00] WARN: Original Run List: [] | |
[2015-07-09T17:08:42-07:00] WARN: Overridden Run List: [recipe[testcookbook::default]] | |
resolving cookbooks for run list: ["testcookbook::default"] | |
Synchronizing Cookbooks: | |
- testcookbook | |
Compiling Cookbooks... |
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
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 |
OlderNewer