Skip to content

Instantly share code, notes, and snippets.

@allenwlee
allenwlee / Questions.md
Last active August 29, 2015 14:01
Parsing Data - Code Test
  1. In the attached file (w_data.dat), you’ll find daily weather data. Download this text file, then write a program to output the day number (column one) with the smallest temperature spread (the maximum temperature is the second column, the minimum the third column).

  2. The attached soccer.dat file contains the results from the English Premier League. The columns labeled ‘F’ and ‘A’ contain the total number of goals scored for and against each team in that season (so Arsenal scored 79 goals against opponents, and had 36 goals scored against them). Write a program to print the name of the team with the smallest difference in ‘for’ and ‘against’ goals.

Is the way you wrote the second program influenced by writing the first?

>I used the same program for both questions.

2014-05-25T14:35:10.173962+00:00 app[web.1]: Started POST "/carts" for 172.249.82.217 at 2014-05-25 14:35:10 +0000
2014-05-25T14:35:10.177726+00:00 app[web.1]: Processing by CartsController#create as JS
2014-05-25T14:35:10.177820+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "cart"=>{"project_id"=>"60", "carts_packages_attributes"=>[{"package_id"=>"3"}]}}
2014-05-25T14:35:10.179528+00:00 app[web.1]: "CARTCONTROLLER#CREATE: CART_PARAMS: {\"project_id\"=>\"60\", \"carts_packages_attributes\"=>[{\"package_id\"=>\"3\"}]}"
2014-05-25T14:35:20.342226+00:00 heroku[router]: at=info method=POST path=/carts host=studiocomps-a-1.herokuapp.com request_id=7acd814b-ba56-4251-807f-40a858269058 fwd="172.249.82.217" dyno=web.1 connect=2ms service=10169ms status=200 bytes=5975
2014-05-25T14:35:20.326543+00:00 app[web.1]: "heyyy values!! time: 2014-05-25 07:35:20 -0700"
2014-05-25T14:35:20.326601+00:00 app[web.1]: "{:business=>\"allen-facilitator@[r].com\", :cmd=>\"_cart\", :upload=>1, :invoice=>1048, :rm=>2, :cert_id=>\"[r]\",
2014-05-25T14:48:08.417783+00:00 heroku[router]: at=info method=POST path=/carts host=test.studiocomps.com request_id=e51247e2-59f2-47ac-8603-5cd18071dc00 fwd="172.249.82.217" dyno=web.1 connect=1ms service=107ms status=200 bytes=5971
2014-05-25T14:48:08.312336+00:00 app[web.1]: Started POST "/carts" for 172.249.82.217 at 2014-05-25 14:48:08 +0000
2014-05-25T14:48:08.412658+00:00 app[web.1]: "heyyy values!! time: 2014-05-25 07:48:08 -0700"
2014-05-25T14:48:08.412699+00:00 app[web.1]: "{:business=>\"allen-facilitator@[r].com\", :cmd=>\"_cart\", :upload=>1, :invoice=>1049, :rm=>2, :cert_id=>\"[r]\", \"amount_1\"=>#<Money fractional:9900 currency:USD>, \"item_name_1\"=>\"Basic\", \"item_number_1\"=>2, \"quantity_1\"=>\"1\"}"
2014-05-25T14:48:08.412705+00:00 app[web.1]: "heyyy encrypted!!!"
2014-05-25T14:48:08.414632+00:00 app[web.1]: "-----BEGIN PKCS7-----MIIIFQYJKoZIhvcNAQcDoIIIBjCCCAICAQAxggE6MIIBNgIBADCBnjCBmDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRUwEwYDVQQKEwxQYXlQYWwsIEluYy4
<div class='col-sm-6 text-center'>
<%= form_tag "https://www.sandbox.paypal.com/cgi-bin/webscr" do %>
<%= hidden_field_tag :project_id, @cart.project_id %>
<%= hidden_field_tag :cmd, "_s-xclick" %>
<%= hidden_field_tag :rm, 2 %>
<%= hidden_field_tag :encrypted, @cart.paypal_encrypted(projects_purchase_path, payment_notifications_path) %>
<%= submit_tag "Checkout", class: 'btn btn-success' %>
<% end %>
</div>
def user_params
params.fetch(:user, {}).permit(:id, :production_media_users_attributes: [:id, :user_id, {production_medium_id: []}])
end
def project_params
params.fetch(:project, {}).permit(:id, genres_projects_attributes: [:id, :project_id, {genre_id: []}])
end
@allenwlee
allenwlee / rvmerrors.txt
Created November 2, 2014 18:46
rvm update stable message
Allens-MacBook-Pro:/ allenwlee$ rvm get stable
######################################################################## 100.0%
Downloading https://github.com/wayneeseguin/rvm/archive/1.26.0.tar.gz
Downloading https://github.com/wayneeseguin/rvm/releases/download/1.26.0/1.26.0.tar.gz.asc
Found PGP signature at: 'https://github.com/wayneeseguin/rvm/releases/download/1.26.0/1.26.0.tar.gz.asc',
but no GPG software exists to validate it, skipping.
Upgrading the RVM installation in /Users/allenwlee/.rvm/
RVM PATH line found in /Users/allenwlee/.bashrc /Users/allenwlee/.zshrc.
RVM sourcing line found in /Users/allenwlee/.bash_profile /Users/allenwlee/.zprofile.
@allenwlee
allenwlee / gem_update
Last active August 29, 2015 14:15
gem update list
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Installing rake 10.4.2 (was 10.3.2)
Installing CFPropertyList 2.3.0
Using i18n 0.7.0 (was 0.6.11)
Installing json 1.8.2 (was 1.8.1)
Installing minitest 5.5.1 (was 4.7.5)
Using thread_safe 0.3.4
Using tzinfo 1.2.2 (was 0.3.41)
@allenwlee
allenwlee / error_log
Last active August 29, 2015 14:15
error log
$ foreman s
13:13:15 web.1 | started with pid 71730
13:13:16 web.1 | I, [2015-02-16T13:13:16.818763 #71730] INFO -- : Refreshing Gem list
13:13:21 web.1 | ~/config/initializers/backtrace_silencers.rb:8:in `<top (required)>': undefined method `silence_core_extensions_deprecations=' for Money:Class (NoMethodError)
13:13:21 web.1 | from /usr/local/var/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
13:13:21 web.1 | from /usr/local/var/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
13:13:21 web.1 | from /usr/local/var/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
13:13:21 web.1 | from /usr/local/var/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
13:13:21 web.1 | from /usr/local/var/rbenv/versions/2.1.5/lib/ruby/g