Skip to content

Instantly share code, notes, and snippets.

View Haumer's full-sized avatar
🎯
Focusing

Alex Haumer Haumer

🎯
Focusing
  • London
View GitHub Profile
require 'set'
teamOne = "Billy, Frankie, Stevie, John"
teamTwo = "Billy, Frankie, Stevie, Zach"
teamOneSet = teamOne.split(', ').to_set
teamTwoSet = teamTwo.split(', ').to_set
teamOneSet ^ teamTwoSet # => #<Set: {"John", "Zach"}>
require 'nokogiri'
require 'watir'
require_relative '../recipe'
class ScrapeBBCGoodFood
def self.call(keyword)
# Set up watir, wait until page contents that are needed are fully loaded
# Leave the below line as is if you don't want a browser window to open
browser = Watir::Browser.new :chrome, headless: true
# Comment in the below line, and comment out the above line if you want to see a browser window pop up
# browser = Watir::Browser.new

OmniAuth in Rails

Rails Template:

rails new \
  --database postgresql \
  --webpack \
 -m https://raw.githubusercontent.com/lewagon/rails-templates/master/devise.rb \
@Haumer
Haumer / B390_imdb.rb
Last active August 20, 2020 20:12
imdb api for Nextbinge
require 'uri'
require 'net/http'
require 'openssl'
require 'json'
class IMDB
attr_reader :data
BASE_URL = URI('https://imdb-internet-movie-database-unofficial.p.rapidapi.com/search/').freeze
def initialize(movie:)
Hello World!
I am a Gist!
You can find me on GitHub or
share and showcase me right here on HubGist
# Customer list
SELECT first_name, last_name, email FROM customers
ORDER BY last_name
# Classical Playlist
SELECT tracks.name, tracks.composer FROM playlist_tracks
require "open-uri"
require "json"
class TflApi
def initialize
@url = "https://api.tfl.gov.uk/line/mode/tube,overground,dlr,tflrail/status".freeze
retrieve_data
end
def retrieve_data
@Haumer
Haumer / E001_instagram_public.rb
Created July 17, 2020 14:52
InstagramClient for the latest 12 posts
require 'json'
require 'http'
class InstagramClient
attr_reader :posts, :followers
def initialize(instagram_handle)
@instagram_handle = instagram_handle
@url = "https://www.instagram.com/#{@instagram_handle}/?__a=1".freeze
@data = JSON.parse HTTP.get(@url).to_s
require_relative 'scraper'
puts "Fetching URLs"
urls = get_urls
movies = urls.map do |url|
puts "Scraping #{url}"
scrape_movie(url)
end
require_relative 'scraper'
puts "Fetching URLs"
urls = fetch_movie_urls
movies = urls.map do |url|
puts "Scraping #{url}"
scrape_movie(url)
end