Skip to content

Instantly share code, notes, and snippets.

View barning's full-sized avatar

Niklas barning

View GitHub Profile
@barning
barning / custom-twentytwentythree.css
Created March 4, 2023 11:16
My custom CSS for the Wordpress-Theme Twenty Twenty-Three.
.category-gedanke .wp-block-post-title, .category-gedanke .wp-block-post-excerpt__more-text {
display: none;
}
@media (prefers-color-scheme: dark) {
body {
filter: invert(1);
background: #000; /* since most sites declare the background color */
}
img {
"""
This script searches for Markdown files in all subfolders, sorts them by date, and combines them into a single Markdown file. The date is extracted from the filename, which is in the format YYYY-MM-DD. The filename is written as a header at the beginning of each file, and the content of each file is written to the combined file. Square brackets surrounding words, such as [[example word]], are removed from the content.
"""
import os
import re
# Regex to extract the date from the filename
date_regex = re.compile(r'(\d{4})-(\d{2})-(\d{2})')
@barning
barning / convertToWoff.sh
Created March 9, 2021 14:05
Convert from Woff2 to Woff
#!/bin/bash
# Thanks to https://github.com/jens-t
# https://rsms.me/fonttools-docs/subset.html
# https://unicode-table.com/en/#basic-latin
# sudo pip install fonttools brotli
for FILENAME in ./*.woff2; do
NAME=$(echo `basename $FILENAME` | awk -F"." '{print $1}')
@barning
barning / ffmpeg-background-video
Created July 15, 2020 12:00
Compress a video for web background
ffmpeg -y -i input.mov -c:v libx264 -crf 30 -profile:v high -pix_fmt yuv420p -color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart -an output.mp4
@barning
barning / cssGridForIe.scss
Last active May 28, 2019 11:56
Generating css grid for IE and browsers we really love
@mixin cssGrid {
display: -ms-grid;
display: grid;
}
@mixin cssGridTemplateCol($input) {
-ms-grid-columns: #{$input};
grid-template-columns: #{$input};
}
@barning
barning / color-tiles.scss
Last active November 7, 2018 13:24
Color Tile Generator
$colors: (
primary: #de1c24,
secondary: #d3ffce,
):
// Generates Colors Tiles automatically. No need to write more SCSS
@each $name, $color in $colors {
&--#{$name} {
.color-tile__color {
background-color: $color;
@barning
barning / variant-generation.scss
Created August 30, 2018 07:43
Generates a list of bem modifiers
$list: (
xsmall: 12px,
small: 16px,
medium: 24px,
large: 32px
);
@each $name, $size in $list {
.element--#{$name} {
width: $size;
@barning
barning / imagerotator.php
Created March 5, 2015 14:55
Random Background Image PHP
<?php
/*
AUTOMATIC IMAGE ROTATOR
Version 2.2 - December 4, 2003
Copyright (c) 2002-2003 Dan P. Benjamin, Automatic, Ltd.
All Rights Reserved.
http://www.hiveware.com/imagerotator.php
var ctx = new C2S(width,height);
ctx.translate(width/2,height/2);
var poly=[ v2.x, v2.y, v3.x, v3.y, v4.x, v4.y, v5.x, v5.y,v6.x, v6.y ];
ctx.beginPath();
ctx.moveTo(poly[0], poly[1]);
for( item=2 ; item < poly.length-1 ; item+=2 ){ctx.lineTo( poly[item] , poly[item+1] )}
ctx.closePath();
//ctx.fillStyle = "rgba(255,255,255,0)";
ctx.strokeStyle = 'rgb('+r+','+g+','+b+')';
ctx.lineWidth = 5;
var downloadAsSVG = function (fileName) {
if(!fileName) {
fileName = "dieflaeche"+second()+minute()+day()+year()+".svg"
}
var url = "data:image/svg+xml;charset=utf-8,"+encodeURIComponent(mySVG);
var link = document.getElementById("download");
link.download = fileName;
link.href = url;
link.click();
}