Skip to content

Instantly share code, notes, and snippets.

@lgk-bsw
lgk-bsw / _variables.scss
Last active July 20, 2020 11:37
Rounded Components and Buttons in Bootstrap
// Components
//
$border-radius: .5rem;
$border-radius-lg: .7rem;
$border-radius-sm: .3rem;
// Buttons
//
@lgk-bsw
lgk-bsw / createComponents.js
Created July 17, 2020 09:50
SVG to React generator
const fs = require("fs");
const path = require("path");
const svgToJsx = require("svg-to-jsx");
const parser = require("fast-xml-parser");
let componentCodes = [];
function main() {
const dir = fs.readdirSync(".");
dir.forEach(file => {
@lgk-bsw
lgk-bsw / trac-link-to-svn-file.txt
Last active September 3, 2020 07:10
Trac Verlinkung auf Datei im SVN
@lgk-bsw
lgk-bsw / js-object-to-query-string.js
Last active September 7, 2020 09:42
A handy way to convert a JS object to a query string you can pass to an API
const params = {type: "G6.USID", key: "AllgFilter", listPkey: "~ 000G6.USID"};
const query = Object.keys(params)
.map(k => encodeURIComponent(k) + "=" + encodeURIComponent(params[k]))
.join("&")
// Will become: type=G6.USID&key=AllgFilter&listPkey=~%20%20%20000G6.USID
// Usage
@lgk-bsw
lgk-bsw / get-cherry-pick-commands.js
Last active July 5, 2021 08:12
Run this on the commits tab in a PR to get a list of cherry-pick commands
let queries = []
const rows = document.querySelectorAll(".TimelineItem-body .Box-row")
for (const r of rows) {
const label = r.querySelector(".Details .Link--primary")
const link = r.querySelector("a.BtnGroup-item")
const splitted = link.href.split("/")
queries.push(`${label.innerText}<br><code>git cherry-pick ${splitted[splitted.length - 1]}</code>`)
}
@lgk-bsw
lgk-bsw / delete-closed-branches.js
Created July 5, 2021 12:08
Run this on the branches page of a GitHub repo to delete all merged or closed branches
const rows = document.querySelectorAll("div[data-target='branch-filter.result'] .Box-row")
for (const r of rows) {
const stateEl = r.querySelector(".State")
if (stateEl && (stateEl.title.includes("Merged") || stateEl.title.includes("Closed"))) {
r.querySelector(`button[data-target="branch-filter-item.destroyButton"]`).click()
}
//confirm("Continue?")
}
// Use this together with this browser extension (Chrome/Edge) and enable it for GitHub:
// https://chrome.google.com/webstore/detail/custom-javascript-for-web/ddbjnfjiigjmcpcpkmhogomapikjbjdk
// The following code checks if your branch you want to merge, contains "lts-"
// and offers to set the correct base branch.
if (location.pathname.includes("/bruegmann/florence/compare/")) {
let params = location.pathname.split("/")
let compareBranchs = params[params.length - 1].split("...")
@lgk-bsw
lgk-bsw / bootstrap-icons-svg-1em.js
Last active March 16, 2023 08:16
The SVG code examples on the Bootstrap Icons docs use 16px for width and height. This script allows to use 1em instead.
// Use this together with this browser extension (Chrome/Edge) and enable it for https://icons.getbootstrap.com:
// https://chrome.google.com/webstore/detail/custom-javascript-for-web/ddbjnfjiigjmcpcpkmhogomapikjbjdk
/**
* This code adds a switch checkbox on the Bootstrap Icons pages.
* For example on: https://icons.getbootstrap.com/icons/x-lg/
* If enabled, the SVG code will be changed to use `1em` for width and height instead of `16`(px).
*/
if (location.pathname.startsWith("/icons/")) {
@lgk-bsw
lgk-bsw / gist:ee32fad9535b60ad0f0fb2bcd53411e1
Created August 14, 2023 10:29
Bootstrap Grid System Elements Queries
@import "~bootstrap/scss/mixins";
/**
CSS Elements Queries (https://github.com/marcj/css-element-queries) support for Bootstrap's Grid System.
Just add the class name ".element-query" to the parent element.
*/
@mixin make-grid-columns-eq(
$columns: $grid-columns,
$gutter: $grid-gutter-width,
@lgk-bsw
lgk-bsw / .prettierrc
Last active January 9, 2024 13:34
Prettier Config for SvelteKit projekts
{
"useTabs": true,
"singleQuote": false,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }],
"tabWidth": 4,
"semi": false
}