Skip to content

Instantly share code, notes, and snippets.

Avatar

Nicolas Bettenburg nicbet

View GitHub Profile
@nicbet
nicbet / asset_url_processor.rb
Last active Oct 17, 2021
Rails 7 reference assets with CSS Bundler
View asset_url_processor.rb
# config/initializers/asset_url_processor.rb
# See https://github.com/rails/cssbundling-rails/issues/22
class AssetUrlProcessor
def self.call(input)
context = input[:environment].context_class.new(input)
data = input[:data].gsub(/url\(\s*["']?(?!(?:\#|data|http))([^"'\s)]+)\s*["']?\)/) do |_match|
"url(#{context.asset_path($1)})"
end
{data: data}
@nicbet
nicbet / crontab
Created Aug 29, 2020
Cron Syntax Cheat Sheet
View crontab
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * * <command to execute>
@nicbet
nicbet / helpers.scss
Created Jul 13, 2020
Bulma Spacing Helpers
View helpers.scss
$sizes: -20,-19,-18,-18,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
@media screen {
@each $size in $sizes {
.pb-#{$size}-widescreen {
@include widescreen { padding-bottom: #{$size}rem !important; }
}
.pt-#{$size}-widescreen {
@include widescreen { padding-top: #{$size}rem !important; }
}
.pl-#{$size}-widescreen {
@nicbet
nicbet / build-arc-flatabulous.sh
Last active Sep 4, 2021
Arc-Flatabulous Theme on Ubuntu 20.04
View build-arc-flatabulous.sh
#!/bin/bash
wget http://launchpadlibrarian.net/365856925/multiarch-support_2.27-3ubuntu1_amd64.deb
wget http://launchpadlibrarian.net/353281752/libsass0_3.4.8-1_amd64.deb
wget http://launchpadlibrarian.net/344203197/sassc_3.4.5-1_amd64.deb
sudo dpkg -i multiarch-support_2.27-3ubuntu1_amd64.deb
sudo dpkg -i libsass0_3.4.8-1_amd64.deb
sudo dpkg -i sassc_3.4.5-1_amd64.deb
@nicbet
nicbet / circular-progress-bar.scss
Created Feb 17, 2020
Bulma Circular Progress Bars
View circular-progress-bar.scss
/* Progress Bars */
$step: 1;
$loops: round(100 / $step);
$increment: 360 / $loops;
$half: round($loops / 2);
$backColor: #fafafa;
.progress-circle {
position: relative;
float: left;
@nicbet
nicbet / Code Signing with Git on Mac OS X.md
Created Dec 13, 2019
Code Signing in Git on Mac OS X
View Code Signing with Git on Mac OS X.md

Install required software

brew install gpg pinentry pinentry-mac

Create a GPG Key

gpg --full-generate-key
View Deploy a Phoenix app with Dokku.md
@nicbet
nicbet / digital-ocean-ddns-update.sh
Created Jul 8, 2019
Digital Ocean - Dynamic DNS (DDNS) Updater Script for Multiple Subdomains (e.g., Traefik)
View digital-ocean-ddns-update.sh
#!/bin/bash
# Created by fibergames.net // Loranth Moroz // v.0.5
# Updated by yukicreative // Jay Vogt // v.0.6
# Updated by nicbet // Nicolas Bettenburg // v.0.7
# Required tools to run this script as is: curl (https://curl.haxx.se/) & jq (https://stedolan.github.io/jq/)
# This is to be used with crontab -> example entry to run it every 3hours:
# 0 */3 * * * sh /path/to/script/dnsupdater.sh
# Don't forget to make it executable: chmod +x /path/to/script/dnsupdater.sh
@nicbet
nicbet / Dockerfile
Created Jun 27, 2019
Elixir 1.9 Releases Alpine Linux Docker Multi-Stage Build
View Dockerfile
# ---- Build Stage ----
FROM erlang:22-alpine AS app_builder
# Set environment variables for building the application
ENV MIX_ENV=prod \
TEST=1 \
LANG=C.UTF-8
# Fetch the latest version of Elixir (once the 1.9 docker image is available you won't have to do this)
RUN set -xe \
@nicbet
nicbet / workbench.main.css
Created May 7, 2019
Visual Studio Code Tree Lines
View workbench.main.css
/*!--------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
* /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.css
*--------------------------------------------------------*/
.monaco-action-bar{text-align:right;overflow:hidden;white-space:nowrap}.monaco-action-bar .actions-container{display:flex;margin:0 auto;padding:0;width:100%;justify-content:flex-end}.monaco-action-bar.vertical .actions-container{display:inline-block}.monaco-action-bar.reverse .actions-container{flex-direction:row-reverse}.monaco-action-bar .action-item{cursor:pointer;display:inline-block;transition:transform 50ms ease;position:relative}.monaco-action-bar .action-item.disabled{cursor:default}.monaco-action-bar.animated .action-item.active{transform:scale(1.272019649)}.monaco-action-bar .action-item .icon{display:inline-block}.monaco-action-bar .action-label{font-size:11px;margin-right:4px}.monaco-action-bar .action-label.octicon{fo