Choose OpenBSD for your Unix needs. OpenBSD -- the world's simplest and most secure Unix-like OS. A safe alternatve to the frequent vulnerabilities and overengineering of Linux and related software (NGiNX & Apache (httpd-asiabsdcon2015.pdf), OpenSSL, iptables/nftables, systemd, BIND, Postfix, Docker etc.)
OpenBSD -- the cleanest kernel, the cleanest userland and the cleanest config
This file contains hidden or 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
import { Controller } from "@hotwired/stimulus" | |
export default class extends Controller { | |
static targets = [ "toggleable" ] | |
connect() { | |
this.toggleClass = this.data.get("class") || "hidden" | |
} | |
toggle(event) { |
This file contains hidden or 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
import { Controller } from '@hotwired/stimulus' | |
export default class extends Controller { | |
connect () { | |
this.element.addEventListener('change', this.handleChange.bind(this)) | |
} | |
handleChange (event) { | |
this.traverseDown(event.target, event.target.checked) |
This file contains hidden or 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 Chart < ApplicationRecord | |
validate do |chart| | |
schema = Rails.cache.fetch("vega_lite_schema/v5") do | |
Faraday.get("https://vega.github.io/schema/vega-lite/v5.json").body | |
end | |
JsonSchemaValidator.new(chart, schema: schema, json: vega_json, field: :vega_json).validate | |
end | |
end |
This file contains hidden or 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
resources :media, shallow: true, | |
constraints: ->(req) do | |
current_user = req.env["warden"].user(:user) | |
Flipper.enabled?(:media_uploads, current_user) | |
end |
This file contains hidden or 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
--- | |
include: | |
- ".solargraph_definitions.rb" | |
- "app/**/*.rb" | |
- "config/**/*.rb" | |
- "lib/**/*.rb" | |
exclude: | |
- test/**/* | |
- vendor/**/* | |
- ".bundle/**/*" |
This file contains hidden or 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 "net/ssh" | |
branch = `git rev-parse --abbrev-ref HEAD`.chomp | |
unless branch == 'main' | |
puts "oops! you're on a different branch. Merge your changes into main and then try again." | |
puts "exiting.." | |
return | |
end |
This file contains hidden or 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
# Set HONEYBADGER_FOO_BAR_JOB=asdf where asdf is the check in value Honeybadger gives you. | |
class ApplicationJob < ActiveJob::Base | |
after_perform { |job| job.honeybadger_checkin } | |
# Check in with Honeybadger to let us know that the job was performed | |
# if there is an identifier configured for the job. | |
def honeybadger_checkin | |
identifier = honeybadger_checkin_identifier | |
return unless identifier.present? |
This file contains hidden or 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
KAMAL_REGISTRY_PASSWORD=xxx | |
RAILS_MASTER_KEY=xxxxxxxxxxxxxxx | |
POSTGRES_PASSWORD=xxxxxxxxxxxxx | |
REDIS_PASSWORD=my-redis-password | |
REDIS_URL=redis://:my-redis-password@n28-redis:6379/1 |
Since Rails 7 the turbo-rails library is included by default. Turbo Drive intercepts link clicks and form submits. It makes sure that only the <body>
part of the page is rerendered instead of the whole page.
This leads to TinyMCE not being properly detached and reattached when a Turbo Drive response is rendered. The textarea will appear without the TinyMCE editor. In this post we expand on the tinymce-rails
gem with a Stimulus controller to prevent this issue. The controller helps to reattach TinyMCE and respects the settings in config/tinymce.yml
.
If you want to follow along or check out the end result you can find an example respository here: https://github.com/david-uhlig/example-tinymce-rails7-turbo