Skip to content

Instantly share code, notes, and snippets.

View jerodsanto's full-sized avatar
:shipit:
Always be shipping

Jerod Santo jerodsanto

:shipit:
Always be shipping
View GitHub Profile
=dead-center(!height,!width)
:height= !height
:margin-top= -(!height / 2)
:top 50%
:width= !width
:margin-left= -(!width / 2)
:left 50%
:position absolute
:text-align center
APTGET = "apt-get install -qqy"
RUBY19 = "ruby-1.9.1-p129"
SRC = "/usr/local/src"
WGET = "wget -q"
namespace :ruby do
desc 'download and compile Ruby 1.9'
task :install_19 do
deps = %w'zlib1g-dev libopenssl-ruby1.9'
print 'Enter file size (MB): '
the_size = gets.chomp
fail "bad file size" unless the_size =~ /^\d+$/
file_size = 0
string = "abcdefghijklmnopqrstuvwxyz123456"
File.open(the_size + 'MB', 'w') do |f|
while file_size < the_size.to_i * 1048576 # bytes in 1MB
require 'rubygems'
require 'twitter'
base = Twitter::Base.new(Twitter::HTTPAuth.new('username', 'password'))
my_friends = base.friend_ids
candidates = my_friends.inject(Array.new) { |array,id| array += Twitter.friend_ids(id); array }
candidates -= my_friends
tallied = candidates.inject(Hash.new(0)) { |hash, can| hash[can] += 1; hash }
ordered = tallied.sort { |x,y| y[1] <=> x[1] }
require 'rubygems'
require 'twitter'
auth = Twitter::HTTPAuth.new('username', 'password')
base = Twitter::Base.new(auth)
guilty = base.friend_ids - base.follower_ids
puts "There are #{guilty.size} People you follow who do not follow you"
guilty.each do |user_id|
desc 'Generate Sitemap'
task :sitemap => :environment do
require 'big_sitemap'
sitemap = BigSitemap.new(:url_options => {:host => 'example.com'})
sitemap.add Ticket
sitemap.generate
# sitemap.ping_search_engines
end
#!/usr/bin/env ruby
print 'Enter file size (MB): '
the_size = gets.chomp
unless the_size =~ /^\d+$/
puts "Error: bad file size"
exit
end
class Pickup < ActiveRecord::Base
validate_on_create :date_three_days_in_future
private
def date_three_days_in_future
errors.add_to_base "must be at least 3 days from now" unless date >= 3.days.from_now.to_date
end
end
require 'ping'
unless ARGV.first =~ /\d+\.\d+\.\d+\.\d+/
puts "Bad Network address: #{ARGV.first}"
exit 1
end
$stdout = File.open(ARGV.last,"w") if ARGV.size == 2
class_c = ARGV.first.gsub(/\d+$/,"")
#!/usr/local/bin/ruby
require 'resolv'
require 'rubygems'
require 'rb-skypemac'
include SkypeMac
def set_location(loc)
Skype.send_ :command => "SET PROFILE MOOD_TEXT #{loc}"
end