Skip to content

Instantly share code, notes, and snippets.

View roryhardy's full-sized avatar

Rory Hardy roryhardy

  • Seattle
View GitHub Profile
@roryhardy
roryhardy / .vimrc
Last active October 4, 2015 10:27
Make VIM look nice in OSX
set ai " auto indenting
set nu " show line numbers
set ruler " show the cursor position
set hlsearch " highlight the last searched term
set history=100 " keep 100 lines of history
syntax on " syntax highlighting
filetype plugin on " use the file type plugins
@roryhardy
roryhardy / pretty_git.sh
Last active December 1, 2015 14:34
Make git pretty
# Run these three commands to make git pretty.
git config --global color.branch "auto"
git config --global color.status "auto"
git config --global color.diff "auto"
@roryhardy
roryhardy / gg.zsh-theme
Last active December 16, 2015 15:38
My oh-my-zsh theme.
# This theme is a derivation of the robbyrussell theme.
# Context: user@hostname (who am I and where am I)
prompt_context() {
local user=`whoami`
if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
echo -n "$user@%m:"
fi
}
@roryhardy
roryhardy / README.md
Last active April 19, 2016 17:59
Multi-lined version of my oh-my-zsh theme.

gg2.zsh-theme

A ZSH theme for those who like the robbyrussell theme, but want the familiar $ and would like their prompt on a separate line from the typing space. For example, if you use git and have large branch names you could have path$ git:(this-is-a-very-very-very-very-very-long-branch-name) which eats up most of a small terminal window.

NOTE: Though this theme looks okay with most fonts, you will need to install a Powerline-patched font for this theme to render correctly.

Screenshot

@roryhardy
roryhardy / getSet.js
Last active December 19, 2015 03:49
Dynamically create getter/setter functions for D3 components!
/**
* getSet creates a getter/setter function for a re-usable D3.js component.
*
* @method getSet
* @param {string} option - the name of the object in the string you want agetter/setter for.
* @param {function} component - the D3 component this getter/setter relates to.
*
* @return {mixed} The value of the option or the component.
*/
function getSet(option, component) {
@roryhardy
roryhardy / homeprofile.sh
Created July 6, 2016 18:55
My Git homeprofile alias
# Inspired by http://www.codeography.com/2011/08/05/project-specific-git-author.html
git config --global alias.homeprofile '!git config user.name "my_name" && git config user.email "my_email" && git config github.user "my_github_user"'
@roryhardy
roryhardy / flat_rename.rb
Last active February 24, 2023 15:49
Copy files from a nested structure to a flat structure while preserving naming
#!/usr/bin/env ruby
require 'fileutils'
def create_filename(item, source, separator)
parents = File.dirname(item).split('/').last(2)
root = source.split('/').last
name = parents.first == root ? parents.last : parents.join(separator)
name += separator + File.basename(item)