- install homebrew - https://brew.sh
brew install openjdk
sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
(check `brew info openjdk` if that's still the correct command)
- Check java runs
require "net/http" | |
A_CHUNK_TOO_FAR = Class.new(StandardError) | |
# @param url [URI] uri to fetch title of | |
def url_title(url) | |
title = nil | |
Net::HTTP.start(url.host, url.port, use_ssl: (url.scheme == "https"), open_timeout: 5, read_timeout: 5) do |http| | |
request = Net::HTTP::Get.new(url) |
brew install openjdk
sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
(check `brew info openjdk` if that's still the correct command)
require "net/http" | |
require "json" | |
require "rspec/autorun" | |
module Thing | |
def self.thing(response) | |
case response | |
when Net::HTTPSuccess | |
:ok | |
when Net::HTTPNotFound |
// Callback hell approach | |
function main() { | |
console.log("hello from main") | |
var name = "caius" | |
sendHello(decorateName(name)) // <- smelly | |
} | |
function decorateName(name) { |
# five digit number | |
# two of the digits are the same | |
# four of the digits are odd | |
# number is higher than 40010 | |
# number is higher than 45000 | |
# digit sum is 16 | |
# five digit, upper/lower bounds | |
candidates = (40011..44999).select { |i| | |
# two digits are the same |
@data = {} | |
def default_src(*args) | |
if args.first | |
@data[:default_src] = args.map(&:to_s) | |
else | |
@data.delete(:default_src) | |
end | |
end |
*@*.aaa | |
*@*.aarp | |
*@*.abarth | |
*@*.abb | |
*@*.abbott | |
*@*.abbvie | |
*@*.abc | |
*@*.able | |
*@*.abogado | |
*@*.abudhabi |
p = Enumerator.new { |y| o = (31..36).to_a-[34]; loop { y << o.first; o.shuffle! } } | |
c = ->(l) { "\e[1;5;#{p.next}m#{l}\e[0m" } | |
r = ->(s) { s.gsub(/\S/) { |l| c[l] } } | |
puts nil, "\t\e[34m<#{19479728.to_s(36)}>\e[0m#{r["#{[16712,8265].pack("s*")}#{ENV["USER"].upcase}"]}\e[34m</#{19479728.to_s(36)}>\e[0m", nil |
# What I expect it to be corrected to: | |
# | |
# something = begin | |
# raise "thing" | |
# rescue => e | |
# p e | |
# end | |
# What it's actually corrected to (standard gem v0.4.7) | |
something = begin |
module GivenWhenThen | |
module ClassMethods | |
def def_Given(name, *args, &block) | |
_gwt_define(:Given, name, *args, &block) | |
end | |
def def_When(name, *args, &block) | |
_gwt_define(:When, name, *args, &block) | |
end |