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
# When macOS crashes and Postgres is running, it won't start if the `postmaster.pid` file is present. | |
# Careful. If you don't know what you're doing you can lose data. | |
# Use only on Postgres instances you don't care about or have done the work to look at the crashed data. | |
# Tail the logs | |
tail -f $(brew --prefix)/var/log/[email protected] | |
# Stop Postgres | |
brew stop postgres |
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
module ActiveExchange | |
class Channel | |
def initialize(name:, server: ActiveExchange.server) | |
@server = server | |
@channel = name | |
@queue = Queue.new | |
@subscribe = false | |
end | |
def broadcast(message) |
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
module ActiveExchange | |
class Channel | |
def initialize(name:, server: ActiveExchange.server) | |
@server = server | |
@channel = name | |
@queue = Queue.new | |
@subscribe = false | |
end | |
def broadcast(message) |
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
class Wrapper | |
include Logging | |
def initialize(driver, socket) | |
@driver = driver | |
@socket = socket | |
@queue = Queue.new | |
@closed = false | |
setup_driver |
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
TableComponent.new @items do |table| | |
# Emmits a `thead > th` with "Name" and a `tbody > td` with the name of each item. | |
table.column("Name") { _1.name } | |
# Emmits a `thead > th` with "Name" and a `tbody > td` with the name of each item. | |
table.column(:name) | |
# Emmits a `thead > th` with "Interview Times" and a `tbody > th` with the name of each item. | |
table.column("Name").th(class: "bg-read-100") { show(_1, :name) } |
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 'fileutils' | |
require "active_support/all" | |
# Check for arguments | |
unless ARGV.length == 2 | |
puts "Usage: #{$PROGRAM_NAME} <original_class_name> <new_class_name>" | |
exit | |
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
require "bundler/inline" | |
gemfile do | |
source "https://rubygems.org" | |
gem "prawn" | |
gem "zeitwerk" | |
gem "matrix" | |
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
require "bundler/inline" | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'phlex' | |
end | |
class Field < Phlex::HTML | |
def template |
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
class Foo | |
# Define the original render method | |
def render | |
puts "Foo#render" | |
end | |
end | |
module Overrides | |
def self.prepended(klass) | |
klass.alias_method :base_render, :render |
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
module ComponentHelper | |
def component(name, *args, **kwargs, &block) | |
render componentize(name).new(*args, **kwargs), &block | |
end | |
private | |
def componentize(name) | |
"#{name.to_s.classify}Component".constantize | |
end | |
end |
NewerOlder