Skip to content

Instantly share code, notes, and snippets.

class Employee(object):
def __init__(self, name):
self.name = name
def greet(self, other):
print "Hello, %s" % other.name
class CEO(Employee):
def greet(self, other):
print "Get back to work, %s!" % other.name
@seanrclayton
seanrclayton / ipchange_cron.rb
Created November 10, 2014 19:12
im sick of my ip changing and not knowing
#!/usr/bin/env ruby
require 'httparty'
require 'pp'
require 'nokogiri'
require 'mail'
options = { :address => "smtp.gmail.com",
:port => 587,
:user_name => 'seancvolusion',
my $file_contents = do {
local $/;
local @ARGV = ( $filename );
<>
};
require 'rest_client'
require 'digest/sha1'
require 'base64'
require 'xmlsimple'
##time
time = Time.new
month = time.month
day = time.day
hour = time.hour
Ian Schumann
10:48 actually this was when we were planning our Registry inventory. pretty funny. we came from such different starting points about what kinds of things you should have in life and that conflict revealed the deeper issues at hand
Sean Clayton
10:48 yes
10:48 steph and i have had that exact fight
10:48 and i went
10:48 WELLP how much do i care about this to make it an issue
10:48 not enough.
Ian Schumann
<head>
<script>
$(document).ready(function(){
array = ['image1.png','image2.png','image3.png']
i = 0
activeimage = array[0]
$('#slideshow').find('img').attr("src", "/"activeimage);
});
require 'pp'
instances = "bags bread shit blah"
in_scope = ["cookies", "salad", "bags"]
if in_scope.find {|e| /#{e}/ =~ instances }
print "happy day"
else
print "I'm sad"
@seanrclayton
seanrclayton / gist:10936193
Created April 16, 2014 21:43
loop through hash
def iterate_hash(hash, i_want)
@i_want = i_want
hash.each_pair do |k,v|
if k == i_want
puts "#{k} is the fucking key"
puts "#{v} is the fucking value"
end
if v.is_a?(Hash)
iterate_hash(v, @i_want)
end
@player_win_count = 0
@op_win_count = 0
def game
choices = ['rock', 'paper', 'scissors' ]
(1..100).each do |x|
if x % 3 == 0 && x % 5 == 0
puts "Fizzbuzz"
elsif x % 3 == 0
puts "fizz"
elsif x % 5 == 0
puts "buzz"