Don’t simply test for the presence of the magic Paperclip attribute, it will return a paperclip Attachment object and thus always be true:
- if user.photo.present? # always true
= image_tag(user.photo.url)| /** | |
| * Retrieves all the rows in the active spreadsheet that contain data and logs the | |
| * values for each row. | |
| * For more information on using the Spreadsheet API, see | |
| * https://developers.google.com/apps-script/service_spreadsheet | |
| */ | |
| function readRows() { | |
| var sheet = SpreadsheetApp.getActiveSheet(); | |
| var rows = sheet.getDataRange(); | |
| var numRows = rows.getNumRows(); |
| # Edited from fork zhengjia/capybara cheat sheet | |
| # References | |
| # https://gist.github.com/zhengjia/428105 | |
| # http://www.railscook.com/recipes/capybara-cheat-sheet/ | |
| * [bold] expectation | |
| =Navigating= | |
| page.visit( '/projects’ ) < inclusion of page. is optional |
| require 'open-uri' | |
| require 'net/https' | |
| module Net | |
| class HTTP | |
| alias_method :original_use_ssl=, :use_ssl= | |
| def use_ssl=(flag) | |
| self.ca_file = Rails.root.join('lib/ca-bundle.crt').to_s | |
| self.verify_mode = OpenSSL::SSL::VERIFY_NONE |
| require 'nokogiri' | |
| require 'open-uri' | |
| require 'pp' | |
| url = Nokogiri::HTML(open("http://www.gutenberg.org/files/2701/2701-h/2701-h.htm")) | |
| book = url.text.downcase.to_s | |
| parsed_book = [] | |
| edit = book.gsub(/\W+|\d+/,' ') | |
| edit = edit.split("end of project gutenberg").first.strip |
Oops! I accidentally deleted a local git branch, and I haven't pushed it to a remote server yet. The branch has several important commits, and it hasn't been merged with any other branches yet. How do I find the missing branch?
$ git fsck --full --no-reflogs --unreachable --lost-found
unreachable tree 4a407b1b09e0d8a16be70aa1547332432a698e18
unreachable tree 5040d8cf08c78119e66b9a3f8c4b61a240229259
unreachable tree 60c0ce61b040f5e604850f747f525e88043dae12
unreachable tree f080522d06b9853a2f18eeeb898724da4af7aed9