Skip to content

Instantly share code, notes, and snippets.

View wwerner's full-sized avatar

Wolfgang Werner wwerner

View GitHub Profile
@wwerner
wwerner / v-responsive-class.js
Created October 30, 2020 10:56
Provides a `v-responsive-class` Vue directive to toggle css classes based on the containing element's width.
/**
* Provides a `v-responsive-class` Vue directive to toggle css classes based on the containing element's width.
* Think @media queries, but based on the parent element. Useful for web components.
*
* The breakpoints match the ones in Bootstrap:
* * xs: < 576 - Extra small devices (portrait phones, less than 576px)
* * s: >= 576 - Small devices (landscape phones, 576px and up)
* * m: >= 768 - Medium devices (tablets, 768px and up)
* * l: >= 992 - Large devices (desktops, 992px and up)
* * xl: >= 1200 - Large desktops, 1200px and up
@una
una / style.css
Last active September 22, 2023 18:11
min() max() clamp()
.sidebar {
/* Select smaller of the 2 calculated values
Narrower screens: 20vw, Wider screens: 300px */
width: min(20vw, 300px);
}
.make-the-logo-bigger {
/* Select larger of the 2 calculated values
Basically clamps the font size to 60px or larger (10vw) */
font-size: max(60px, 10vw);
@wwerner
wwerner / back-to-origin.sh
Created March 26, 2020 10:46
[git] stash local changes to new branch and reset the current one to its origin
# git safe origin
# -
# save local work to a separate branch and revert to the current branches origin
# I have this in my ~/.zshrc
gso()
{
branch=$(git rev-parse --abbrev-ref HEAD); qualifier=$(date -u +"%Y-%m-%dT%H%M%S") \
&& git add . \
&& git commit -m "Saving local work from $branch to local/stash/$branch-$qualifier" \
&& git branch local/stash/$branch-$qualifier \
@Albert-W
Albert-W / embed gist.md
Last active February 1, 2024 15:09
embed gist in iframe

Embed gist in iframe

it is used to embed gist to an asynchronously-loaded web pages.

<iframe 
    width="100%"
    height="350"    
    src="data:text/html;charset=utf-8,
 
@PierreThiollent
PierreThiollent / Readme.md
Last active March 26, 2024 19:14
iTerm2 and Oh-my-zsh config

Setup iTerm2 and oh-my-zsh

Enjoy ! 😄

Install iTerm 2

Download iTerm2 here.

@douglascayers
douglascayers / github-copy-labels.sh
Last active December 22, 2023 08:16
Export and import GitHub labels between projects by running bash script with jq and curl. Uses GitHub REST API. Requires personal access token.
# This script uses the GitHub Labels REST API
# https://developer.github.com/v3/issues/labels/
# Provide a personal access token that can
# access the source and target repositories.
# This is how you authorize with the GitHub API.
# https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line
GH_TOKEN="YOUR_TOKEN"
# If you use GitHub Enterprise, change this to "https://<your_domain>/api/v3"
@r-malon
r-malon / monokai.md
Created February 27, 2019 19:15
Monokai colors in RGB and HEX format, taken from Sublime Text 3

Monokai Colors in RGB and HEX format


  • Background: (46, 46, 46); #2e2e2e
  • Comments: (121, 121, 121); #797979
  • White: (214, 214, 214); #d6d6d6
  • Yellow: (229, 181, 103); #e5b567
  • Green: (180, 210, 115); #b4d273
  • Orange: (232, 125, 62); #e87d3e
  • Purple: (158, 134, 200); #9e86c8
@mraible
mraible / init.lua
Last active June 17, 2021 17:29
My Hammerspoon init.lua
units = {
right30 = { x = 0.70, y = 0.00, w = 0.30, h = 1.00 },
right70 = { x = 0.30, y = 0.00, w = 0.70, h = 1.00 },
left70 = { x = 0.00, y = 0.00, w = 0.70, h = 1.00 },
left30 = { x = 0.00, y = 0.00, w = 0.30, h = 1.00 },
top50 = { x = 0.00, y = 0.00, w = 1.00, h = 0.50 },
bot50 = { x = 0.00, y = 0.50, w = 1.00, h = 0.50 },
upright30 = { x = 0.70, y = 0.00, w = 0.30, h = 0.50 },
botright30 = { x = 0.70, y = 0.50, w = 0.30, h = 0.50 },
upleft70 = { x = 0.00, y = 0.00, w = 0.70, h = 0.50 },
@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

@pgilad
pgilad / Dockerfile
Last active March 18, 2024 04:37
Minimal Spring Boot 2 on Docker Alpine with Java 11 (Using Jigsaw modules)
FROM alpine:3.8 AS builder
WORKDIR /opt
ARG JDK_TAR=openjdk-11+28_linux-x64-musl_bin.tar.gz
ARG JDK_DOWNLOAD_PREFIX=https://download.java.net/java/early_access/alpine/28/binaries
RUN wget -q "$JDK_DOWNLOAD_PREFIX/$JDK_TAR" && \
wget -q "$JDK_DOWNLOAD_PREFIX/$JDK_TAR.sha256"
RUN cat $JDK_TAR.sha256 | xargs -I{} echo "{} $JDK_TAR" | sha256sum -c - && \