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
def get_response(input) | |
key = RESPONSES.keys.select {|k| /#{k}/ =~ input }.sample | |
response = RESPONSES[key] | |
response.nil? ? 'sorry?' : response % { c1: $1, c2: $2} | |
end | |
RESPONSES = { 'goodbye' => 'bye', | |
'sayonara' => 'sayonara', | |
'bye (.*)' => 'bye %{c1}', | |
'woot (.*)' => 'beep %{c1}'} |
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
→ bundle exec rake spec | |
DEPRECATION WARNING: config.whiny_nils option is deprecated and no longer works. (called from block in <top (required)> at /Users/sam/Documents/Github/LocalSupport/config/environments/development.rb:10) | |
/Users/sam/.rvm/rubies/ruby-1.9.3-p547/bin/ruby -I/Users/sam/.rvm/gems/ruby-1.9.3-p547/gems/rspec-core-3.1.7/lib:/Users/sam/.rvm/gems/ruby-1.9.3-p547/gems/rspec-support-3.1.2/lib /Users/sam/.rvm/gems/ruby-1.9.3-p547/gems/rspec-core-3.1.7/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb | |
WARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.7.8 | |
DEPRECATION WARNING: config.whiny_nils option is deprecated and no longer works. (called from block in <top (required)> at /Users/sam/Documents/Github/LocalSupport/config/environments/test.rb:15) | |
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly: | |
* development - set it to false | |
* test - set it to false (unless you use a tool that preloads your test environment) |
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
→ APP_ID=6085 ninefold logs | |
Loading the logs | |
2014/11/10 07:14:19, app-harrowcn-develop-97a0, bundler.log | Using bundler 1.7.4 | |
2014/11/10 07:14:19, app-harrowcn-develop-97a0, bundler.log | Using raindrops 0.13.0 | |
2014/11/10 07:14:19, app-harrowcn-develop-97a0, bundler.log | Using ref 1.0.5 | |
2014/11/10 07:14:19, app-harrowcn-develop-97a0, bundler.log | Using sass 3.2.19 | |
2014/11/10 07:14:19, app-harrowcn-develop-97a0, bundler.log | Using redcarpet 3.2.0 | |
2014/11/10 07:14:19, app-harrowcn-develop-97a0, bundler.log | Using rack-test 0.6.2 | |
2014/11/10 07:14:19, app-harrowcn-develop-97a0, bundler.log | Using warden 1.2.3 | |
2014/11/10 07:14:19, app-harrowcn-develop-97a0, bundler.log | Using activesupport 4.0.10 |
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
# initial setup | |
rails new yelp_scaffold -d postgresql -T | |
cd yelp_scaffold/ | |
echo 'gem "twitter-bootstrap-rails"' >> Gemfile | |
bundle | |
rails generate bootstrap:install static | |
rails g scaffold Restaurant name:string description:string | |
rake db:create | |
rake db:migrate | |
rails g bootstrap:themed Restaurants |
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
2015-06-15T14:33:41.533432+00:00 app[web.1]: Rendered layouts/_meta_tags.html.erb (1.5ms) | |
2015-06-15T14:33:41.563151+00:00 app[web.1]: Rendered layouts/_event_link.html.erb (0.9ms) | |
2015-06-15T14:33:41.543912+00:00 app[web.1]: Rendered layouts/_flash.html.erb (0.3ms) | |
2015-06-15T14:33:41.572703+00:00 app[web.1]: Completed 200 OK in 434ms (Views: 20.3ms | ActiveRecord: 23.9ms) | |
2015-06-15T14:33:41.563248+00:00 app[web.1]: Rendered layouts/_round_banners.html.erb (18.6ms) | |
2015-06-15T14:33:41.572206+00:00 app[web.1]: Rendered visitors/index.html.erb (40.9ms) | |
2015-06-15T14:33:41.572113+00:00 app[web.1]: Rendered layouts/_footer.html.erb (7.7ms) | |
2015-06-15T14:33:41.534424+00:00 app[web.1]: Rendered layouts/_head.html.erb (2.8ms) | |
2015-06-15T14:33:41.544456+00:00 app[web.1]: Rendered layouts/_navbar.html.erb (9.9ms) | |
2015-06-15T14:33:47.904097+00:00 app[web.1]: Started GET "/projects/codealia/documents/codealia-org-project-presentation" for 208.115.113.84 at 2015-06-15 14:33:47 +0000 |
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
bookmark_manager git:(master) rspec | |
/Library/Ruby/Gems/2.0.0/gems/data_objects-0.10.16/lib/data_objects/quoting.rb:12:in `quote_string': no implicit conversion from nil to integer (TypeError) | |
from /Library/Ruby/Gems/2.0.0/gems/data_objects-0.10.16/lib/data_objects/quoting.rb:12:in `quote_value' | |
from /Library/Ruby/Gems/2.0.0/gems/data_objects-0.10.16/lib/data_objects/command.rb:69:in `block in escape_sql' | |
from /Library/Ruby/Gems/2.0.0/gems/data_objects-0.10.16/lib/data_objects/command.rb:62:in `gsub!' | |
from /Library/Ruby/Gems/2.0.0/gems/data_objects-0.10.16/lib/data_objects/command.rb:62:in `escape_sql' | |
from /Library/Ruby/Gems/2.0.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:34:in `execute_reader' | |
from /Library/Ruby/Gems/2.0.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:34:in `block in select' | |
from /Library/Ruby/Gems/2.0.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:276:in `with_connection' | |
from /Library/Ruby/Gems/2.0.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb |
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
[[:dom, :usman], | |
[:anthony, :catherine], | |
[:kyle, :nat], | |
[:ana, :evgenii], | |
[:alex_person, :aaron], | |
[:sarah, :moe], | |
[:lucy, :harry_venables], | |
[:harriet, :zhivko], | |
[:bat, :dan], | |
[:tim_hyson, :jongmin], |
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 'pp' | |
list = [:dom,:usman,:anthony,:catherine,:kyle,:nat,:ana,:evgenii,:alex_person,:aaron,:sarah,:moe,:lucy,:harry_venables,:harriet,:zhivko,:bat,:dan,:tim_hyson,:jongmin,:matt,:harry_dix,:yana,:archie,:philip,:adrian,:emily,:alex_lemons,:michael,:joe,:tim_harrison,:gavin,:david,:chris] | |
combos = list.combination(2).to_a | |
number_pairs = list.length / 2 | |
def alternates combos, pairs | |
combos.reject{|p| (pairs.flatten.include?(p[0]) || pairs.flatten.include?(p[1])) } | |
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
<problem> | |
<startouttext/> | |
Submissions page for <a href='https://github.com/saasbook/hw-ruby-intro'>https://github.com/saasbook/hw-ruby-intro</a>. Complete solutions for part1.rb, part2.rb, and part3.rb and submit them in a zip file for grading by the autograder. | |
Full end2end test for saasbook/rag. contact aaron.zhang@berkeley.edu | |
<endouttext/> | |
<coderesponse queuename="cs169-rev-development"> <!-- queue name should match the name of queue you asked edX to create in step 1 above --> | |
<filesubmission points="100"/> <!-- points should be consistent with 'score:' property of JSON postback in step 2 above --> | |
<codeparam> | |
<grader_payload> | |
{"assignment_name": "assignment0-ruby-intro", |
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
# run this is the relevant repo to pull out branches of all pull request | |
require 'octokit' | |
client = Octokit::Client.new \ | |
:client_id => ENV[GITHUB_CLIENT_ID], | |
:client_secret => ENV[GITHUB_CLIENT_SECRET] | |
pulls = client.pull_requests 'makersacademy/takeaway-challenge', state: 'open', per_page: 100 |