Skip to content

Instantly share code, notes, and snippets.

View nicbet's full-sized avatar

Nicolas Bettenburg nicbet

View GitHub Profile
@nicbet
nicbet / parameterized.rb
Created June 27, 2022 05:09
Concern to run an ActiveJob using .with(), like `NotifyJob.with(recipient: "jamie@example.com").perform_now`
module Parameterized
extend ActiveSupport::Concern
# included do
# attr_accessor :params
# end
module ClassMethods
# Provide the parameters to the job in order to use them in the instance methods and callbacks.
#
@nicbet
nicbet / disabled-ms-auto-update.sh
Created December 1, 2021 13:59
Disable Microsoft AutoUpdate on MacOS
#!/bin/bash
# See https://superuser.com/a/1649000
# disable the service
launchctl disable gui/$(id -u)/com.microsoft.update.agent
# check that the service is disabled
launchctl print-disabled gui/$(id -u) | grep microsoft
@nicbet
nicbet / asset_url_processor.rb
Last active October 17, 2021 03:36
Rails 7 reference assets with CSS Bundler
# 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 August 29, 2020 18:10
Cron Syntax Cheat Sheet
# ┌───────────── 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 July 13, 2020 13:04
Bulma Spacing Helpers
$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 March 15, 2022 16:47
Arc-Flatabulous Theme on Ubuntu 20.04
#!/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
Last active March 6, 2024 21:13
Bulma Circular Progress Bars
/* 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 December 13, 2019 15:52
Code Signing in Git on Mac OS X

Install required software

brew install gpg pinentry pinentry-mac

Create a GPG Key

gpg --full-generate-key
@nicbet
nicbet / Deploy a Phoenix app with Dokku.md
Created October 4, 2019 17:27 — forked from col/Deploy a Phoenix app with Dokku.md
Deploy a Phoenix app with Dokku
@nicbet
nicbet / digital-ocean-ddns-update.sh
Created July 8, 2019 23:41
Digital Ocean - Dynamic DNS (DDNS) Updater Script for Multiple Subdomains (e.g., Traefik)
#!/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