See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
// Display a developer-friendly error message when Turbo Frame fails to load. | |
if (process.env.NODE_ENV === 'development') { | |
document.addEventListener('turbo:frame-missing', async function (event) { | |
event.preventDefault(); | |
const frame = event.target; | |
const response = event.detail.response; | |
const frameId = frame.id; | |
const url = response?.url || frame.src; |
vim.diagnostic.config({ | |
virtual_text = false | |
}) | |
-- Show line diagnostics automatically in hover window | |
vim.o.updatetime = 250 | |
vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]] |
require "active_support/concern" | |
module M | |
extend ActiveSupport::Concern | |
included do | |
has_many :things | |
scope :disabled, -> { where(disabled: true) } | |
after_commit :send_email | |
validates :email, length: { maximum: 255 }, email: true |
module Formatter | |
def self.included base | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
def class_method | |
"yahy" | |
end | |
end |
class Formatter | |
def formatted_phone(phone) | |
phone.delete("^0-9") | |
end | |
end | |
class Payment < Formatter | |
def phone(phone) | |
formatted_phone(phone) | |
end |
class Payment | |
def formatted_phone(phone) | |
phone.delete("^0-9") | |
end | |
end | |
class Contact | |
def formatted_phone(phone) | |
phone.gsub(/[^0-9]/, '') | |
end |
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
ROM buildpack-deps:stretch | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends \ | |
bzip2 \ | |
ca-certificates \ | |
libffi-dev \ | |
libgdbm3 \ | |
libssl-dev \ | |
libyaml-dev \ |