Skip to content

Instantly share code, notes, and snippets.

View ziraqyoung's full-sized avatar
📌

ziraq young ziraqyoung

📌
View GitHub Profile
@ziraqyoung
ziraqyoung / hybrid_gpu_archcraft_laptop_setup.md
Created January 18, 2025 19:27 — forked from pietersp/hybrid_gpu_archcraft_laptop_setup.md
Archcraft linux setup on Intel/Nvidia hybrid laptop

Setting up my Hybrid graphics Laptop with Archcraft Linux

Setting up hybrid graphics linux is generally painful with the current state of Nvidia support. If you can avoid getting an Nvidia GPU based laptop if you plan to use Linux. I use a distro called Archcraft and had some issues specific to my setup (distro/hardware)

The hardware I am installing this on is a TongFang GM6TG7W (aka Wootbook Extreme IV). It has an Intel iGPU and an Nvidia 3070 Max-Q dGPU.

@ziraqyoung
ziraqyoung / wait_until.rb
Created May 22, 2022 11:59 — forked from metaskills/wait_until.rb
Never sleep() using Capybara!
# WAIT! Do consider that `wait` may not be needed. This article describes
# that reasoning. Please read it and make informed decisions.
# https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
@ziraqyoung
ziraqyoung / capybara_read_spec.rb
Created February 16, 2022 04:46 — forked from KonnorRogers/capybara_read_spec.rb
Clipboard reading in Capybara
it "should read clipboard text" do
page.driver.browser.execute_cdp(
"Browser.setPermission",
{
origin: page.server_url,
permission: { name: "clipboard-read" },
setting: "granted",
})
clip_text = page.evaluate_async_script("navigator.clipboard.readText().then(arguments[0])")
expect(clip_text).to eq("copied text")
@ziraqyoung
ziraqyoung / fakeout.rake
Created February 15, 2022 19:32 — forked from matthutchinson/fakeout.rake
fakeout.rake - a simple/configurable rake task that generates some random fake data for the app (using faker) at various sizes
# a simple/configurable rake task that generates some random fake data for the app (using faker) at various sizes
# NOTE: requires the faker or ffaker gem
# sudo gem install faker - http://faker.rubyforge.org
# OR
# sudo gem install ffaker - http://github.com/EmmanuelOga/ffaker
require 'faker'
class Fakeout
@ziraqyoung
ziraqyoung / extract-objects-from-rails-models-and-controllers.md
Created January 18, 2022 17:18 — forked from scmx/extract-objects-from-rails-models-and-controllers.md
7 Patterns to Refactor Rails Models 7 years later #rails #model #refactor #valueobject #serviceobject #formobject #queryobject #viewobject #policyobject #decorator

7 Patterns to Refactor Rails Models 7 years later

You may have read the following excellent blogpost by Brian Helmkamp of CodeClimate. It nicely describes 7 types of objects that can be extracted from models and controllers in a Rails-app.

7 Patterns to Refactor Fat ActiveRecord Models https://codeclimate.com/blog/7-ways-to-decompose-fat-activerecord-models/ Brian Helmkamp on Oct 17, 2012.

Here are my thoughts on it, reading it as an experienced rails developer, 7 years later 😅 👴

require 'nokogiri'
require 'open-uri'
# Get a Nokogiri::HTML:Document for the page we're interested in...
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))
# Do funky things with it using Nokogiri::XML::Node methods...
####
@ziraqyoung
ziraqyoung / SpaceVim.md
Created October 25, 2021 18:38 — forked from bespokoid/SpaceVim.md
SpaceVim cheatsheet #tools