This file contains 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
const urlPattern = "**/some_endpoint"; | |
const delayMS = 1000 | |
await page.route(urlPattern, async (route) => { | |
const resolve = (route: Route) => route.continue(); | |
const res = new Promise(() => resolve); | |
setTimeout(async () => { | |
await resolve(route); | |
}, delayMS); |
This file contains 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
# allow cache to be used in a test that uses the :with_cache metadata | |
config.around do |example| | |
if example.metadata[:with_cache] | |
Rails.cache = ActiveSupport::Cache.lookup_store(:memory_store) | |
Rails.cache.clear | |
end | |
example.run | |
end |
This file contains 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
# Helpful for when running git rebase -i and selecting multiple files to fixup or drop | |
# select ours for each conflict | |
git status | grep both | awk '{print $3}' | xargs git checkout --ours | |
# select theirs for each conflict | |
git status | grep both | awk '{print $3}' | xargs git checkout --theirs | |
# run with && git add . && git rebase --continue to add and move on | |
git status | grep both | awk '{print $3}' | xargs git checkout --ours && git add . && git rebase --continue |
This file contains 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
redis: redis-server # optional. Comment out if you are not using redis | |
web: bin/rails server -p 3000 | |
worker: bundle exec sidekiq # optional. Comment out if you are not using sidekiq for background jobs | |
vite: bundle exec bin/vite dev |
This file contains 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
#!/usr/bin/env bash | |
bundle add devise && rails g devise:install && rails g devise user |
This file contains 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
describe 'test something', driver: :playwright do | |
let(:user) { create(:user) } | |
before do | |
login_as user | |
end | |
it 'goes to a page and checks to see that it contains some content when not authorized' do | |
page.goto(restricted_path) |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Timer</title> | |
<style> | |
:root { | |
--text-color: black; |
This file contains 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
/** | |
* @param {string} hexString | |
* @returns {{ r: number; g: number; b: number; }} | |
*/ | |
function getRGBFromHex(hexString) { | |
hexString = hexString.substring(1); | |
let aRgbHex = hexString.match(/.{1,2}/g); | |
return { | |
r: parseInt(aRgbHex[0], 16), | |
g: parseInt(aRgbHex[1], 16), |
This file contains 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
# Combined commands (See below for descriptions about what each one is doing): | |
yarn run build | awk '$0~/ERROR in/' | sed -e 's/ERROR in //' -e 's/:[0-9]:[0-9]//' -e 's/:[0-9][0-9]:[0-9]//' -e 's/:[0-9][0-9]:[0-9][0-9]//' > file_paths.txt | |
# yarn run build > build_output.txt # Direct stdout to a file. yarn run build runs `webpack` | |
# awk '$0~/ERROR in/' build_output.txt > files_with_errors.txt # Get the lines that start with the string "ERROR in" and print them to the file, files_with_errors.txt | |
# sed -e 's/ERROR in //' -e 's/:[0-9]:[0-9]//' -e 's/:[0-9][0-9]:[0-9]//' -e 's/:[0-9][0-9]:[0-9][0-9]//' files_with_errors.txt > paths_without_line_numbers.txt # Find and replace instances of "ERROR in " with nothing, run several matchers to remove trailing line and column numbers on the path strings that take like something like "/path/to/some/file.ts:10:11". |
This file contains 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
{"lastUpload":"2020-08-05T16:19:21.986Z","extensionVersion":"v3.4.3"} |
NewerOlder