Skip to content

Instantly share code, notes, and snippets.

@willurd
willurd / web-servers.md
Last active April 15, 2024 09:55
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@andersevenrud
andersevenrud / alacritty-tmux-vim_truecolor.md
Last active April 14, 2024 20:05
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Testing colors

Running this script should look the same in tmux as without.

curl -s https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh
@niksumeiko
niksumeiko / disable-html-form-input-autocomplete-autofill.md
Last active April 11, 2024 07:22
Disable HTML form input autocomplete and autofill

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
@conorbuck
conorbuck / angle-between-points.js
Created May 5, 2012 22:51
JavaScript: Find the angle between two points
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};
@chriseidhof
chriseidhof / boilerplate.swift
Last active January 3, 2024 05:54
QuickMacApp
// Run any SwiftUI view as a Mac app.
import Cocoa
import SwiftUI
NSApplication.shared.run {
VStack {
Text("Hello, World")
.padding()
.background(Capsule().fill(Color.blue))
@vlevit
vlevit / mnuc
Last active February 19, 2023 06:37
Script intended to be executed from ncmpcpp (execute_on_song_change preference) running from urxvt to set album cover as background image
#!/bin/bash
# Script intended to be executed from ncmpcpp (execute_on_song_change
# preference) running from urxvt to set album cover as background image
# Copyright (c) 2013 Vyacheslav Levit
# Licensed under The MIT License: http://opensource.org/licenses/MIT
MUSIC_DIR=$HOME/Music
DARKEN=50 # 0 - original image colors, 100 - absolutely black background
@yalab
yalab / bootstrap-memo.md
Last active July 20, 2022 20:29
rails5 + webpacker + bootstrap
$ echo 'gem "webpacker"' >> Gemfile
$ bundle install
$ rails webpacker:install
$ yarn add bootstrap@4.0.0-beta jquery popper.js
diff --git a/config/webpack/environment.js b/config/webpack/environment.js
index d16d9af..86bf1a7 100644
@mmalek-sa
mmalek-sa / string_enums.rb
Created August 16, 2018 20:45
String enums are useful when you want to keep the actual string instead of integer in database, This gist add the validation to make sure users are passing correct values to model.
require 'active_support/concern'
module StringEnums
extend ActiveSupport::Concern
class_methods do
def string_enum(enums_hash)
enum_name = enums_hash.keys.first.to_s
define_singleton_method(enum_name.pluralize) do
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="/apple-touch-icon-152.png">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144.png">
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="/apple-touch-icon-120.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/apple-touch-icon-114.png">
<link rel="apple-touch-icon-precomposed" sizes="76x76" href="/apple-touch-icon-76.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/apple-touch-icon-72.png">
<link rel="apple-touch-icon-precomposed" sizes="60x60" href="/apple-touch-icon-60.png">
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="/apple-touch-icon-57.png">
<link rel="apple-touch-startup-image" href="/apple_startup_image.png">
<link rel="icon" type="image/png" href="/favicon-16.png" sizes="16x16">