Skip to content

Instantly share code, notes, and snippets.

View roalcantara's full-sized avatar
🤖
Don't Panic!

Rogério Rodrigues de Alcântara roalcantara

🤖
Don't Panic!
View GitHub Profile
@smjonas
smjonas / inc_rename.lua
Last active March 1, 2023 14:45
Incremental LSP rename command based on Neovim's command-preview feature
-- Usage: type :IncrementalRename <new_name> while your cursor is placed above an identifier (LSP must be enabled)
-- Update: this gist will no longer be updated since this command has been turned into a plugin!
-- You can find the plugin here: https://github.com/smjonas/inc-rename.nvim
local state = {
added_lines = false,
orig_lines = {},
lsp_positions = {},
}
# Instructions for fresh install
$ sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon
# reboot
$ source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
$ echo 'export NIX_PATH=darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH' | tee -a ~/.zshrc
$ echo 'source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh' | tee -a ~/.zshrc
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
@chriselsner
chriselsner / nix-on-macos-catalina.md
Last active January 24, 2024 18:35
Nix on macOS Catalina

Nix on macOS Catalina

I'm writing this gist for my own records but it might help someone else too.

Installing Nix

Support for Catalina has improved a lot since the update was first rolled out.

Note: See the NixOS manual for discussion of the --darwin-use-unencrypted-nix-store-volume option.

{
"meta": {
"theme": "elegant"
},
"basics": {
"name": "Thomas Davis",
"label": "Web Developer",
"image": "https://avatars0.githubusercontent.com/u/416209?s=460&u=38f220a2c9c658141804f881c334c594eb1642ac&v=4",
"summary": "I'm a full stack web developer who can build apps from the ground up. I've worked mostly at startups so I am used to wearing many hats. I am a very product focused developer who prioritizes user feedback first and foremost. I'm generally very flexible when investigating new roles. ",
"website": "https://lordajax.com",
Note: this assumes you are using ZSH shell.
## Installation
Install [asdf](https://github.com/asdf-vm/asdf):
```
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.4.0
$ echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc
$ echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc
@markmur
markmur / .zshrc
Last active June 6, 2023 12:11
Add script to package.json via command line
# Reusable bash function you can add to your ~/.zshrc or ~/.bashrc file
#
# Usage: pkg-script start "node index.js"
#
function pkg-script () {
echo $(jq --arg key "${1}" --arg val "${2}" '.scripts[$key]=$val' package.json) | jq . | > package.json
}
@dougal83
dougal83 / register.component.html
Created May 15, 2017 12:13
AngularJS (v2+) Validate equal value form controls (e.g. password confirmation)
<div class="card">
<h4 class="card-header">Register</h4>
<div class="card-block">
<form [formGroup]="registerForm" (ngSubmit)="register()">
<div class="form-group" [ngClass]="setClassUsername()">
<input class="form-control" type="text" name="username" formControlName="username" placeholder="Username" autofocus>
</div>
<div class="form-group" [ngClass]="setClassPassword()">
<input class="form-control" type="password" name="password" formControlName="password" placeholder="Password">
</div>
@ssebastianj
ssebastianj / bindkey.md
Last active December 26, 2023 06:34
zsh bindkey commands
Shortcut Action
CTRL+@ set-mark-command
CTRL+A beginning-of-line
CTRL+B backward-char
CTRL+D delete-char-or-list
CTRL+E end-of-line
CTRL+F forward-char
CTRL+G send-break
CTRL+H backward-delete-char
@ctechols
ctechols / compinit.zsh
Last active April 19, 2024 23:44
Speed up zsh compinit by only checking cache once a day.
# On slow systems, checking the cached .zcompdump file to see if it must be
# regenerated adds a noticable delay to zsh startup. This little hack restricts
# it to once a day. It should be pasted into your own completion file.
#
# The globbing is a little complicated here:
# - '#q' is an explicit glob qualifier that makes globbing work within zsh's [[ ]] construct.
# - 'N' makes the glob pattern evaluate to nothing when it doesn't match (rather than throw a globbing error)
# - '.' matches "regular files"
# - 'mh+24' matches files (or directories or whatever) that are older than 24 hours.
autoload -Uz compinit
@harrisonde
harrisonde / gist:90431ed357cc93e12b51
Last active May 24, 2021 22:01
Deploy Laravel 5 applications on AWS Elastic Beanstalk
# The following script will deploy a Laravel 5 applicaion on AWS Elastic Beanstalk.
# Add to .ebextensions at the root of your application and name your commands file (e.g., commands.config)
# -------------------------------- Commands ------------------------------------
# Use "commands" key to execute commands on the EC2 instance. The commands are
# processed in alphabetical order by name, and they run before the application
# and web server are set up and the application version file is extracted.
# ------------------------------------------------------------------------------
commands:
01updateComposer: