Skip to content

Instantly share code, notes, and snippets.

@amree
amree / post.md
Created November 26, 2023 10:36

Tiny Guide to Webscaling

Someone on Twitter asked what if Khairul Aming wanted to set up his own website for his sambal? For those who may not know, his product has gained fame and typically sells out quickly once he opens orders. At present, he utilizes Shopee.

From a business standpoint, it's advisable for him to stay with Shopee. My post is primarily for educational purposes.

Disclaimer: I am not an SRE/DevOps professional, but rather someone eager to share insights that might broaden understanding of web scalability, drawn from my limited experiences. Therefore, there may be inaccuracies, though I hope none too significant.

Expect some odd structuring in the paragraphs, as the content was initially made for Twitter.

id country state city postcode created_at updated_at
1 Malaysia Johor Ayer Baloi 82100 2020-05-12 06:48:36 UTC 2020-05-12 06:48:36 UTC
2 Malaysia Johor Ayer Hitam 86100 2020-05-12 06:48:37 UTC 2020-05-12 06:48:37 UTC
3 Malaysia Johor Ayer Tawar 2 81920 2020-05-12 06:48:39 UTC 2020-05-12 06:48:39 UTC
4 Malaysia Johor Bandar Penawar 81930 2020-05-12 06:48:41 UTC 2020-05-12 06:48:41 UTC
5 Malaysia Johor Bandar Penawar 81960 2020-05-12 06:48:41 UTC 2020-05-12 06:48:41 UTC
6 Malaysia Johor Bandar Tenggara 81440 2020-05-12 06:48:43 UTC 2020-05-12 06:48:43 UTC
7 Malaysia Johor Batu Anam 85100 2020-05-12 06:48:44 UTC 2020-05-12 06:48:44 UTC
8 Malaysia Johor Batu Pahat 83000 2020-05-12 06:48:46 UTC 2020-05-12 06:48:46 UTC
9 Malaysia Johor Batu Pahat 83010 2020-05-12 06:48:46 UTC 2020-05-12 06:48:46 UTC
@amree
amree / retry_until_timeout_spec.rb
Created January 8, 2022 00:46 — forked from jvillarejo/retry_until_timeout_spec.rb
A timeout for failing specs when using turbo frames and hotwire
# This is how we use it
retry_until_timeout do
expect(page).to have_button('Add comment')
expect(page).to have_text('Cancell')
end
def retry_until_timeout(seconds = 10, message: 'Failed with timeout')
Timeout.timeout(seconds) do
loop do
yield
@amree
amree / file.js
Last active December 14, 2020 08:03
/** @preserve jQuery.floatThead 2.2.1 - https://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2020 Misha Koryak **/ ! function(bt) {
bt.floatThead = bt.floatThead || {}, bt.floatThead.defaults = {
headerCellSelector: "tr:visible:first>*:visible",
zIndex: 1001,
position: "auto",
top: 0,
bottom: 0,
scrollContainer: function(t) {
return bt([])
},
#!/usr/bin/env ruby
# frozen_string_literal: true
# README
# - gem install git
# - Update the ticket prefix
# - Update the branch name
# - Put this in /usr/local/bin and chmod +x it
require 'git'
Fetching libv8 6.7.288.46.1
Installing libv8 6.7.288.46.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/amree/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/libv8-6.7.288.46.1/ext/libv8
/Users/amree/.rbenv/versions/2.5.0/bin/ruby -r ./siteconf20191021-37951-cidhuv.rb extconf.rb
creating Makefile
________ running 'git -c core.deltaBaseCacheLimit=2g clone --no-checkout --progress https://chromium.googlesource.com/v8/v8.git
/Users/amree/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/libv8-6.7.288.46.1/vendor/_gclient_v8_OSkH9q' in '/Users/amree/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/libv8-6.7.288.46.1/vendor'
#! /usr/bin/env ruby
# usage:
# $ das_download.rb
require "mechanize"
require "fileutils"
class DasDownloader
attr_reader :agent, :email, :password
@amree
amree / index.js Capture DOM element screenshot using Chrome headless
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Adjustments particular to this page to ensure we hit desktop breakpoint.
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1});
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'});

SPACEMACS

#notes

<div class="section">
<div class="header">Header</div>
<div class="content">
<div class="sidebar">Sidebar</div>
<div class="article">Article</div>
</div>
<div class="footer">Footer</div>
</div>