"Foo" // string
'F' // Char
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
"WTF IS \033[30;47m???", a practical cheat-sheet | |
Font color definitions can be intimidating and nonsense at first, | |
but it is quite easy, lets just follow character by character: | |
┌────────┤\033├── Escape character (ESC) | |
│┌───────┤ [ ├── Define a sequence (many characters in a code) | |
││ | |
││┌──────┤ X ├── Parameter (optional) ┐ | |
│││┌─────┤ ; ├── Parameter separator │ SGR Code |
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
# frozen_string_literal: true | |
module Arel | |
module Visitors | |
class SQLServer < Arel::Visitors::ToSql | |
def table_From_Statement o | |
core = o.cores.first | |
table_From_Node(core.from) || table_From_Node(core.source) |
Antigamente eu achava que livros de TI não valiam a pena pois ficavam obsoletos rapidamente. Com o tempo e a experiência percebi que não bem assim, e diversos livros que se focam mais em conceitos do que em linguagens tendem a durar por muito tempo.
Com base nisso, reuni os melhores livros que li e as indicações de algins amigos e começei esta lista de leituras para reunir essas ideias que continuam atuais mesmo nos dias de hoje.
Para não ficar apenas uma lista sem contexto, cada item possui uma breve explicação sobre o porque dele estar nesta lista. E claro, toda nova indicação é bem vinda! :D
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
# frozen_string_literal: true | |
class SerializableReport < JSONAPI::Serializable::Resource | |
using Refinements::SerializableHash | |
id { @object['id'] } | |
attributes :foo, :bar | |
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
def beach(*temperature) | |
case temperature | |
in :celcius | :c, (20..45) | |
:favorable | |
in :kelvin | :k, (293..318) | |
:scientifically_favorable | |
in :fahrenheit | :f, (68..113) | |
:favorable_in_us | |
else | |
:avoid_beach |
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 | |
# Write a function that returns true if the brackets in a given string are balanced. | |
# Balanced means that every parenthesis/bracket or brace that is opened must be closed | |
# And it must be closed in the right order (Always close the last symbol you opened) | |
# The function must handle parens (), square brackets [], and curly braces {}. | |
# "(a[0]+b[2c[6]]) {24 + 53}" should return true | |
# "f(e(d))" should return true | |
# "[()]{}([])" should return true |
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 'matrix' | |
# puts "▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐░▒▓▔▕▖▗▘▙▚▛▜▝▞▟" | |
EMPTY = ' ' | |
BLOCK = '░' | |
BOX = '█' |
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 node | |
function validate_cpf(strCPF) { | |
if (new Set(strCPF).size == 1) return false | |
cpf = Array.from(strCPF).map(Number); | |
return [9, 10].every(pos => { | |
multiplier = pos + 1 |
NewerOlder