Skip to content

Instantly share code, notes, and snippets.

@nahurst
nahurst / quick_branch.sh
Created October 26, 2011 16:01
Quick temporary feature branch and merge back
git checkout master
git merge --squash private_feature_branch
git commit -v
@nahurst
nahurst / prettymaps.py
Created January 25, 2022 19:30
Pretty Map for NYC
# For local execution (does not require installing the library):
import sys; sys.path.append('../')
# Prettymaps
from prettymaps import *
# Vsketch
import vsketch
# OSMNX
import osmnx as ox
# Matplotlib-related
@nahurst
nahurst / gist:386b54fc0da7e06b7cc87f5bbb2a9629
Last active November 17, 2020 03:18 — forked from seachai/gist:948ed1eeafa32ce03db6685edb879f71
iTerm 2 Natural Text Editing Preset
Go to Preferences... > Profiles > Keys
Press Load Preset...
Select Natural Text Editing
Then, you can move a word backwards using Option ⌥ + ← and a word forwards using Option ⌥ + →, move to the start of the line using fn + ← and to the end of the line with fn + →. Also you can delete a word backwards using Option ⌥ + ⌫, delete the whole line using Command ⌘ + ⌫.
If the preset doesn't appear, reinstall iTerm2. If you installed it using Homebrew+Cask:
brew cask reinstall iterm2
Also add undo as a Profile > Keys
### Keybase proof
I hereby claim:
* I am nahurst on github.
* I am nahurst (https://keybase.io/nahurst) on keybase.
* I have a public key ASAcZEaVzPl4LOjSEYoWnWnilVDgU7z3upJ64MmSUg_OCQo
To claim this, I am signing this object:
@nahurst
nahurst / iterm.md
Created May 3, 2017 20:45
Open to a particular line from iterm

Often when running tests, you'll see output like:

at Context.<anonymous> (tests/domains/MySchoolPage/WishList/SchoolWishListRowLayout-test.jsx:50:58)

If you Cmd+Click on the file path, you can go directly to the line position of the problem by doint the following:

Open iTerm > Preferences > Profiles > (Your Profile) > Advanced > Semantic History Choose "Run command..." Enter something like

@nahurst
nahurst / singleTest.js
Created March 28, 2017 18:08
Run a single test with Mocha
describe('something', () => {});
describe.only('something', () => {});
@nahurst
nahurst / graph.dot
Last active August 1, 2016 11:20
Graph .dot format for graphvis and omnigraffle
digraph "g" {
rankdir="LR"
Paco [fillcolor="#FF6FF3", shape=box]
Paco -> List;
List -> "Lots Of People";
"Lots Of People" -> List;
List -> Archives;
}
@nahurst
nahurst / sinatra+thin+ssl.rb
Created January 15, 2016 00:05 — forked from TakahikoKawasaki/sinatra+thin+ssl.rb
Sinatra + Thin + SSL
#!/usr/bin/env ruby
#
# This code snippet shows how to enable SSL in Sinatra+Thin.
#
require 'sinatra'
require 'thin'
class MyThinBackend < ::Thin::Backends::TcpServer
def initialize(host, port, options)
@nahurst
nahurst / self_sign.sh
Created January 15, 2016 00:04
Create self signed certificate
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out server.key
rm server.pass.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
@nahurst
nahurst / git.sh
Last active December 24, 2015 12:39
Undoing things on git
git reset --soft HEAD^ # when you just committed something you didn't mean to and you want to change the contents and the message
git commit --amend # when you want to change the commit message you just made
git reset file # when you have a file staged for delete that you want to unstage
git checkout file # when you want to restore that file you unstaged file to it's original version
git reset HEAD file # when you want to unstage a staged change
git reset --soft "HEAD^" # when you just committed something, but you want to undo the commit and revert everything to how it was staged before the commit