Skip to content

Instantly share code, notes, and snippets.

View afcapel's full-sized avatar

Alberto Fernández-Capel afcapel

View GitHub Profile
@afcapel
afcapel / frame-navigation.html
Created February 5, 2024 10:09
Frame navigation
<!doctype html>
<html lang=en>
<head>
<title>Throughput</title>
<meta name=viewport content='width=device-width,initial-scale=1.0'>
<meta charset=utf-8>
<link rel=stylesheet href=styles.css>
<head>
<script type="module" src="https://cdn.jsdelivr.net/npm/@hotwired/turbo@latest/dist/turbo.es2017-esm.min.js"></script>
@afcapel
afcapel / slow.html
Last active February 9, 2023 13:26
Slow document body clone in Chrome
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Slow clone body Test</title>
</head>
<body>
<div id="container">
<button id="cloneBodyBtn">Clone body</button>
</div>
@afcapel
afcapel / stimulus.html
Last active February 8, 2023 10:15
Stimulus targets making document clone slow
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Stimulus Test</title>
</head>
<body>
<div id="container">
<button id="cloneBodyBtn">Clone body</button>
@afcapel
afcapel / index.html
Created December 16, 2022 16:55
Slow document.body.cloneNode(true) in Chrome
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Slow document.body.cloneNode(true) in Chrome</title>
<body>
<div id="container"></div>
<script type="text/javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
<script>
const STATES = [
"CONNECTING",
"OPEN",
"CLOSING",
module main
go 1.17
require github.com/gorilla/websocket v1.4.2 // indirect
@afcapel
afcapel / journal.rb
Last active February 2, 2021 06:55
Script at ~/bin/journal I use to keep a journaling practice
#!/usr/bin/env ruby --disable-gems
require "date"
require "fileutils"
JOURNAL_DIR = File.expand_path("~/Google Drive/writing/journal")
now = DateTime.now
date = now.strftime("%F")
require "open-uri"
module Imports
class PageCrawler
attr_reader :current_page, :pages, :crawled
attr_accessor :follow_patterns, :ignore_patterns
def initialize(start_url, max_depth: 3, max_pages: 1000)
@max_depth, @max_pages = max_depth, max_pages
#!/usr/bin/env ruby --disable-gems
require "date"
require "fileutils"
JOURNAL_DIR = File.expand_path("~/textos/diario")
now = DateTime.now
date = now.strftime("%F")
VCR.configure do |config|
config.cassette_library_dir = "test/support/vcr_cassettes"
config.hook_into :webmock
config.ignore_localhost = true
end
module RecordedVCR
extend ActiveSupport::Concern
included do