Skip to content

Instantly share code, notes, and snippets.

require 'rest_client'
require 'digest/sha1'
require 'base64'
require 'xmlsimple'
##time
time = Time.new
month = time.month
day = time.day
hour = time.hour
my $file_contents = do {
local $/;
local @ARGV = ( $filename );
<>
};
@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',
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
class Triangle(object):
number_of_sides = 3
def __init__(self, angle1, angle2, angle3):
angle1 = self.angle1
angle2 = self.angle2
angle3 = self.angle3
def check_angles(self):
if self.angle1 + self.angle2 + self.angle3 == 180:
return True
---
some_attribute:
describes_more:
- blue
- green
- other_thing_nested:
-round
-offer
second_thing:
- more shit
@seanrclayton
seanrclayton / Gemfile.lock
Last active August 29, 2015 14:17
Gemfile.lock
GIT
remote: git://github.com/kalleth/spree_gift_card.git
revision: 8247fe88732f263049ac73c3bd13ee1b13030299
branch: 2-4-stable-initforthe
specs:
spree_gift_card (1.0.0.beta)
durable_decorator (~> 0.2.0)
spree_api (~> 2.4.0)
spree_backend (~> 2.4.0)
spree_core (~> 2.4.0)
sean.r.clayton@gmail.com
1:18 oh
1:18 i work at a company called Indeed.
Petie
1:19 i know, my brain just wasn't fully operational
sean.r.clayton@gmail.com
1:19 You want this, dont you?
1:19 I can FEEL your anger
Dir.glob('/var/local/project/logs/**').delete_if{|item| item.match(/\.gz/)}.each do |file|
if File.stat(file).size / 1048576 > 100
last_lines = IO.readlines(file).last(1000).join
File.open(file, 'w') {|f| f.write(last_lines); f.close}
end
end
One of the great mysteries of Christianity is the concept of the Trinity. While there is only one God in Christianity, there are three "persons" (Father, Son, Holy Spirit) that still add up to one God.
Create a God class whose instances always add up to 1. This isn't as easy as it sounds! If you get stuck on a Fixnum coersion error, here's some good reading:
http://www.mutuallyhuman.com/blog/2011/01/25/class-coercion-in-ruby/