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
# Use this validator like this | |
# | |
# class User < ApplicationRecord | |
# validates :profile_link, url: true | |
# end | |
class UrlValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
unless valid_url?(value) | |
record.errors.add(attribute, :invalid_url) |
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
document.addEventListener("turbo:visit", () => { | |
let main = document.querySelector("main"); | |
if (main.dataset.turboTransition == "false") return; | |
let [movement, scale] = ["-12px", "0.99"]; | |
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) { | |
[movement, scale] = ["-6px", "1"] | |
}; |
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' | |
import autoAnimate from '@formkit/auto-animate' | |
export default class extends Controller { | |
connect () { | |
autoAnimate(this.element) | |
} | |
} |
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" | |
import SignaturePad from 'signature_pad' | |
export default class extends Controller { | |
static targets = ["canvas", "input"] | |
connect() { | |
this.signaturePad = new SignaturePad(this.canvasTarget) | |
this.signaturePad.addEventListener("endStroke", this.endStroke) | |
this.resizeCanvas() | |
if (this.inputTarget.value) { |
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
module DeepGroup | |
class Grouping | |
IDENTITY = -> v { v } | |
def initialize(state) | |
@state = state | |
@groupings = [] | |
@mapping = IDENTITY | |
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
module ApplicationCable | |
class Channel < ActionCable::Channel::Base | |
include CableReady::Broadcaster | |
delegate :render, to: :ApplicationController | |
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
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 gist aims to provide a simple solution for managing Heroku Review Apps with GitHub Actions due to the security incident that continues to disrupt Heroku's GitHub integration.
.github
├── workflows
│ ├── heroku_review_app_create.yml
│ └── heroku_review_app_destroy.yml
Untitled CSS Library is a CSS library that, so far as I can tell, does not exist.
It offers the following features:
- It renders well out of the box with Vanilla HTML, like a classless CSS library such as pico
- It takes advantage of semantic, lesser used tags such as
nav
,main
andsection
to allow for more elaborate layouts in pure HTML - It offers "High Power" classes that capture high level components in, as much as is possible, a single CSS class