Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am bewatts on github.
  • I am bewatts (https://keybase.io/bewatts) on keybase.
  • I have a public key ASC-23a0N3AFSb7jw9DEtt9uSVPGdNFfiT6YQD4CeIquNwo

To claim this, I am signing this object:

@bewatts
bewatts / gist:980a2cb0113f4827e6dd
Created July 8, 2015 17:27
Instance Variable Example
class Example
def initialize( a, b )
@a = a
@b = b
end
def a
@a
end
class HangmanGameLoop
def initialize(word_to_guess)
@word_to_guess = word_to_guess
@guessed_letters = []
end
def word_to_guess
@word_to_guess
end
@bewatts
bewatts / noko_v_ruby.rb
Last active August 29, 2015 14:01
NokoGiri selectors vs Ruby loops
require 'benchmark'
require 'nokogiri'
require 'open-uri'
class PageScraper
def self.get_youtube_urls(url)
self.new(url).get_youtube_urls
end
@bewatts
bewatts / gist:97173fc32cffa42b1a98
Created April 30, 2014 01:29
Adding class/instance methods meta-programmatically through ActiveSupport::Concern
#Solution was probably too much overhead for the problem I had at hand - but it was fun.
#Note: This gist assumes Rails.
module Concerns
module LinkedAccountable
extend ActiveSupport::Concern
ACCOUNT_TYPES = ["twitter", "google"]
def self.included(obj)