Skip to content

Instantly share code, notes, and snippets.

View pedromschmitt's full-sized avatar
🎲

Pedro Schmitt pedromschmitt

🎲
  • Brazilia, Brazil
View GitHub Profile
#!/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

OpenBSD logo     Rails logo     Falcon logo


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

@searls
searls / .solargraph.yml
Last active September 5, 2024 17:57 — forked from DRBragg/.solargraph.yml
My config with steps to use solargraph for Rails projects in VS Code (WIP)
---
include:
- ".solargraph_definitions.rb"
- "app/**/*.rb"
- "config/**/*.rb"
- "lib/**/*.rb"
exclude:
- test/**/*
- vendor/**/*
- ".bundle/**/*"
resources :media, shallow: true,
constraints: ->(req) do
current_user = req.env["warden"].user(:user)
Flipper.enabled?(:media_uploads, current_user)
end
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
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)
@mrjonesbot
mrjonesbot / toggle_controller.js
Last active July 3, 2022 14:25
Basic toggle controller to show/hide elements
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = [ "toggleable" ]
connect() {
this.toggleClass = this.data.get("class") || "hidden"
}
toggle(event) {
@mrjonesbot
mrjonesbot / navigation_controller.js
Created April 25, 2022 22:03
Light Stimulus controller that manages accordion side navigation behavior
import ApplicationController from './application_controller'
export default class extends ApplicationController {
static targets = ["selectable"]
static values = {
selectedClass: String
}
select(event) {
const previousElement = this.selectableTargets.find(target => target.classList.contains(this.selectedClassValue))
@afomera
afomera / README.md
Last active January 1, 2023 14:48
How to customize Bootstrap with esbuild-rails

How to customize Bootstrap 5 with esbuild-rails

You can see the various files added in this gist to really do the bulk of the work.

The important bits seem to be:

yarn add esbuild-sass-plugin