Skip to content

Instantly share code, notes, and snippets.

View ckenst's full-sized avatar

Chris Kenst ckenst

View GitHub Profile
@ckenst
ckenst / Zero-To-One.md
Last active April 29, 2024 10:56
Notes on Zero to One

#Zero to One by Peter Thiel and Blake Masters

####Chapter Notes on the book Zero to One.

Chapter 1 - The challenge of the future

  • Doing something we already know is called 1 to N while doing something new is 0 to 1. Todayโ€™s so called best practices lead to dead ends. No formula exists and thereโ€™s no prescription for creating the future. The most powerful pattern is to think about business from first principles.
  • What important truth do very few people agree with you on? Brilliant thinking is rare but necessary. An appropriate way to answer this question is โ€œmost people believe in x, but the truth is the opposite of xโ€.

API walkthrough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
#filename: Gemfile example
source 'https://rubygems.org'
gem 'rspec', '~> 2.14.0'
gem 'selenium-webdriver'
gem 'sauce_whisk'
@ckenst
ckenst / gist:351f3ceb1dd1505c0918
Created July 13, 2015 00:05
Gregg Pollack's Founders Talk All Lessons

Gregg Pollack's Founder's Talk 1

25 Lessons:

  1. As a founder, you must be willing to wear all hats
  2. Do one on ones
  3. If you have an audience, you can make money
  • Sponsorships
  • Charging people
  • If you can bring an audience, you can probably figure out a way to monetize.
@ckenst
ckenst / spec_helper.rb
Last active August 29, 2015 14:25
An example spec helper
require 'selenium-webdriver'
RSpec.configure do |config|
config.before(:each) do
case ENV['host']
when 'saucelabs'
caps = Selenium::WebDriver::Remote::Capabilities.send(ENV['browser'])
caps.version = ENV['browser_version']
caps.platform = ENV['operating_system']
@ckenst
ckenst / selenium_irb.rb
Last active August 15, 2017 22:46
IRB Selenium example
#our REPL of choice is irb, could also use pry
irb
#require the selenium webdriver library
require 'selenium-webdriver'
#launch chrome as our driver
driver = Selenium::WebDriver.for :chrome
#navigate to google
@ckenst
ckenst / UpdateCerts
Last active November 26, 2016 15:05
Update SSL certs RVM
$ rvm osx-ssl-certs status all
# Certificates for...
$ rvm osx-ssl-certs update all
# Updating certificates...
@ckenst
ckenst / stripe_modal.rb
Last active April 23, 2018 17:56
Selenium script for filling out stripe's checkout popup modal
# This selenium script will automatically fill out stripe's checkout popup modal
# from the example modal within Stripe's documentation
require 'selenium-webdriver'
require 'rspec/expectations'
def setup
@driver = Selenium::WebDriver.for :chrome
end
@ckenst
ckenst / Headless_Chrome_Example_pry.rb
Last active November 29, 2017 22:16
A previous example of headless chrome in Ruby using Selenium
# Using pry as our REPL of choice. Could also use irb
pry
require 'selenium-webdriver'
#set our driver to use chrome and pass in switches.
driver = Selenium::WebDriver.for :chrome, switches: %w[--headless --no-sandbox --disable-gpu --remote-debugin-port=9222]
#let's go to kenst.com & make sure we are on the page
driver.get 'http://www.kenst.com'
@ckenst
ckenst / Headless_Chrome_Example.rb
Last active August 28, 2017 02:50
A simple selenium script using chrome headless
require 'selenium-webdriver'
require 'rspec/expectations'
include RSpec::Matchers
def setup
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
options.add_argument('--disable-gpu')
options.add_argument('--remote-debugging-port=9222')
@driver = Selenium::WebDriver.for :chrome, options: options