Skip to content

Instantly share code, notes, and snippets.

@seansellek
seansellek / my_99_bottles.rb
Created March 28, 2017 22:00
99 Bottles Solutions
class Bottles
def verses from, to
from.downto(to).map{|line| verse line }.join("\n")
end
def verse count
<<~VERSE
#{bottles(count).capitalize} of beer on the wall, #{bottles count} of beer.
#{line_2 count}
VERSE
@seansellek
seansellek / hello.txt
Created March 8, 2017 01:43
hello world
this is my hello gist.
@seansellek
seansellek / iterm_profile.json
Created February 25, 2017 22:34
Iterm Profile
{
"Use Non-ASCII Font" : false,
"Tags" : [
],
"Ansi 12 Color" : {
"Red Component" : 0.3799041509628296,
"Color Space" : "Calibrated",
"Blue Component" : 0.4433690011501312,
"Alpha Component" : 1,
@seansellek
seansellek / .zshrc
Created July 24, 2016 20:07
Terminal Config
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="seantheme"
# Uncomment the following line to use case-sensitive completion.
puts "pick a number from 1 to 100"
max = 100
min = 1
found = false
while not found
guess = (max + min) / 2
puts "Is your number #{guess}?"
puts "y) Yup!"
@seansellek
seansellek / strings-vs-symbols-performance.md
Created January 13, 2016 16:54
A quick overview of the performance differences between Strings and Symbols, and whether you should worry about them.

I noticed some of you mentioned that Symbols are faster than Strings. You’re 100% correct! I tested a quick script to demonstrate:

require 'benchmark'

str = Benchmark.measure do
  10_000_000.times do
    "test" == "test"
  end
end.total
@seansellek
seansellek / capybara cheat sheet
Last active November 10, 2015 18:41 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@seansellek
seansellek / salary-scrape.rb
Created August 25, 2015 13:45
Miami Dade County Salary Scraper
require 'capybara'
require 'capybara/poltergeist'
require 'csv'
class SalaryScraper
include Capybara::DSL
def initialize url
Capybara.default_driver = :poltergeist
@seansellek
seansellek / spec_config.md
Last active August 29, 2015 14:26
RSpec config instructions

Rspec Configuration

  1. add this to your Gemfile:
gem 'rspec-rails'
gem 'shoulda-matchers', require: false
gem 'capybara'
  1. run bundle
@seansellek
seansellek / rcurl.rb
Last active August 29, 2015 14:23
A Ruby implementation of curl that only supports the -i argument
### A Ruby implementation of curl that only supports the -i argument. ###
require 'HTTParty'
option = ARGV[0]
unless option
puts "You need to pass an argument."
exit
end
if option != "-i"