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
    
  
  
    
  | # 1. Briefly explain what the following code does. | |
| # 2. Is there anything wrong with it? | |
| # 3. How would you resolve the problems (if any exist)? | |
| # Assume League, Team, Player models | |
| # League <has_many> teams | |
| # Team <has_many> players | |
| # Player has boolean column all_star | |
| def all_stars(league_name) | |
| league = League.find_by_name league_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
    
  
  
    
  | begin | |
| require 'awesome_print' | |
| Pry.config.print = proc { |output, value| Pry::Helpers::BaseHelpers.stagger_output("=> #{value.ai}", output) } | |
| rescue LoadError => err | |
| puts "no awesome_print :(" | |
| end | |
| Pry.commands.alias_command 'c', 'continue' | |
| Pry.commands.alias_command 's', 'step' | |
| Pry.commands.alias_command 'n', 'next' | 
  
    
      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
    
  
  
    
  | # .git/hook/pre-commit | |
| #!/bin/sh | |
| # | |
| # Check for ruby style errors | |
| red='\033[0;31m' | |
| green='\033[0;32m' | |
| yellow='\033[0;33m' | |
| NC='\033[0m' | 
  
    
      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 'rubygems' | |
| require 'nokogiri' | |
| require 'open-uri' | |
| page = Nokogiri::HTML(open('/Users/kumar064/Desktop/KnowingPeople.htm')) | |
| output_file = File.open('/Users/kumar064/Documents/Children_of_tomorrow.txt', 'w') | |
| # puts page | |
| page.css('p').each do |el| | 
  
    
      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
    
  
  
    
  | Lesson 1 SUMMARY | |
| 1. The cursor is moved using either the arrow keys or the hjkl keys. | |
| h (left) j (down) k (up) l (right) | |
| 2. To start Vim from the shell prompt type: vim FILENAME <ENTER> | |
| 3. To exit Vim type: <ESC> :q! <ENTER> to trash all changes. | |
| OR type: <ESC> :wq <ENTER> to save the changes. | 
  
    
      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 'rubygems' | |
| require 'nokogiri' | |
| require 'open-uri' | |
| page = Nokogiri::HTML(open('/Users/kumar064/Documents/suno_laddakh_notebook.html')) | |
| output_file = File.open('/Users/kumar064/Documents/parsed_suno_laddakh_notebook.txt', 'w') | |
| page.css('div.noteText').each do |el| | |
| output_file.write el.children.first.text | 
  
    
      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
    
  
  
    
  | # Example from: http://snipplr.com/view/37063/ | |
| include Rails.application.routes.url_helpers | |
| # set host in default_url_options: | |
| default_url_options[:host] = "localhost" | |
| # can then use: | |
| url_for() | 
  
    
      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
    
  
  
    
  | # This works with steak 0.3.x and rspec 1.x | |
| # For steak --pre and rspec 2 see this fork: http://gist.github.com/448487 | |
| # Put this code in acceptance_helper.rb or better in a new file spec/acceptance/support/javascript.rb | |
| Spec::Runner.configure do |config| | |
| config.before(:each) do | |
| Capybara.current_driver = :selenium if options[:js] | |
| 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
    
  
  
    
  | # Add poltergeist gem to Gemfile, in :test group, | |
| # then run `bundle` to install | |
| group :test do | |
| ... | |
| gem 'poltergeist' | |
| ... | |
| 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
    
  
  
    
  | $('body').on('click', '.ajax-modal', function() { | |
| $('.ui.modal') | |
| .modal({ | |
| onShow: function(callback) { | |
| callback = $.isFunction(callback) ? callback : function(){}; | |
| var $content = $(this).find('.content'); | |
| $.get("contentData.php", function(data) { | |
| $content.html(data); | |
| }); | |
| } |