Skip to content

Instantly share code, notes, and snippets.

View ADTC's full-sized avatar

Arundas TC ADTC

View GitHub Profile
@ADTC
ADTC / .github__workflows__deploy.yml
Last active July 8, 2026 13:16
Example GitHub Actions workflow for deploying to Vercel without connecting GitHub account
name: Deploy to Vercel
on:
push:
branches:
- main
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
@ADTC
ADTC / README.md
Last active May 29, 2026 05:46
Add an Astro integration to inject modulepreload hints

Add an Astro integration to inject modulepreload hints

Astro doesn't emit <link rel="modulepreload"> tags, so browsers discover JS dependencies one hop at a time. A Vite plugin now walks the client chunk graph at build time and injects a dependency manifest; an Astro middleware reads it and injects modulepreload hints into every HTML response, letting the browser fetch all modules in parallel from the first HTML parse.

For context, see withastro/roadmap#561

@ADTC
ADTC / README.md
Last active September 21, 2026 01:49
Apple MacBook macOS Critical Battery Warning at 5% or less (`/usr/local/bin/*`)

Update (Sep 2026):

I had since improved the scripts by adding another one to also ping me if the AC charger was disconnected (useful to know if it accidentally fell off or lost connection to electricity, and nice confirmation if I deliberately removed it), and this month I upgraded the warning system to combine the two into a single LaunchAgent triggered script, which I have now pushed to a GitHub repo.

The original scripts from this Gist are now a historical reference in the root commit.

@ADTC
ADTC / weird-error.js
Last active January 31, 2024 15:56
Weird Error in Nextjs using Auth0: See https://github.com/auth0/nextjs-auth0/issues/1653
nextjs-auth0 is attempting to set cookies from a server component,see https://github.com/auth0/nextjs-auth0#using-this-sdk-with-react-server-components
nextjs-auth0 is attempting to set cookies from a server component,see https://github.com/auth0/nextjs-auth0#using-this-sdk-with-react-server-components
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
@ADTC
ADTC / Clean workflow runs.yml
Created March 27, 2023 08:00
Clean workflow runs - Delete skipped workflow runs, once a day daily
name: Clean workflow runs
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
# Run at 00:00 everyday. See https://crontab.guru to change.
jobs:
del_workflow_runs:
@ADTC
ADTC / reorder-button.html
Last active September 29, 2023 15:04 — forked from magician11/reorder-button.html
How to create a reorder button in Shopify's Liquid
{% for order in customer.orders %}
...
{% liquid
assign reorder_url = ''
for line_item in order.line_items
assign reorder_url = reorder_url | append: line_item.variant_id | append: ':' | append: line_item.quantity | append: ','
endfor
-%}
@ADTC
ADTC / README.md
Last active March 19, 2021 06:17
Shopify Code Editor Maximized

This is a user style that can be used with the recommended Stylus app, or with the outdated Stylish for Firefox app.

It automatically maximizes the Shopify Code Editor whenever you open it from Themes > Edit Code or by other means.

It does the following:

  • Hides all the unnecessary header bars, and menu, leaving only the file list, the tab bar and the file header.
  • Removes the "Maximize" button.
  • Reduces the width of the file list to just 80% of the original width. More space to code! (Pro tip: This is 22.4rem)
  • Inverts the tab order so that the tabs are on the right (less distracting, and also the scroll bar goes on top).
@ADTC
ADTC / search-autocomplete.liquid
Last active April 3, 2023 19:21
Autocomplete in Search for Shopify - Modifications for Supply theme
{% assign results_box_width = '242px' %}
{% assign results_box_background_color = '#ffffff' %}
{% assign results_box_border_color = '#d4d4d4' %}
<script>
// Source: https://www.huratips.com/tech-tips/how-to-add-autocomplete-for-search-boxes-to-your-shopify-store.html
$(function() {
var closeButtonHTML = '<span class="close-button" title="Close">×</span>';
// Current Ajax request.
var currentAjaxRequest = null;
@ADTC
ADTC / navbar.html
Created November 26, 2017 00:14
Coursetro Vue.js compare tutorial - navbar update (Bulma's nav is deprecated)
<div class="navbar has-shadow">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item">MyCompany</a>
<span class="navbar-burger" v-on:click="toggleNav" v-bind:class="{ 'is-active': isActive }">
<span></span>
<span></span>
<span></span>
</span>
@ADTC
ADTC / README.txt
Created September 25, 2017 15:27
Adding a Save button in Atom Status Bar
Install the 'reload-button' package.
Open it and click View Code.
Open the reload-button-view.js file and update the code.
Save file and relaunch Atom.
Note: There is no save icon in Octicons, so I settled for another one.
Diff is included for the curious.