This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EzekielTemplin | |
def initialize | |
@birthdate = Date.parse('1983-06-29') | |
@birthplace = "Saegertown, PA" | |
@gender = "male" | |
end | |
def age | |
Date.today.year - @birthdate.year | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Much more realistic context. | |
def extract_prefix_from_path(path) | |
/(?<prefix>.+)_path/ =~ path.to_s ? prefix : false | |
end | |
path = extract_prefix_from_path("homepath") | |
puts path #=> false | |
puts extract_prefix_from_path("home_path") #=> home |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Import incoming calls" | |
task :fetch_incomingcalls => :environment do | |
# Logs into manage.phoneprovider.co.uk and retrieved list of incoming calls. | |
require 'rubygems' | |
require 'mechanize' | |
require 'logger' | |
# Create a new mechanize object | |
agent = Mechanize.new { |a| a.log = Logger.new(STDERR) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "typhoeus" | |
module Ty | |
class << self | |
include Typhoeus | |
%w(get post put delete head).each do |method| | |
define_method(method.to_sym) do |url, opts = {}| | |
Request.send(method, url, opts) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guard 'spork', :wait => 60, :aggressive_kill => false, :notify_on_start => true do | |
watch('test/test_helper.rb') { :test_unit } | |
end | |
guard 'minitest', :drb => true do | |
watch(%r|^test/(.*)_spec\.rb|) | |
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_spec.rb" } | |
watch(%r|^test/test_helper\.rb|) { "test" } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.gitignore | 2 +- | |
.travis.yml | 7 + | |
CHANGELOG.rdoc | 6 + | |
CONTRIBUTING.md | 45 ++ | |
Gemfile | 10 +- | |
README.md | 649 ++++++++++++++++++ | |
README.rdoc | 563 ---------------- | |
Rakefile | 16 +- | |
lib/VERSION | 4 +- | |
lib/mail.rb | 4 +- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "faraday" | |
require 'typhoeus' | |
conn = Faraday.new(:url => 'http://httpstat.us') do |builder| | |
builder.request :url_encoded | |
builder.response :logger | |
builder.adapter :typhoeus | |
end | |
conn.in_parallel do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tab() { | |
osascript -e " | |
tell application \"iTerm\" | |
tell the first terminal | |
launch session \"Default Session\" | |
tell the last session | |
write text \"cd $(pwd)\" | |
end tell | |
end tell | |
end tell" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heroku labs:enable user_env_compile | |
heroku config:add RUBY_VERSION=ruby-1.9.3-p125 | |
heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
browser_regex='Firefox|Chrome|Safari' | |
infected=0 | |
shift | |
echo "=============================" | |
echo "Scanning for Flashback Trojan" | |
echo "=============================" | |
echo | |
shopt -s nullglob |