Skip to content

Instantly share code, notes, and snippets.

View scsskid's full-sized avatar
:octocat:

Benedikt Gregor scsskid

:octocat:
View GitHub Profile
@scsskid
scsskid / getScrollBarWidth.ts
Created October 22, 2023 11:32
getScrollBarWidth
export default function getScrollbarWidth() {
// Creating invisible container
const outer = document.createElement("div");
outer.style.visibility = "hidden";
outer.style.overflow = "scroll"; // forcing scrollbar to appear
// @ts-ignore
outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
document.body.appendChild(outer);
#!/bin/sh
# This script generates a ssh key for a single repository
# and adds a custom configuration to the users (not global) ssh config file,
# and outputs the public key for you to copy and paste as the repo deploy key
# and outputs the url for you to clone the repo on the machine.
# Github docs ref:
# https://docs.github.com/en/developers/overview/managing-deploy-keys#using-multiple-repositories-on-one-server
#
# 1. Add the script to the user account of the machine. The home directory is fine.
# 2. Make the script executable by running the following command as the user:
sup {
vertical-align: baseline;
font-feature-settings: "sups";
font-size: 1em;
}
sub {
vertical-align: baseline;
font-feature-settings: "subs";
font-size: 1em;
}
@scsskid
scsskid / generate-deploy-key.sh
Created March 5, 2023 19:41
generate deploy key
#!/bin/sh
# This script generates a ssh key for a single repository
# and adds a custom configuration to the users (not global) ssh config file,
# and outputs the public key for you to copy and paste as the repo deploy key
# and outputs the url for you to clone the repo on the machine.
# Github docs ref:
# https://docs.github.com/en/developers/overview/managing-deploy-keys#using-multiple-repositories-on-one-server
#
# 1. Add the script to the user account of the machine. The home directory is fine.
# 2. Make the script executable by running the following command as the user:
@scsskid
scsskid / docker-personal-cheatsheet.md
Last active February 15, 2023 18:16
Docker Personal Cheatcheet | #bash #docker

Docker Personal Cheatsheet

remove all containers

docker rm -f $(docker ps -aq)

Get ip address of container

@scsskid
scsskid / nginx-reverse-proxy.md
Last active September 15, 2021 16:19
Nginx Reverse Proxy Config Docker Wordpress #ubuntu #docker #nginx

Nginx Reverse Proxy

Sample Config from wordpress project

server {
  listen        80;
  server_name   v2.benedikt.gr;

 location / {
@scsskid
scsskid / tools.md
Last active September 12, 2021 11:31
network-tools
@scsskid
scsskid / git-disable-pager.md
Last active September 1, 2021 18:36
git disable default pager config | #git

Disable Pager

for git diff or other commands
--global is optional

git config --global pager.diff false
@scsskid
scsskid / inline-svg-function.scss
Created September 1, 2021 15:37 — forked from JacobDB/inline-svg-function.scss
Inline SVG function [SASS]
// Replace letters
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}
@scsskid
scsskid / date-object-cheatsheet.js
Last active September 1, 2021 15:34 — forked from LeCoupa/date-object-cheatsheet.js
JavaScript Date Object CheatSheet | #date
// src: https://github.com/LeCoupa/awesome-cheatsheets
// Date Object CheatSheet
// The Date object is used to work with dates and times.
// More: http://www.w3schools.com/jsref/jsref_obj_date.asp
// 1. Instantiating a Date.