Skip to content

Instantly share code, notes, and snippets.

View n-at-han-k's full-sized avatar
🚀

Nathan Kidd n-at-han-k

🚀
View GitHub Profile
@dalezak
dalezak / _quill.html.erb
Last active May 25, 2025 16:15
Using Tables In Quill.js With Rails and Stimulus
<%= form.hidden_field field, data: { quill: { target: "input" } } %>
<div style="min-height:500px;" data-quill-target="editor" data-action="click->quill#focus"></div>
@khash
khash / component.html.erb
Last active August 5, 2024 21:09
Dropdown Component with ViewComponents, TailwindCSS and Stimulus
<!-- app/components/dropdown/component.html.erb -->
<div class="relative inline-block text-left" data-controller="dropdown--component">
<div>
<button type="button"
class="inline-flex justify-center w-full rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-indigo-500"
data-action="click->dropdown--component#toggleMenu"
aria-haspopup="true"
aria-expanded="true">
<%= @title %>
<!-- Heroicon name: solid/chevron-down -->
@wiegertschouten
wiegertschouten / grid.scss
Created October 1, 2020 18:38
A very simple grid system built with SASS and CSS grid
$columns: 12;
$gap: 30px;
$breakpoints: (
xs: 480px,
sm: 768px,
md: 960px,
lg: 1170px,
xl: 1280px
);
@ukn
ukn / 99-install-facetime-camera.sh
Last active December 27, 2025 09:09 — forked from Stono/99-install-facetime-camera.sh
Install the kernal module required for the facetimehd camera to work on Linux
#!/bin/bash
set -e
export CONFIG_MODULE_SIG=n
export CONFIG_MODULE_SIG_ALL=n
# For current kernel
export KERNELRELEASE=$(cat /proc/version | awk '{print $3}')
temp_dir=$(mktemp -d)
echo "Installing FacetimeHD camera for $KERNELRELEASE"
@annikoff
annikoff / custom_generators.md
Last active September 15, 2025 05:31
Custom generators

The main generator

# lib/generators/rails/policy/policy_generator.rb

module Rails
  module Generators
    class PolicyGenerator < NamedBase
      source_root File.expand_path('templates', __dir__)

      def copy_policy_file
@GAM3RG33K
GAM3RG33K / ReadMe.md
Created February 14, 2020 07:07
A Guide to setup and use Plantuml
@ProGM
ProGM / arel_cheatsheet_on_steroids.md
Last active December 17, 2025 22:03
Arel cheatsheet on Steroids

Arel Cheatsheet on Steroids

A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.

Tables

posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord

Table alias

@leastbad
leastbad / action_mailbox.md
Last active April 8, 2025 20:26
Action Mailbox: The Missing Manual

This is all you really need to know in order to make Action Mailbox work in development.

  1. Fire up ngrok http 3000 and make note of your subdomain for steps 3 and 8.
  2. Create a Mailgun account because they offer sandbox addresses; grab your domain from the Dashboard.
  3. Go into Receiving and create a catch-all route pointing to: https://XXX.ngrok.io/rails/action_mailbox/mailgun/inbound_emails/mime
  4. Add your Mailgun API key to your credentials:
action_mailbox:
 mailgun_api_key: API KEY HERE
@arnaudfl
arnaudfl / BrowserHistory.js
Created May 16, 2019 13:11
Intercept and disable browser's back button action
// How to use it: import this function from another file and run it
// import DisableBack from 'BrowserHistory';
// DisableBack();
// intercept browser's back button action and disable it
function DisableBack() {
window.history.pushState(null, null, window.location.href);
window.onpopstate = function onPopState() {
window.history.go(1);
};