Skip to content

Instantly share code, notes, and snippets.

View brobertsaz's full-sized avatar

Bob Roberts brobertsaz

  • Self
  • Madison, WI
  • 15:21 (UTC -06:00)
View GitHub Profile
@brobertsaz
brobertsaz / js_for_changing_options
Created September 12, 2012 21:35
changing options_for_select from one selector
%table
%tr
%td
= f.label :share_type, 'Share Type', class: 'required'
%td
= f.select :share_type, @share_types, {}, class: 'share-type', id: 'selected_share_type'
%tr
%td
= f.label :share_expiration_date, 'Expiration Date', class: 'required'
@brobertsaz
brobertsaz / dropdown_table
Created September 15, 2012 21:49
table for dropdowns
%table
%tr
%td
= f.label :share_type, 'Share Type', class: 'required'
%td
= f.select :share_type, @share_types, {}, class: 'share-type', id: 'selected_share_type'
%tr
%td
= f.label :share_expiration_date, 'Expiration Date', class: 'required'
@brobertsaz
brobertsaz / js_1
Created September 15, 2012 21:50
js_1
var initSubOptions = function(){
$('#selected_share_type').change(function() {
populateSubOptions($(this).val());
});
};
$(document).ready(function(){
initSubOptions();
});
@brobertsaz
brobertsaz / js_2
Created September 15, 2012 22:07
js_2
var populateSubOptions = function(selectedOption) {
if (selectedOption == 'share_across') {
$('#share_exp_dates select').empty().append(optionsFromArray(share_across_options));
} else {
$('#share_exp_dates select').empty().append(optionsFromArray(share_down_options));
}
};
@brobertsaz
brobertsaz / js_3
Created September 15, 2012 22:13
js_3
var share_across_options = #{@share_across_dates};
var share_down_options = #{@share_down_dates};
var optionsFromArray = function(array){
var options = '';
$(array).each(function(index, item){
options += '<option value="' + item[1] + '">' + item[0] + '</option>'
});
return options;
};
@brobertsaz
brobertsaz / devise1
Created November 5, 2012 22:24
devise login failure
[1] pry(#<RSpec::Core::ExampleGroup::Nested_1>)> @user
=> #<User id: 7, is_active: true, is_admin: false, specialty_id: 0, state_id: nil, email: "[email protected]", password: "", first_name: nil, last_name: nil, send_email: nil, last_visit_date: nil, city: nil, zip: nil, encrypted_password: "$2a$04$9ktAdsmN27rQDBIDjWnYfufwFOSP8CKBiuHBz6BYKAu8...", password_salt: nil, reset_password_token: nil, sign_in_count: 0, failed_attempts: 0, current_sign_in_ip: nil, last_sign_in_ip: nil, confirmed_at: nil, created_at: "2012-11-05 22:19:28", current_sign_in_at: nil, last_sign_in_at: nil, locked_at: nil, remember_created_at: nil, reset_password_sent_at: nil, updated_at: "2012-11-05 22:19:28">
[2] pry(#<RSpec::Core::ExampleGroup::Nested_1>)> @user.password
=> "password"
@brobertsaz
brobertsaz / ruby-install
Created December 6, 2012 00:00
ruby-install
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure
make
@brobertsaz
brobertsaz / server-build
Created December 6, 2012 00:04
server-build
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev curl git-core python-software-properties libxslt1-dev libxml2-dev libmysqlclient-dev libsqlite3-dev nodejs
@brobertsaz
brobertsaz / pass-nginx
Created December 6, 2012 00:05
pass-nginx
sudo gem install passenger
sudo passenger-install-nginx-module
* Choose Option 1. Yes: download, compile and install Nginx for me. (recommended)
* Accept all defaults during the install process
@brobertsaz
brobertsaz / nginx-control
Created December 6, 2012 00:06
nginx-control
wget -O init-deb.sh http://library.linode.com/assets/660-init-deb.sh
sudo mv init-deb.sh /etc/init.d/nginx
sudo chmod +x /etc/init.d/nginx
sudo /usr/sbin/update-rc.d -f nginx defaults