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
require 'rspec/expectations' | |
class Pain | |
def tear_inducing? | |
true | |
end | |
end | |
class Fear | |
def tear_inducing? |
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
function which-aws { | |
echo "You are on an AWS account with alias(es)" `aws iam list-account-aliases | jq '.AccountAliases | join(",")' -r` | cowsay | |
} | |
function cfn-describe { | |
aws cloudformation describe-stacks --stack-name "$1" | |
} |
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
egrep -e "require\s\"([a-z]|_|/)+\"" -o -r lib | ./sniffrequires.rb | dot -Tsvg > /tmp/foo.svg; open /tmp/foo.svg |
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 | |
require 'json' | |
require 'pry' | |
require 'date' | |
# basically if the number results in a ts that is less than 10 years ago it's probably a timestamp :D | |
YEARS_TO_BE_CONSIDERED_TIMESTAMP = 10 | |
def fix_potential_timestamp potential_timestamp | |
# binding.pry |
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
(33..255).map {|x| windoze = x.chr(Encoding::CP1250); [x, windoze , begin windoze.encode(Encoding::UTF_8) rescue 'ass' end]}.select{|x| x[1] != x[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
require 'rest_client' | |
require 'json' | |
class HomeController < ApplicationController | |
def initialize | |
@queries = {:lines => | |
"SELECT * | |
WHERE |
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
CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass'; | |
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' | |
-> WITH GRANT OPTION; |
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
(set! *print-length* 200) |
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
require 'benchmark' | |
lengths = [10, 100 , 1000, 10000, 100000, 1000000] | |
Benchmark.bm do |x| | |
lengths.each do |length| | |
x.report("Length = #{length}\t\t\t") {(0...length.to_i).map{ ('a'..'z').to_a[rand(26)] }} | |
x.report("Same without rand = #{length}\t\t\t") {(0...length.to_i).map{ ('a'..'z').to_a[1] }} | |
x.report("Fixed characters Length = #{length}\t\t\t") {"x" * length} | |
end | |
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
(doseq [i [1 2 3 4]] (print i)) |
OlderNewer