Skip to content

Instantly share code, notes, and snippets.

@kylekeesling
kylekeesling / kkees.plugin.zsh
Created November 15, 2013 17:32
An oh-my-zsh plugin that creates a terminal command to quickly get your rails project updated and ready to code. Assumes you're using Rails, git and Sublime Text. Also assumes your apps are stored in '~/sites', should be able to tweak this a little if your environment is a little different. Is really great if you use multiple machines for develo…
start_working() { cd ~/sites/$1; git pull; bundle install; rake db:migrate; subl .; }
@kylekeesling
kylekeesling / keybase.md
Created August 14, 2014 16:00
keybase.md

Keybase proof

I hereby claim:

  • I am kylekeesling on github.
  • I am kylekeesling (https://keybase.io/kylekeesling) on keybase.
  • I have a public key whose fingerprint is 4011 27E5 ADB2 5CC7 FC50 FF9C D906 21B5 5F82 D202

To claim this, I am signing this object:

@kylekeesling
kylekeesling / bootstrap-responsive-btn-group.scss
Last active August 29, 2015 14:27
Bootstrap 3 Responsive Button Group
@media (max-width: $screen-xs-max) {
.btn-group-responsive {
width: 100%;
margin-bottom: 10px;
.pull-left, .pull-right { float: none; }
.btn {
border-radius: $btn-border-radius-small !important;
display: block;
width: 100%;
padding-right: 0;
(1..1000).each do |number|
if number % 7 == 0
puts "#{number} is divisible by 7"
end
end
@kylekeesling
kylekeesling / pets.rb
Last active November 6, 2015 15:41
Example of a Complex Array of Hashes and how to use Enumerable methods on it
$pets = []
$pets << {
:name => 'Lallo',
:nocturnal => false,
:breed => 'Schnauzer',
:talents => ['napping', 'rolling over', 'playing dead'],
:legs => 4
}
$pets << {
# Expected output:
# YOU ARE x YEARS OLD IN DOG YEARS
# Calculate dog years:
# 1 dog year = 7 human years
puts "Hello there, what's your age?"
user_age = gets
dog_years = user_age.to_i * 7
output_string = "you are #{dog_years} years old in dog years"
@kylekeesling
kylekeesling / grandma.rb
Created November 10, 2015 19:55
Deaf Grandma
chatting = true
byes = 0
while chatting
puts "Ask Grandma a question:"
said = gets.chomp!
if said == "BYE"
byes += 1
if byes > 2
chatting = false
else
@kylekeesling
kylekeesling / leap.rb
Created November 10, 2015 19:59
Leap Year Calculator
puts "Enter a starting year in the format YYYY"
starting = gets.chomp!.to_i
puts "Enter an ending year in the format YYYY"
ending = gets.chomp!.to_i
puts "LEAP YEARS between #{starting} and #{ending}"
starting.upto(ending) do |year|
divisible_by_4 = (year % 4) == 0
not_divisible_by_100 = (year % 100) != 0
divisible_by_400 = (year % 400) == 0
@kylekeesling
kylekeesling / 99_bottles.rb
Created November 10, 2015 20:06
99 Bottles of Beer...
num_bottles = 99
while num_bottles > 0
puts "#{num_bottles} bottles of beer on the wall,
#{num_bottles} bottles of beer, take one down, pass it
around, #{num_bottles - 1} bottles of beer on the wall!"
num_bottles = num_bottles - 1
end
@kylekeesling
kylekeesling / fancy_99_bottles.rb
Last active November 12, 2015 21:08
Output the 99 bottles of beer song with numbers in words rather than integers
require_relative 'english_number.rb' #https://gist.github.com/kylekeesling/4b73a984421f120312de
num_bottles = 999
while num_bottles > 0
puts "#{englishNumber(num_bottles)} bottles of beer on the wall,
#{englishNumber(num_bottles)} bottles of beer, take one down, pass it
around, #{englishNumber(num_bottles - 1)} bottles of beer on the wall!"
num_bottles = num_bottles - 1
end