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 'httparty' | |
| class PixelPeeper | |
| include HTTParty | |
| base_uri 'www.pixel-peeper.com' | |
| default_timeout 1 # hard timeout after 1 second | |
| def api_key | |
| ENV['PIXELPEEPER_API_KEY'] | |
| 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
| def new_token! | |
| SecureRandom.hex(16).tap do |random_token| | |
| update_attributes token: random_token | |
| Rails.logger.info("Set new token for user #{ id }") | |
| end | |
| 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
| diff --git a/app/mailers/reservation_mailer.rb b/app/mailers/reservation_mailer.rb | |
| index 4ee2db4..0f8faf2 100644 | |
| --- a/app/mailers/reservation_mailer.rb | |
| +++ b/app/mailers/reservation_mailer.rb | |
| @@ -16,6 +16,8 @@ class ReservationMailer < CameraLendsMailer | |
| def reservation_request_lender(reservation) | |
| @reservation = reservation | |
| + @owner = reservation.item.owner | |
| + @owner.new_token! |
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
| def maybe_login_from_token | |
| Rails.logger.info "maybe_login_from_token: '#{ params[:token] }'" | |
| return if (token = params[:token]).blank? | |
| if (user = User.find_by_token(token)) | |
| Rails.logger.info "One time login token used for user #{ user.id }" | |
| sign_in(user) | |
| else | |
| Rails.logger.info "No user found from token: '#{ token }'" | |
| 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
| module Saucelabs | |
| SAUCE_USERNAME = '' | |
| SAUCE_TOKEN = '' | |
| def self.setup_saucelabs_connection!(driver=nil) | |
| WebMock.allow_net_connect! | |
| driver ||= { | |
| capability: :chrome, | |
| platform: 'Windows 8', | |
| version: '', |
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 'bundler' | |
| require 'RMagick' | |
| include Magick | |
| require 'selenium-webdriver' | |
| URLS = [ | |
| 'www.apartmentlist.com', | |
| 'www.apartmentlist.com/oh/medina', | |
| 'www.apartmentlist.com/oh/medina?zip=44256#map/p13063', |
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
| var ITERATIONS = 100000, | |
| av = navigator.appVersion; | |
| console.time('indexOf') | |
| for (var i = 0; i < ITERATIONS; i++) { | |
| navigator.appVersion.indexOf("Mobile") > -1 | |
| } | |
| console.timeEnd('indexOf') | |
| console.time('regex') |
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
| $(function() { | |
| // good opportunity to combine into a single statement | |
| // qq w cw <esc> A, <esc> 0 j q | |
| var a = 10; | |
| var b = 20; | |
| var c = 30; | |
| var d = 40; | |
| var e = 50; | |
| // opportunity to simplify syntax |
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 administrative assistant will have a variety of responsibilities and duties. I'm the only full time employee at CameraLends, and I also have a day job. I plan to take care of all the programming, but occasionally there are non-technical tasks to outsource: | |
| More specific examples of the type of work include: | |
| - blog posts (1/week, 1-2 hours) | |
| - posting flyers (if in San Francisco / Bay Area) | |
| - cross-referencing pages on CameraLends against other sites (for prices, specifications) | |
| - cleaning up user generated data, making sure Camera listings look appealing. | |
| - responding to customer support emails (1-2 hours/week) | |
| - coordinating with contractors (finding, hiring, getting work handed over) | |
| - general QA of the site -- what works, what doesn't work (1-3 hours/week) |
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
| Bower 8mm f/3.5 Fisheye | |
| Canon 1.4x Extender ii accessory | |
| Canon EF 100-300mm f/4.5-5.6 USM Telephoto | |
| Canon EF 100-400mm f/4.5-5.6L IS USM | |
| Canon EF 100mm f/2.8 USM Macro | |
| Canon EF 100mm f/2.8L IS USM Macro Lens | |
| Canon EF 135mm f/2L USM | |
| Canon EF 15mm f/2.8 Fisheye | |
| Canon EF 16-35mm f/2.8L II USM | |
| Canon EF 24-105mm f/4L IS USM |