Skip to content

Instantly share code, notes, and snippets.

View leonlaser's full-sized avatar
🍪

Leon Dietsch leonlaser

🍪
View GitHub Profile
@leonlaser
leonlaser / angular-material-cdk-placeholder-migration.md
Last active January 4, 2024 15:27
Regular expression to migration Angular Material form inputs from `placeholder` attribute to `<mat-label>` tags

Manual Angular Material/CDK placeholder migration

Why?

The removed "legacy" appearance promoted input placeholders to the floating label if the label was not specified. All newer appearance settings require explicitly specifying a if one was not provided before. This change addresses an accessibility best practice of not using labels and placeholders interchangeably.

Migrating to MDC-based Angular Material Components | Form Fields

How?

This regular expression works with IntelliJ IDE and maybe with others, supporting regex search and replace.

@leonlaser
leonlaser / add to firewall
Created March 3, 2023 12:17
[Add application to macos firewall] #macos #firewall
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add application
@leonlaser
leonlaser / clear_index.sh
Created July 15, 2021 07:59
[Clear spotlight index] #shell #macos #spotlight #index
sudo mdutil -avE
@leonlaser
leonlaser / easing.js
Created July 5, 2021 11:50 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: t => t,
// accelerating from zero velocity
easeInQuad: t => t*t,
// decelerating to zero velocity
@leonlaser
leonlaser / fix_gitkraken_bigsur.sh
Created December 14, 2020 10:34
[Fix slow GitKraken on BigSur] #git #gitkraken #bigsur #macaos #shell
# source: https://stackoverflow.com/questions/64925749/gitkraken-is-very-slow-since-macos-big-sur-update
codesign --remove-signature /Applications/GitKraken.app/Contents/Frameworks/GitKraken\ Helper\ \(Renderer\).app
@leonlaser
leonlaser / cleanup.sh
Created December 10, 2020 15:12
[Local Repostiroy Cleanup] #git #cli #bash
# source: https://gitbetter.substack.com/p/how-to-clean-up-the-git-repo-and
git remote prune origin && git repack && git prune-packed && git reflog expire --expire=1.month.ago && git gc --aggressive
@leonlaser
leonlaser / docker_clean_up_none.sh
Created October 24, 2020 11:51
[Docker remove <none> images] #docker
docker images -a | grep none | awk '{print $3}' | xargs docker rmi
@leonlaser
leonlaser / split_text.js
Created August 20, 2020 06:21
[Split text after x chars] #javascript #regex
// Source: https://stackoverflow.com/questions/27758483/split-text-string-at-closest-space-in-javascript
// Author: https://stackoverflow.com/users/1215106/%e2%84%a6mega
// If you are interested in just the first part, then use
var a = fulltext.match(/^.{47}\w*/)
// If you want to split the entire string to multiple substrings, then use
var a = fulltext.match(/.{47}\w*|.*/g);
@leonlaser
leonlaser / git_cleanup_branches.sh
Created July 8, 2020 08:19
[Remove merged local branches] #git #shell #branch
#/bin/env bash
git branch --merged | egrep -v "(^\*|master|develop) | xargs git branch -d
@leonlaser
leonlaser / delete_old.sh
Last active November 27, 2020 09:43
[Delete files older than 30 days] #shell #bash
#/usr/bin/env bash
find ./ -type f -mtime +30 -exec rm -f {} +