Skip to content

Instantly share code, notes, and snippets.

View ulrischa's full-sized avatar

Uli Schäffler ulrischa

View GitHub Profile
javascript:(()=>{const selectedText=window.getSelection().toString().trim();if(!selectedText){alert("You need to select some text!");return;}const url=new URL(window.location);url.hash=`:~:text=${encodeURIComponent(selectedText)}`;navigator.clipboard.writeText(url.toString()).then(()=>{alert("Copied to clipboard:\n"+url.toString());}).catch(()=>{alert("Error: Could not copy to clipboard.\n"+url.toString());});})();
accordion-group {
background-color: #f7f7f7;
border-radius: 0.25em;
display: block;
margin-block-end: 1.5em;
padding: 0.5em 1em;
width: 100%;
}
accordion-group [accordion-trigger] {
/**
* Don't show button until JavaScript is instantiated
*/
share-me:not(:defined) {
display: none;
}
/**
* Visually hide an element, but leave it available for screen readers
* @link https://github.com/h5bp/html5-boilerplate/blob/master/dist/css/main.css
<h2 class="main-heading" id="specific-heading">Dies ist eine Überschrift</h2>
<div class="main-content">
<h2>Hauptinhalts-Titel</h2>
<p>Das ist der erste Absatz.</p>
<div class="sidebar">
<h2>Sidebar Titel</h2>
<p>Inhalt der Sidebar.</p>
</div>
<p>Das ist der zweite Absatz im Hauptinhalt.</p>
</div>
@ulrischa
ulrischa / htaccess
Created May 13, 2025 15:24 — forked from cferdinandi/htaccess
Gzip setup for .htaccess, taken from the old HTML5 Boilerplate template
# ----------------------------------------------------------------------
# | Compression |
# ----------------------------------------------------------------------
<IfModule mod_deflate.c>
# Force compression for mangled `Accept-Encoding` request headers
# https://developer.yahoo.com/blogs/ydn/pushing-beyond-gzipping-25601.html
<IfModule mod_setenvif.c>
@ulrischa
ulrischa / snippet.html
Created October 29, 2024 18:54
Gist erstellt über Bookmarklet
Der Fehler "Failed to execute `readText` on `Clipboard`: Document is not focused" tritt auf, wenn das Bookmarklet versucht, auf die Zwischenablage zuzugreifen, während das Dokument (d.h. die Browser-Seite) nicht im Vordergrund ist. Diese Sicherheitsvorkehrung stellt sicher, dass ein Skript nur dann auf die Zwischenablage zugreifen kann, wenn der Nutzer mit der Seite interagiert.
Um das Bookmarklet erfolgreich zu verwenden, müssen wir sicherstellen, dass der Browser im Vordergrund ist, und wir können eine alternative Eingabemethode als Fallback einbauen, falls der Zugriff auf die Zwischenablage nicht erlaubt ist.
Hier ist die aktualisierte Version des Bookmarklets, die den Nutzer auffordert, den Text manuell einzugeben, wenn der direkte Zugriff auf die Zwischenablage fehlschlägt:
```javascript
javascript:(async()=>{const githubToken='DEIN_GITHUB_TOKEN_HIER';const gistDescription='Gist erstellt über Bookmarklet';try{let clipboardText='';try{clipboardText=await navigator.clipboard.readText();}catch(e){clipboa
@ulrischa
ulrischa / sharer-urls.md
Created April 9, 2024 17:57 — forked from tZilTM/sharer-urls.md
Sharer (share) URLs (links) for sharing on LinkedIn, Twitter, Pinterest, Reddit and Facebook (2020-02-02)
@ulrischa
ulrischa / testjson.json
Created January 24, 2024 20:49
testjson.json
[
{
"name": "Alice",
"message": "Congratulations on your retirement! Wishing you a journey of happiness and adventure in the years ahead."
},
{
"name": "Bob",
"message": "Happy Retirement! It's time to enjoy your life to the fullest. Thank you for your years of hard work and dedication."
},
{