Skip to content

Instantly share code, notes, and snippets.

View keith's full-sized avatar

Keith Smiley keith

View GitHub Profile
@keith
keith / links.txt
Last active August 29, 2015 14:06
emacs for vim users
@keith
keith / objcvim.md
Last active August 29, 2015 13:57
Some thoughts about a Vim plugin for Objective-C developement
  • Create new classes
    • Which project when multiple projects?
      • Not running from folder that actually has the project
        • Look in current dir
        • Look at top of git/hg/svn repo (code from investigate)?
        • Ask for path?
      • Set default project in cache?
        • Cache location local directory
      • When asking projects complete file path
  • Ask if it should default
@keith
keith / sudoers
Last active January 8, 2024 18:37
The default macOS 14.2.1 sudoers file
#
# Sample /etc/sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
##
# Override built-in defaults
##
@keith
keith / fish_prompt.fish
Created February 17, 2014 02:37
Mimicking %2c from zsh
set __pwd (pwd)
set __parent (basename (dirname $__pwd))
set __current (basename $__pwd)
set __full (printf "%s/%s" $__parent $__current)
set __home (echo $HOME | awk '{ print substr($1, 2, length($1) - 1); }')
set __prompt (echo "$__full" | sed -e "s|$__home|~|" -e "s|$USER|~|" -e "s|^///|/|" -e "s|^//|/|")
@keith
keith / excludes
Last active December 31, 2015 15:58
Backup with rsync (untested)
*/.Trash
/.bzvol
/.com.apple.NetBootX
/.fseventsd
/.hotfiles.btree
/.journal
/.journal_info_block
/.MobileBackups
/.vol/*
/afs/*
@keith
keith / atom.xml
Last active December 19, 2015 11:59
Jekyll Atom Feed
---
layout: nil
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text"><![CDATA[{{ site.name }}]]></title>
{% if site.description %}
<subtitle type="text"><![CDATA[{{ site.description }}]]></subtitle>
{% endif %}
<updated>{{ site.time | date_to_xmlschema }}</updated>
@keith
keith / compressjs.sh
Created July 2, 2013 19:14
Compresses Javascript using YUI Compressor. Expects the compiled YUI Compressor jar file to be in the same directory as the executed script
#!/usr/bin/env bash
die() {
echo "Usage $(basename $0) [infile] [outfile]"
exit
}
if [[ $# -lt 1 ]];then
die
fi
@keith
keith / googleReaderOPML.rb
Created February 1, 2013 17:29
Export your google reader subscriptions to an OPML file
#!/usr/bin/env ruby
#
# => This script will authorize your Google credentials and download your Google Reader subscriptions
# => Usage: ./googleReaderOPML.rb GOOGLEUSERNAME PASSWORD
#
# The required networking shenanigans
require 'uri'
require 'net/http'
@keith
keith / goodVimKeysSandbox.mm
Last active December 10, 2015 20:28
http://smileykeith.com/2013/01/08/nstableview-vim-keys/ Override keyDown to use vim keys in something. Like an NSTableView. Only goodVimKeysSandbox.mm works perfectly in the OS X sandbox.
if ([theEvent keyCode] == 38) { // j
unichar down = NSDownArrowFunctionKey;
NSString *downString = [NSString stringWithCharacters:&down length:1];
NSEvent *newEvent =[NSEvent keyEventWithType:NSKeyDown
location:theEvent.locationInWindow
modifierFlags:theEvent.modifierFlags
timestamp:theEvent.timestamp
windowNumber:theEvent.windowNumber
context:nil
characters:downString
@keith
keith / SpawniTerm.applescript
Last active July 22, 2022 19:37
Spawn a new iTerm window in the pwd
on run argv
tell application "iTerm"
set t to make new terminal
tell t
activate current session
launch session "Default Session"
tell the last session
write text "cd \"" & item 1 of argv & "\"; clear; pwd"
end tell
end tell