Skip to content

Instantly share code, notes, and snippets.

@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))
@andersevenrud
andersevenrud / alacritty-tmux-vim_truecolor.md
Last active April 23, 2024 03:48
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
@mehiel
mehiel / CountriesDropdown.js
Last active October 20, 2020 12:02
React: use-dropdown hook
import React, { useRef } from "react";
import useDropdown from "use-dropdown";
function CountriesDropdown(props) {
const coutriesEl = useRef(null);
const countriesDropEl = useRef(null);
const [countriesDropOpen, toggleCountriesDrop] = useDropdown(countriesDropEl, coutriesEl);
const onClick = () => toggleCountriesDrop();
return (
@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
@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
@arturopuente
arturopuente / git-lg.sh
Last active June 4, 2019 17:27
git lg
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset%C(red)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --abbrev-commit"
@niksumeiko
niksumeiko / disable-html-form-input-autocomplete-autofill.md
Last active April 22, 2024 17:49
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;">
    ...
<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">
@beathyate
beathyate / ruby2_rails4_os_x_mavericks.md
Last active December 29, 2015 09:39
Instalación de Ruby 2.1 y Rails 4.1 en OS X Mavericks

1. Instala Xcode a través del Mac App Store

2. Abre Terminal.app y ejecuta

xcode-select --install

3. Acepta el prompt que sale y espera a que termine de instalar.

@willurd
willurd / web-servers.md
Last active April 23, 2024 23:07
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