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
@wwerner
wwerner / docker-tomcat_remote-debugging.adoc
Last active June 3, 2021 18:16
Set up remote debugging for Tomcat in Docker

Set up remote debugging in dockerized Tomcat

Start Container, stock tomcat 8.5 in this example
$  docker run \
    -eJPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=n" \
    -p8080:8080 \
@wwerner
wwerner / heroku-db-url-to-spring-boot.sh
Last active April 29, 2021 07:26
Parse Heroku DB URL into Spring Boot Datasource Environment Variables
# Two possibilities to parse a Postgres DB URL from heroku into environment variables
# that Spring Boot understands.
# You would need that, if you do not build on heroku but push docker images
# from another source
# Does not need bash. Works on alpine linux / busybox. Tested with openjdk:8-jdk-alpine base image.
export DATABASE_URL=postgres://user:password@host:port/database
# Naive way, would break with [@:/] in username or password.
DB_TYPE=$(echo $DATABASE_URL | awk -F'[:@/]' '{print $1}')"ql"
@wwerner
wwerner / embed gist.md
Created April 14, 2021 07:40 — forked from Albert-W/embed gist.md
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,
 
import { useFishFn, usePond, useRegistryFish } from '@actyx-contrib/react-pond'
import * as React from 'react'
import { MachineFish } from '../fish'
import { MaterialRequestFish } from '../fish/materialRequestFish'
export const App = (): JSX.Element => {
const registry = useFishFn(MaterialRequestFish.registry, 1)
const allActiveMaterialReqs = useRegistryFish(MaterialRequestFish.registry(), Object.keys, MaterialRequestFish.of)
const pond = usePond()
@wwerner
wwerner / conda-default-env.yml
Created January 27, 2021 19:38
My conda default ML environment
name: sklearn mkl default
channels:
- defaults
dependencies:
- _py-xgboost-mutex=2.0=cpu_0
- appnope=0.1.0=py37_0
- attrs=19.3.0=py_0
- backcall=0.2.0=py_0
- blas=1.0=mkl
- bleach=3.1.5=py_0
@wwerner
wwerner / twitter-automute.js
Last active January 9, 2021 13:29
Mute Twitter accounts sending promotions
// This is neither elegant nor robust,
// but it _does_ mute everyone sending
// promoted tweets to my timeline.
// It works by installing a debounced
// scroll listener which checks for promoted tweets
// and mutes their sender by clicking the resp.
// tweet context menu action.
var xPathEvaluator = $x
echo .DS_Store >> ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
@wwerner
wwerner / settings.yml
Created November 11, 2020 07:34
Probot Settings App Label Example
labels:
- name: "T:Question ❓"
description: "Type: Question - Needs discussion w/ team and/or stakeholders"
color: E8F5E9
- name: "T:Bug 🐛"
description: "Type: Bug - Something does not work as expected"
color: E8F5E9
- name: "T:Feature ✨"
description: "Type: Feature - Provides a new feature"
@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 \