Skip to content

Instantly share code, notes, and snippets.

@atenni
Last active July 20, 2024 05:49
Show Gist options
  • Save atenni/5604615 to your computer and use it in GitHub Desktop.
Save atenni/5604615 to your computer and use it in GitHub Desktop.
How to permalink to a gist's raw file
@revolter
Copy link

revolter commented Apr 3, 2021

@rjb3977, usually, an underscore and the current timestamp are used for this: ?_=1617443829.

@AlexAtkinson
Copy link

I found this discussion after looking into it myself. Here's what I've got:

  • GIST is NOT meant to behave like a repository. It is a Front End technology.
  • Without cache busting, updates take quite a while... Longer than I was going to wait to measure how long exactly.
  • WITH cache busting, you can reduce the latency of updates to ~30-60s, but there IS STILL LATENCY.

Here's what I used to observe and measure changes.
Note that I was adding a, b, c... to line 4 character 1 (after the pound/hash sign) every time I saw the change in the cli.

while true; do line=$(curl -s https://gist.githubusercontent.com/raw/2bf5c315a7895193ddc3fe647ef3976b/detect-ci.sh?cache-bypass=$(date +%s) | sed '4q;d'); echo "$(date) -- ${line:1:1}"; sleep 1; done

So, this should be good enough for MOST applications. Mileage may vary.
And there's always a risk that GH will change their caching behavior for these assets.

@kleinlennart
Copy link

Nice. Exactly what I needed, thank you! 🙏
I think this should be the default URL, or GitHub should at least be more explicit about this difference...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment