Skip to content

Instantly share code, notes, and snippets.

View yongfook's full-sized avatar

Jon Yongfook yongfook

View GitHub Profile
@yongfook
yongfook / capture.rb
Created October 23, 2019 04:15
Debugging Selenium / Browserless.io
caps = Selenium::WebDriver::Remote::Capabilities.chrome("goog:chromeOptions" => {
"args" => [
"--disable-background-timer-throttling",
"--disable-backgrounding-occluded-windows",
"--disable-breakpad",
"--disable-component-extensions-with-background-pages",
"--disable-dev-shm-usage",
"--disable-extensions",
"--disable-features=TranslateUI,BlinkGenPropertyTrees",
"--disable-ipc-flooding-protection",
@yongfook
yongfook / Rakefile.rb
Last active May 20, 2020 05:05
A simple file I have in my static site generator root that loops through all pages and generates opengraph images using Bannerbear
require 'httparty'
require 'open-uri'
namespace :bannerbear do
task :generate do
puts "Starting json request"
response = HTTParty.get(ENV['LOCAL_BB_SITE_ALL_POSTS'])
begin
json = JSON.parse response.body
puts "Number of pages: #{json.size}"