Skip to content

Instantly share code, notes, and snippets.

View ncancelliere's full-sized avatar

Nicholas Cancelliere ncancelliere

View GitHub Profile
<foods>
<veggies>
<veggie>
<name>carrot</name>
<color>orange</color>
<tags>
<tag>juicing</tag>
<tag>raw</tag>
<tag>roasted</tag>
</tags>
Feature: Manage Contact
In order to easily reference individuals and start communications with them
As a workshop co-ordinator
I want to manage contact information
Scenario: View list of contacts
Scenario: Email a contact from list
Scenario: Add a new contact
## manage_contact.feature (cucumber scenario) ###
Scenario: View list of contacts
Given 3 contacts exist # Pickle makes this line possible
When I go to the contact list
Then I should see 3 contacts
## custom_steps.rb (cucumber step-definition) ###
Then /^(?:|I )should see (\d+) (.*)$/ do |count, selector|
@ncancelliere
ncancelliere / .bash_login
Created December 9, 2012 23:04
Shell Prompt with GIT branch label
# Custom prompt with GIT branch label
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NO_COLOUR="\[\033[0m\]"
class MyClass
def say_hello
puts 'Hello Nick!'
end
end
# Reopen the class to override the say_hello method
MyClass.class_eval do
@ncancelliere
ncancelliere / gist:7218754
Created October 29, 2013 17:11
emacs failed to build on 10.9 (Mavericks)
# https://github.com/mxcl/homebrew/issues/23741
mkdir: sys: File exists
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libgnu.a(u64.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libgnu.a(u64.o) has no symbols
xml.c:23:10: fatal error: 'libxml/tree.h' file not found
#include <libxml/tree.h>
^
1 error generated.
make[1]: *** [xml.o] Error 1
make[1]: *** Waiting for unfinished jobs....
@ncancelliere
ncancelliere / therubyracer_install_fail
Created February 17, 2014 13:47
therubyracer compile failure (gcc4.9)
# Using brew installed gcc49 and compiled Ruby using gcc49 therubyracer fails to build
# (it seems to build okay if Ruby is compiled with gcc42)
$ gem install therubyracer -v '0.12.0'
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/nicholas/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
# when scp keeps crapping out (xfering really big files)
# if the connection is interrupted rerun command to pickup where you left off
rsync --partial --progress --rsh=ssh user@host:remote_file local_file
@ncancelliere
ncancelliere / unexpected_output
Last active August 29, 2015 14:04
unexpected output from a simple Elixir function
/**
* Why does certain input result in weird character output rather than a list?
* (from the Exercise: Functions-1 - Pragprog Elixir book)
**/
iex> pair_tuple_to_list = fn {a, b} -> [a, b] end
#Function<6.90072148/1 in :erl_eval.expr/5>
iex> pair_tuple_to_list.({1, 4})
[1, 4]
@ncancelliere
ncancelliere / rails_projects.conf
Last active August 29, 2015 14:06
rotate all my web project logs
# /etc/newsyslog.d/rails_projects.conf
# to test run 'sudo newsyslog -nvv'
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/Users/nicholas/*/*/log/*.log nicholas:staff 644 0 * $W0D23 GZ