Skip to content

Instantly share code, notes, and snippets.

require 'csv'
require 'json'
hash = { x: 'y', 'z': 611 }
CSV.open('tmp/csv_with_json.csv', 'wb') do |csv|
csv << ['a', hash.to_json, 'b']
csv << ['a', hash.to_json, 'b']
end
#!/usr/bin/env ruby
require 'fileutils'
begin
require 'taglib'
rescue LoadError
puts "Cannot load taglib: https://robinst.github.io/taglib-ruby/"
end
#!/usr/bin/env ruby
require 'fileutils'
begin
require 'taglib'
rescue LoadError
puts "Cannot load taglib: https://robinst.github.io/taglib-ruby/"
end
require 'fileutils'
ARGV.each_with_index do |number, index|
name="canticos/sjjm_T_#{number}_r480P.mp4"
FileUtils.copy(name, "cantico_#{index + 1}_#{number}.mp4")
end
number = rand(100)
guess = nil
puts "Adivinhe o número entre zero e 100:"
while true
print "Que número você escolheu? "
guess = Integer(gets.strip)
if guess == number
---------------------|
| Território: T1 |
| Quadra: 4 |
| |
| Rua Pedro Adams |
| |
| 13, 26, 55 |
| |
| Rua Xyz |
| |

Hi Alex

I had an appointment canceled this afternoon, so I took the opportunity to engage a bit more the code in the challenge.

As you mentioned I should not invest too much time...

Two hours+ in, while I tried to reason about the right amount of pragmatism and "state-of-the-artness" (should it just work? should it show I care?) I realized that writing something that will leave my mind at peace will eat me a whole day if not more. If you like I can do that, probably on Sunday as I mentioned. But as suppose you are not interested in every detail or perfect solution, but mostly on how I would go about tacking the most important pain points of the challenge. So, I will describe how I would finish the challenge, and then you can decide if it is enough for a follow up conversation or if I should actually get the thing done.

There is a pseudo code as a draft in this PR:

" basic vim setup for times we need to use vim remotely without any plugins
nnoremap <space>w :w<cr>
inoremap jj <esc>
nnoremap <space>x :! clear; ./%<cr>
nnoremap <leader>st <esc>:! clear && ./shell_test.sh<cr>
# autocmd FileType sh nnoremap <buffer> <leader>x <esc>:! clear && ./%<cr>
if exists("+undodir")
require 'csv'
class Entry
attr_reader :row
def initialize(row)
@row = row
end
def name
row['Nome'] || email
if condition
return :something
end