Skip to main content
tdro

Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

tdro micro.thedroneely.com (edited) view
  • Markdown Plaintext Embed Permalink
  • 72/50 words 24s read

    Chrome --headless can dump the to the command line. Set a virtual time budget in [?] for the to settle down and then do stuff.

    shell
    Html() {
      chromium \
        --headless \
        --incognito \
        --dump-dom \
        --virtual-time-budget=999999 \
        "$1"
    }
    
    HtmlToText() {
      lynx -stdin -dump -nolist
    }

    This has “peculiar” uses. Fun fact: invoking the name of chromium around normal people confers alien–like status.

    shell
    Html 'https://www.youtube.com/' | HtmlToText
    #gists
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com view
  • Markdown Plaintext Embed Permalink
  • 48/50 words 16s read
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com (edited) view
  • Markdown Plaintext Embed Permalink
  • 143/50 words 48s read
    My puppeteer scripts now use deno.

    No more need for npm in my personal stack! The native browser’s path comes from which.

    javascript
    import puppeteer from "https://deno.land/x/puppeteer@16.2.0/mod.ts";
    
    const chrome = "chromium";  // Browser Chrome: "firefox" | "chromium" | "google-chrome" | ...
    const product = "chrome";   // Product Base:   "firefox" | "chrome"
    
    const command = new Deno.Command("which", { args: [chrome] });
    const { status, stdout, stderr } = command.outputSync();
    const executablePath = new TextDecoder().decode(stdout).trim();
    
    const browser = await puppeteer.launch({
      headless: false,
      executablePath: executablePath,
      product: product,
    });
    
    const site = "example.com";
    const page = await browser.newPage();
    
    await page.setViewport({ width: 1024, height: 768 });
    await page.goto("https://" + site);
    await page.screenshot({ path: site + ".png" });
    
    await page.waitForSelector('a');
    
    const url = await page.evaluate(() => {
      return document.querySelector('a').href;
    });
    
    console.log(url);
    
    await browser.close();
    Basic Boilerplate: Captures a picture of example.com (main.ts)
    shell
    deno run --allow-all main.ts
    Deno Version: 1.45.5
    #gists #webdev
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com view
  • Markdown Plaintext Embed Permalink
  • 80/50 words 27s read
    Web servers can be spun up quickly on the command line but with gotchas.

    Take the innocent web server .

    shell
    php -S 127.0.0.1:8080

    Best not to use PHP’s web server cli (even for PHP) because routes with a dot (.) are assumed to be static files. Use a real web server or superior cli web servers with minor gotchas.

    shell
    python -m http.server --bind 127.0.0.1 8080
    busybox httpd -f -p 127.0.0.1:8080
    ruby -run -e httpd . -p 8080
    #gists #webdev
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com view
  • Markdown Plaintext Embed Permalink
  • 70/50 words 23s read

    Hugo has template performance metrics with the --templateMetrics flag. Here’s a snippet of the metrics for this site.

    shell
    $ hugo --templateMetrics
    
    Start building sites … 
    hugo v0.101.0+extended linux/amd64 BuildDate=unknown
    
    Template Metrics:
    
     cumulative       average       maximum         
       duration      duration      duration  count  template
     ----------      --------      --------  -----  --------
    7.278303484s   49.177726ms  237.175705ms    148  partials/generate-feeds.html
    7.22797312s   112.93708ms  246.988674ms     64  _default/single.html
    6.982028147s   83.119382ms  245.262274ms     84  partials/navigator-right.html
    6.683942678s   47.070018ms  237.223569ms    142  partials/web-ring.html
    1.685089741s    5.561352ms   28.254398ms    303  _default/summary.html
    #gists #webdev
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com view
  • Markdown Plaintext Embed Permalink
  • 50/50 words 17s read

    One way to remove multi–page transition jank is to force a permanent scrollbar. Are there any kindred spirits? Yes — there’s a kindred spirit. Overflows may disable descending position: sticky behavior. Avoid that problem with other jank removal techniques.

    css
    html {
      overflow-y: scroll;
    }
    
    body {
      overflow-y: scroll;
    }
    #gists #webdev
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com view
  • Markdown Plaintext Embed Permalink
  • 50/50 words 17s read

    Whenever I’m handcrafting , content selection rules are usually the first declarations on my sheet. Might as well ensure user selected text is readable. Easiest win for accessibility.

    css
    ::selection {
      color: #fff;
      background-color: #000;
    }
    
    ::-webkit-selection {
      color: #fff;
      background-color: #000;
    }
    
    ::-moz-selection {
      color: #fff;
      background-color: #000;
    }
    #gists #webdev

    Authors