Skip to content

Instantly share code, notes, and snippets.

View vikdotdev's full-sized avatar
📎

Viktor Habchak vikdotdev

📎
View GitHub Profile
@searls
searls / rails_bisect_step
Created February 1, 2023 20:34
Used in conjunction with [this script](https://gist.github.com/searls/5c6b77213dbc7202ca39f4e70d975eee) to make it easier to git bisect rails apps whose database changes during the affected sha range
#!/usr/bin/env bash
# Usage:
#
# First, be sure you're running `git bisect start --no-checkout`, so you can
# checkout the bisect head yourself and do some pre-flight stuff like rewind
# migrations
#
# $ git bisect good
# Bisecting: 22 revisions left to test after this (roughly 5 steps)
#!/usr/bin/env bash
# Useful when you want to git bisect in a rails app and know
# you need to `bin/rake db:migrate VERSION="SOMETHING"` before
# you check out the next commit so the database is in the right
# state, but you don't know what SOMETHING is.
# Usage:
#
# $ migration_version_at_ref <REF>
@matthewpi
matthewpi / README.md
Last active August 30, 2025 08:46
Nix on Fedora

NixOS on Fedora

Please note that these instructions are not offically supported or condoned by Nix and are not guaranteed to always work, but from my testing everything seems to work perfectly fine.

These steps may not be required if NixOS/nix#2374 is resolved.

SELinux

These commands are required for both Fedora Workstation and Fedora Silverblue

// DISCLAIMER : You can now probably use `data-turbo-action="advance"` on your frame to perform what this controller is aiming to do
// https://turbo.hotwired.dev/handbook/frames#promoting-a-frame-navigation-to-a-page-visit
// Note that you probably want to disable turbo cache as well for those page to make popstate work properly
import { navigator } from '@hotwired/turbo'
import { Controller } from '@hotwired/stimulus'
import { useMutation } from 'stimulus-use'
export default class extends Controller {
connect (): void {
@RRethy
RRethy / gist:ad8a9a3b1112a48226ec3336fa981224
Last active September 19, 2025 19:33
Seamlessly editing remote files in (Neo)Vim with Netrw and scp

Seamlessly editing remote files in (Neo)Vim with Netrw and scp

Neovim and Vim both come bundled with a standard plugin called Netrw. Netrw acts a file explorer (similar to NERDTree), but more importantly has the ability to work with scp (as well as sftp, rcp, ftp, and lots of others :h netrw-nread) to let you edit files and browse directories that are hosted on a remote machine, inside of your local Vim instance.

This is useful since you are able to use your Vim setup and plugins without copying over your dotfiles to the remote machine. As well, since the file is copied to your local machine, there will be no delay when typing.

Setup

This is optional for Vim, but required for Neovim (check this Neovim issue explaining why).

@tjvr
tjvr / crypttab
Last active March 13, 2024 17:06
Hibernate on Ubuntu 18.04 with LVM full-disk encryption
sda5_crypt UUID=c66880c1-c2f1-40fc-9580-f25d493876ef none luks,discard
@gaearon
gaearon / minification.md
Last active January 28, 2025 19:19
How to Set Up Minification

In production, it is recommended to minify any JavaScript code that is included with your application. Minification can help your website load several times faster, especially as the size of your JavaScript source code grows.

Here's one way to set it up:

  1. Install Node.js
  2. Run npm init -y in your project folder (don't skip this step!)
  3. Run npm install terser

Now, to minify a file called like_button.js, run in the terminal:

@zaydek-old
zaydek-old / bookmark.min.js
Last active May 28, 2024 19:18
A *simple* CSS debugger. To use, bookmark "Debug CSS" at https://zaydek.github.io/debug.css. Learn more here https://medium.freecodecamp.org/88529aa5a6a3 and https://youtu.be/2QdzahteCCs?t=1m25s (starts at 1:25)
/* debug.css | MIT License | zaydek.github.com/debug.css */ if (!("is_debugging" in window)) { is_debugging = false; var debug_el = document.createElement("style"); debug_el.append(document.createTextNode(`*:not(g):not(path) { color: hsla(210, 100%, 100%, 0.9) !important; background: hsla(210, 100%, 50%, 0.5) !important; outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; box-shadow: none !important; filter: none !important; }`)); } function enable_debugger() { if (!is_debugging) { document.head.appendChild(debug_el); is_debugging = true; } } function disable_debugger() { if (is_debugging) { document.head.removeChild(debug_el); is_debugging = false; } } !is_debugging ? enable_debugger() : disable_debugger();
@RSNara
RSNara / cj
Last active April 10, 2019 09:00
A bash function that I use to create a daily org journal.
#!/bin/bash
function cj() {
JOURNAL_HOME="$HOME/.journal"
FILE="$JOURNAL_HOME/$(date +%Y-%m-%d)".org
mkdir -p "$JOURNAL_HOME"
if [[ ! -f "$FILE" ]]; then
JOURNAL_COUNTER_FILE="$JOURNAL_HOME/.journal-counter"
@rodricels
rodricels / .tmux.conf
Last active August 6, 2025 08:33
tmux configuration, mouse copy & paste added
# My tmux configuration, partly based on https://github.com/wbkang/wbk-stow/blob/master/tmux-config/.tmux.conf
# Scroll History
set -g history-limit 50000
# show messages for 4 seconds instead
set -g display-time 4000
# set first window to index 1 (not 0) to map more to the keyboard layout
set-option -g renumber-windows on