Skip to content

Instantly share code, notes, and snippets.

View anowell's full-sized avatar

Anthony Nowell anowell

View GitHub Profile
@anowell
anowell / .tmux.conf
Last active December 19, 2015 17:09
tmux config
# Bind prefix to tick, but let double-tick through
unbind `
set -g prefix `
bind-key ` send-key `
# Ring the bell if any background window rang a bell
set -g bell-action any
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
@anowell
anowell / bash_search.sh
Created March 30, 2013 00:57
Bash search function - Quickly search for files containing text Piping find output into grep and optionally into your editor
# Function to search for string in a set of files
#
# Add this function to ~/.bashrc
# Restart terminal or run: source ~/.bashrc
# Optionally set EDITOR in ~/.bash_profile (I use "EDITOR=subl")
#
# Examples:
# # Outputs filenames and matches of all found occurrences of "authenticate_user" in .rb files
# search *.rb "authenticate_user"
#
@anowell
anowell / analog_clock.rb
Created December 11, 2012 11:09
AnalogClock class, program, and specs (RSpec tests - TDD)
class AnalogClock
attr_reader :hour, :min, :meridiem
def initialize(time)
return nil unless time.instance_of?(String)
# split on space and colon
split_time = time.split(/:| /)
return nil unless split_time.length == 3
@anowell
anowell / hasSameCharacters.cpp
Created October 23, 2012 08:33
hasSameCharacters simple O(n) solution
// Expected behavior:
// 'abc', 'cba' => true
// 'abca', 'cba' => true
// 'cba', 'abca' => true
// '', '' => true
// 'abcd', 'abc' => false
// 'abc', 'abcd' => false
bool hasSameCharacters(char* c1, char* c2)
{
@anowell
anowell / hasSameCharacters.cpp
Created October 23, 2012 07:45
hasSameCharacters with minor optimization for short strings
// Expected behavior:
// 'abc', 'cba' => true
// 'abca', 'cba' => true
// 'cba', 'abca' => true
// '', '' => true
// 'abcd', 'abc' => false
// 'abc', 'abcd' => false
bool hasSameCharacters(char* c1, char* c2)
{