Skip to content

Instantly share code, notes, and snippets.

@onlytracks
onlytracks / freightview-api-sample-auth.js
Created March 28, 2016 15:07
Freightview API Sample Auth
var request = require("request")
request
.get("https://www.freightview.com/api/authenticate")
.auth("<your_key>")
.pipe(process.stdout)
// Response: user@example.com successfully authenticated.

Keybase proof

I hereby claim:

  • I am onlytracks on github.
  • I am onlytracks (https://keybase.io/onlytracks) on keybase.
  • I have a public key ASBDPql_3O67Quy04L6xUbavSR3chvw8YG1ODcMOBBLXjwo

To claim this, I am signing this object:

Answer by Jim Dennis on Stack Overflow question http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118

Your problem with Vim is that you don't grok vi.

You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).

The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:

0 go to the beginning of this line. y yank from here (up to where?)

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@onlytracks
onlytracks / gist:3248894
Created August 3, 2012 15:48
Bash autocomplete directory names for cd alias
function cdcode() { cd $HOME/code/$@ ;}
_cdcode () { local cur; cur=${COMP_WORDS[$COMP_CWORD]}; COMPREPLY=( $( compgen -d -- $HOME/code/ | grep $cur | xargs --no-run-if-empty -l1 basename ) ); return 0; }
complete -F _cdcode cdcode
@onlytracks
onlytracks / uri.js
Created April 26, 2012 02:08 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@onlytracks
onlytracks / gist:1951021
Created March 1, 2012 16:25
JavaScript Mixin Pattern
var Person = function(name) {
this.name = name
}
var GreeterMixin = function() {
this.greet = function(name) {
return "Hello " + name + ", I am " + this.name
}
}