This file contains 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
# Failed | |
Delayed::Job.where('failed_at IS NOT NULL') | |
# Active | |
Delayed::Job.where('failed_at IS NULL AND locked_by IS NOT NULL') | |
# Queued | |
Delayed::Job.where('failed_at IS NULL AND locked_by IS NULL') | |
# Destroy |
This file contains 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
Have you seen Matthew Inman's (The Oatmeal) comic about why he runs? It's | |
a classic. In it he talks about his inspiration for taking up long-distance | |
running. He imagines his tendency to slack off and sit on the couch as a little | |
creature he calls "The Blerch". It follows him around, tempting him to stop | |
moving and scarf down junk food. | |
I run too, though nothing close to the distances Inman runs. In my experience, | |
refactoring as a skill has a lot in common with running or any other athletic | |
sport. You can exercise your refactoring muscles, by deliberately working | |
through the steps with discipline, like we talked about in the last email. As |
This file contains 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 ruby | |
FILENAME = ARGV[0] | |
File.open(FILENAME, 'r') do |f| | |
f.each_line do |line| | |
forbidden_words = ['Table of contents', 'define', 'pragma'] | |
next if !line.start_with?("#") || forbidden_words.any? { |w| line =~ /#{w}/ } | |
title = line.gsub("#", "").strip |
This file contains 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
\ifCLASSINFOpdf | |
\usepackage[pdftex]{graphicx} | |
% declare the path(s) where your graphic files are | |
\graphicspath{{../pdf/}{../jpeg/}{./image/}} | |
% and their extensions so you won't have to specify these with | |
% every instance of \includegraphics | |
\DeclareGraphicsExtensions{.pdf,.jpeg,.png,.jpg} | |
\else | |
% or other class option (dvipsone, dvipdf, if not using dvips). graphicx | |
% will default to the driver specified in the system graphics.cfg if no |
This file contains 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
# Some required stuff | |
sudo apt-get install -y git build-essential curl | |
# Install RVM and Ruby 2.1.2 | |
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 | |
curl -sSL https://get.rvm.io | bash -s stable | |
source ~/.rvm/scripts/rvm | |
rvm install 2.1.2 | |
rvm use --default 2.1.2 |
This file contains 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
# Generates IEEE locally-assigned MAC addresses | |
# @return [String] following the pattern [0-9A-Fa-f][26AEae][0-9A-Fa-f]{10} | |
def mac | |
mac = ('%0.2X' % rand(256))[0, 1] + %w(2 6 A E).sample | |
mac << (1..5).map { "%0.2X" % rand(256) }.join | |
end |
This file contains 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
description "start passenger stand-alone" | |
# When to start the service | |
start on filesystem or runlevel [2345] | |
# When to stop the service | |
stop on runlevel [!2345] | |
# Automatically restart process if crashed | |
respawn |
This file contains 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
User._destroy_callbacks.select { |cb| cb.kind.eql?(:before) }.collect(&:filter).each { |c| puts "#{c}\n" } |
This file contains 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 ruby | |
# Usage: $ https <host> [path] | |
require 'net/https' | |
h = Net::HTTP.new(ARGV[0], 443) | |
h.use_ssl = true | |
h.ssl_version = :SSLv3 | |
h.verify_mode = OpenSSL::SSL::VERIFY_PEER |
NewerOlder