Skip to content

Instantly share code, notes, and snippets.

View cnk's full-sized avatar

Cynthia Kiser cnk

View GitHub Profile
## 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
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
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:
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)
@cnk
cnk / gist:6216
Created August 19, 2008 18:37 — forked from haikuwebdev/gist:6215
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')
@cnk
cnk / user.rb
Created January 10, 2012 02:59
FactoryGirl and protected attributes
class User < ActiveRecord::Base
# devise configuration info omitted
# admin column is defined with :default => false
attr_accessible :email, :password, :password_confirmation
end
@cnk
cnk / .rvmrc
Created July 15, 2012 18:00
.rvmrc file for RideBum
.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
@cnk
cnk / test.py
Created January 26, 2016 23:49
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
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,
.
----------------------------------------------------------------------
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.'}