Skip to content

Instantly share code, notes, and snippets.

View richarddewit's full-sized avatar
🗿
〰️〰️〰️〰️

Kerani richarddewit

🗿
〰️〰️〰️〰️
View GitHub Profile
@richarddewit
richarddewit / Program.cs
Last active January 9, 2024 13:29
Lowercase URLs in ASP.NET Core 6+
// Program.cs
// ...
builder.Services.AddControllersWithViews();
// Use lowercase URLs
builder.Services.Configure<RouteOptions>(options => options.LowercaseUrls = true);
@richarddewit
richarddewit / downloadTelegramStickers.js
Created July 14, 2023 22:38
Download Telegram Stickers (UPDATED)
// DOM query helpers
// These two do 90% of what you need JQuery for
function qs(query, el = window.document) {
return el.querySelector(query);
}
function qsa(query, el = window.document) {
return Array.from(el.querySelectorAll(query));
}
@richarddewit
richarddewit / rainbow.css
Last active November 9, 2020 09:33
Seamless Animated RGB Rainbow strip - https://codepen.io/richarddewit/pen/VwjEWEL
.rainbow-wrapper {
position: absolute;
left: 0;
right: 0;
top: 0;
height: 10px;
width: 100%;
overflow: hidden;
}
@richarddewit
richarddewit / su
Created September 16, 2020 08:08
A `su` replacement using machinectl
#!/usr/bin/env bash
if [[ "$1" == "-" ]]; then
shift
fi
if [ -z "$1" ]; then
echo "Missing argument USER"
exit 1
fi
@richarddewit
richarddewit / keymap.c
Created April 1, 2020 13:17
Tokyo60 / Tsangan keymap
#include QMK_KEYBOARD_H
// Layers
#define _BASE 0 // Base (QWERTY)
#define _FN 3 // Function
#define BASE DF(_BASE)
// Aliases
#define ___V___ KC_TRNS
@richarddewit
richarddewit / drag_bin_file_here_to_flash.bat
Last active March 26, 2020 19:40
Flash (Mass)Drop keyboards firmware bin file
@ECHO OFF
ECHO Flashing file %~1
ECHO.
mdloader_windows.exe --first --download "%~1" --restart
PAUSE
@richarddewit
richarddewit / README.md
Last active December 24, 2019 12:59
Rails 6 & Svelte with preloaded data

Rails 6 & Svelte with preloaded data

rails new rails-6-svelte --webpack=svelte
cd rails-6-svelte
rails generate controller welcome index
@richarddewit
richarddewit / poebuildscc-sort-popular.js
Created September 16, 2019 19:21
Sort builds by popularity on sub-pages of https://www.poebuilds.cc
@richarddewit
richarddewit / undefined-constant-CrystalCodegenTarget.patch
Last active July 3, 2019 19:29
Patch for "undefined constant Crystal::Codegen::Target" error - crystal-lang-tools/scry v0.8.0
diff --git a/src/scry/completion_provider.cr b/src/scry/completion_provider.cr
index 29e0d36..f67438c 100644
--- a/src/scry/completion_provider.cr
+++ b/src/scry/completion_provider.cr
@@ -1,4 +1,5 @@
require "./log"
+require "compiler/crystal/codegen/target"
require "compiler/crystal/crystal_path"
require "./completion/*"
@richarddewit
richarddewit / _pre-commit-check-console-log.sh
Last active June 26, 2019 08:55 — forked from svschannak/gist:8d1a445a751d5ae8e18ef9b98a45be9f
Git pre-commit hook that detects if the developer forget to remove all the javascript console.log before commit.
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
# enable user input
exec < /dev/tty
consoleregexp='^\+.*console\.log('
# CHECK
if test $(git diff --cached | grep $consoleregexp | wc -l) != 0
then