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
module TransactionScreamer | |
def begin_db_transaction | |
Rails.logger.debug "DB TRANSACTION STARTS" | |
Rails.logger.debug caller.join("\n") | |
super | |
end | |
def commit_db_transaction | |
Rails.logger.debug "DB TRANSACTION ENDS" | |
Rails.logger.debug caller.join("\n") |
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
preresults = File.readlines("doiton.txt").reject{ |line| line =~ /\d{2}\/\d{2}\/\d{4} \d{2}:\d{2} [PA]M <DIR>|bytes|notes|^$|^01\/\d{2}\/2012|^02\/2[1234567]\/2012|^02\/[01][0123456789]\/2012| Directory of/} | |
midresults = preresults.map{|line| {:time => DateTime.strptime(line,'%m/%d/%Y %I:%M %p'), :string => line}} | |
sortedresults = midresults.sort_by{|hash| hash[:time]} | |
finalresults = sortedresults.map{|hash| hash[:string]} | |
File.write("rubout2.txt",finalresults.join) |
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
module LikeRuby | |
VALLEYGIRL = %w[omg so like totally right toootally stuff] | |
FRATGUY = %w[friggin fuckin dude man bro broheim broseph] | |
INTERNETS = %w[lol rofl teh ohai plz] | |
SNOOP = %w[yo homey homeboy sup dog shit girl ma biatch ho shiiit] | |
LOCAL = %w[wicked hella anyways] | |
MISC = %w[just hey yeah ok um uh ah actually something] | |
ALLSLANG = VALLEYGIRL + FRATGUY + INTERNETS + SNOOP + LOCAL + MISC | |
def method_missing(name, *args) |
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
module MethodCop | |
# Guard methods that have side effects with a callback that fires before the method is invoked. | |
# If the callback returns a "falsey" value, the method is halted and will not be called. | |
# The callback will return nil instead. | |
# if the method does not have side effects or you depend on its return value, you should NOT | |
# use this on that method! This will break the _hell_ out of design by contract. | |
# currently does not work with methods that accept blocks so be aware of that. Fixes, improvements, | |
# pull requests, and general "why on earth did you do this" notes are encouraged. | |
#TODO: DRY this up |

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 Object | |
unless method_defined?(:clip) || !self.respond_to?(:to_s) | |
def clip # won't work in windows, but I doubt it'll ever be an issue... | |
if RUBY_PLATFORM.downcase.include?("darwin") | |
IO.popen('pbcopy', 'w+') do |clipboard| | |
clipboard.write(self.to_s) | |
end | |
elsif RUBY_PLATFORM.downcase.include?("linux") #requires xsel to be installed | |
IO.popen('xsel --clipboard --input', 'r+') do |clipboard| | |
clipboard.puts self.to_s |