For MacOS Catalina, visit Install mysql2 on MacOS Catalina
Installing mysql2
gem errors on MacOS Mojave.
Make sure openssl
is installed on Mac via Homebrew.
# frozen_string_literal: true | |
# config/initializers/colorized_logger.rb | |
# This initializer adds color to the Rails logger output. It's a nice way to | |
# visually distinguish log levels. | |
module ColorizedLogger | |
COLOR_CODES = { | |
debug: "\e[36m", # Cyan | |
info: "\e[32m", # Green | |
warn: "\e[33m", # Yellow |
# frozen_string_literal: true | |
class ApplicationService | |
def self.call(...) | |
new(...).call | |
end | |
def initialize(...) | |
end | |
end |
For MacOS Catalina, visit Install mysql2 on MacOS Catalina
Installing mysql2
gem errors on MacOS Mojave.
Make sure openssl
is installed on Mac via Homebrew.
Recently, Let's Encrypt launched free wildcard certificates. While this is good news in and of itself, as it removes one of the last remaining reasons for expensive commercial certificates, I've unfortunately seen a lot of people dangerously misunderstand what wildcard certificates are for.
Therefore, in this brief post I'll explain why you probably shouldn't use a wildcard certificate, as it will put your security at risk.
It's generally pretty poorly understood (and documented!) how TLS ("SSL") works, so let's go through a brief explanation of the parts that are important here.
The general (simplified) idea behind how real-world TLS deployments work, is that you:
module Emoji | |
# Emojis found from link below | |
# https://raw.githubusercontent.com/omnidan/node-emoji/master/lib/emoji.json | |
SYMBOL_LOOKUP = JSON.parse(File.read("#{Rails.root}/emoji.json")) | |
STRING_LOOKUP = SYMBOL_LOOKUP.invert | |
ALL_REGEXP = Regexp.union(STRING_LOOKUP.keys) | |
def find(symbol) | |
SYMBOL_LOOKUP[symbol.to_s] | |
end |
desc "switch rails logger to stdout" | |
task :verbose => [:environment] do | |
Rails.logger = Logger.new(STDOUT) | |
end | |
desc "switch rails logger log level to debug" | |
task :debug => [:environment, :verbose] do | |
Rails.logger.level = Logger::DEBUG | |
end |
# Parses YouTube URLs directly or from iframe code. Handles: | |
# * Address bar on YouTube url (ex: http://www.youtube.com/watch?v=ZFqlHhCNBOI) | |
# * Direct http://youtu.be/ url (ex: http://youtu.be/ZFqlHhCNBOI) | |
# * Full iframe embed code (ex: <iframe src="http://www.youtube.com/embed/ZFqlHhCNBOI">) | |
# * Old <object> tag embed code (ex: <object><param name="movie" value="http://www.youtube.com/v/ZFqlHhCNBOI">...) | |
/(youtu\.be\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v)\/))([^\?&"'>]+)/ | |
$5 #=> the video ID | |
# test it on Rubular: http://rubular.com/r/eaJeSMkJvo |