Skip to content

Instantly share code, notes, and snippets.

Josh Rickard joshrickard

Block or report user

Report or block joshrickard

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joshrickard
joshrickard / word_search.rb
Created May 25, 2015
Starting with a word, change one letter at a time to get to the target word.
View word_search.rb
$words_attempted = { } # global list of words already attempted
$word_dictionary = { } # global dictionary of valid words
# Returns the indicies for current_word as an array. Setting
# optimized to true will place non-matching characters between
# the current and target words at the beginning of the array.
def get_letter_indicies(optimized, current_word, target_word)
[].tap do |letter_indicies|
@joshrickard
joshrickard / gist:44c15bd3a63b59adb851
Last active Aug 29, 2015
Ubuntu Server 14.04 LTS with Ruby
View gist:44c15bd3a63b59adb851
sudo apt-get -y update
sudo apt-get -y dist-upgrade
sudo apt-get -y install apticron build-essential curl git-core ntp sendmail
sudo apt-get -y autoremove
# reboot
shutdown -r now
# update email address for update notifications
#
View setup.sh
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential curl gettext
wget http://download.mono-project.com/sources/mono/mono-3.2.5.tar.bz2
tar jxf mono-3.2.5.tar.bz2
cd mono-3.2.5/
./configure --prefix=/usr/local; make; make install
View setup.sh
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential curl gettext mysql-server redis-server
@joshrickard
joshrickard / setup.sh
Last active Dec 28, 2015
Setup ruby environment on Ubuntu 14.04.1 desktop.
View setup.sh
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install build-essential curl git-core redis-server
# setup git
git config --global user.name "Josh Rickard"
git config --global user.email josh.rickard@gmail.com
# install RVM
curl -L https://get.rvm.io | bash
@joshrickard
joshrickard / gist:2049584
Created Mar 16, 2012
Ruby Prawn - horizontally & vertically center a table within its container
View gist:2049584
# inspiration from: https://gist.github.com/2045188
# horizontally & vertically center a table within its container
t = make_table(table_data, { :position => :center })
move_down((bounds.height - t.height) / 2.0)
t.draw
# calculate the table's offset from its container
x_offset = (bounds.width - t.width) / 2
y_offset = (bounds.height - t.height) / 2
You can’t perform that action at this time.