Skip to content

Instantly share code, notes, and snippets.


Frank Kany kany

  • Rickman, TN
View GitHub Profile
kany /
Last active Nov 24, 2021
Rails 6 + ActionCable + Stimulus example for pushing updates to the view.

Rails 6 + ActionCable + Stimulus example for pushing updates to the view.

This example will show how to push updates to the view for a Model instance that has changed without the user having to refresh the page.

This example focuses more on getting ActionCable working with Stimulus. If you don't already have stimulus setup in your app, here's a great write up on how to set it up:

Example scenario

  • You have a Scan model with attributes.
  • You have a ScanController#show action.
  • A user is viewing a Scan through the show.html.slim|haml|erb view template.
kany /
Last active Nov 23, 2021
Setup SENDMAIL on Mac OSX Yosemite
kany / gist:3714996
Created Sep 13, 2012
Git Repo changes ssh fingerprint - how to update your known_hosts file
View gist:3714996
1) Open known_hosts file and look for the invalid host
nano ~/.ssh/known_hosts
2) Remove the line that has the invalid host. Should be the same host in your .git/config of your repo
ssh-keygen -R []:1234
3) Pull from repo
git pull
4) You should see something similar to this. Answer 'yes' when asked.
kany /
Last active Nov 18, 2021
Delete old git branches

Delete old git branches

This will delete all branches except for main and feature/foo-bar.

git branch -D `git branch | grep -vE 'main|feature/foo-bar'`

This will delete all branches except for master and branches that begin with kany/SAVE, and kany/hack.

kany / pagination_controller.js
Created Jun 4, 2021 — forked from dhh/pagination_controller.js
HEY's Stimulus Pagination Controller
View pagination_controller.js
ERB template chunk from The Feed's display of emails:
<section class="postings postings--feed-style" id="postings"
data-controller="pagination" data-pagination-root-margin-value="40px">
<%= render partial: "postings/snippet", collection: @page.records, as: :posting, cached: true %>
<%= link_to(spinner_tag, url_for(page: @page.next_param),
class: "pagination-link", data: { pagination_target: "nextPageLink", preload: @page.first? }) unless @page.last? %>
kany /
Created Apr 22, 2021
Testing Stripe Webhooks + Rails 6 on your local machine

Testing Stripe Webhooks + Rails 6 on your local machine

The document describes how to test Stripe Webhooks with Ruby On Rails on your local machine. Information in this document is current as of 4/22/2021.

  • Rails
  • Ruby 2.7.3p183
  • Stripe 1.5.14
kany /
Last active Apr 8, 2021
Rails 6 - Sending mail from the console (As of April 2021)

1) Create a new gmail account for testing

2) Enable Less secure app access -

3) Update config/environments/development.rb

  config.action_mailer.default_url_options = {host: "localhost", port: 3000}
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.raise_delivery_errors = true
kany /
Created Mar 29, 2021
Handy OSX Terminal Commands
kany / Show Trailing Whitespace
Created May 1, 2012
Textmate2 - Show Trailing Whitespace
View Show Trailing Whitespace
The following explains how to install the Whitespace Bundle for TextMate2.
1) mkdir -p ~/Library/Application\ Support/Avian/Bundles
2) cd ~/Library/Application\ Support/Avian/Bundles
3) git clone
4) Open TextMate > Preferences
5) Create a Variable named 'Invalid' with a value of 'Red'(or whatever color you choose)
6) Restart TextMate
View Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver).md

Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver)

This guide will walk you through the steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest.


This guide assumes that you are using the following setup:

You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot).