Skip to content

Instantly share code, notes, and snippets.

/**
* 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();
@laptite
laptite / check-paperclip-attachment.md
Last active May 5, 2016 18:18 — forked from kinopyo/gist:2224867
Check whether a Paperclip attachment exists

Check whether a Paperclip attachment exists

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)
@laptite
laptite / capybara cheat sheet
Last active August 23, 2016 20:27 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
# 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
@laptite
laptite / config_initializers_fix_ssl.rb
Created June 12, 2015 20:46
Fix OpenSSL::SSL::SSLError
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?

1. Create a list of all dangling or unreachable commits.

$ git fsck --full --no-reflogs --unreachable --lost-found
unreachable tree 4a407b1b09e0d8a16be70aa1547332432a698e18
unreachable tree 5040d8cf08c78119e66b9a3f8c4b61a240229259
unreachable tree 60c0ce61b040f5e604850f747f525e88043dae12
unreachable tree f080522d06b9853a2f18eeeb898724da4af7aed9

JavaScript Part 1

Topics:

  • Variables & Data types
  • Conditional Statements
  • Functions & Scope
  • setting up a document to use jQuery
  • jQuery Selectors & Methods
  • Retrieving Form Values
  • Arrays

Student Ruby Assessment

Instructions

  • Create a file with "<yourName>_assessment.rb".

Sections 1-6

  • Title each section with a comment that includes the name and number of each section.
  • Then write the ruby that fulfills each lettered instruction under the title. There is no need to structure your code based on the lettered instructions.
  • If you need to use code from a previous numbered section please cut and paste into the approrpriate section.

This is a list of steps to:

  • Setup a new Rails app
  • Initialize a local repository using git
  • Create a new remote repository using GitHub
  • Change README.rdoc
  • Deploy to a cloud service - Heroku

Assumptions:

  • Ruby is installed (v 1.9.3)
  • Rails is installed (v 3.2.3)