Skip to content

Instantly share code, notes, and snippets.

View ryenski's full-sized avatar
🎯
Focusing

Ryan Heneise ryenski

🎯
Focusing
  • Austin, TX
View GitHub Profile
@ryenski
ryenski / parallax.js
Last active August 5, 2017 20:43
Pure-css version of the parallax effect from Bourbon Refills (http://refills.bourbon.io/components/)
document.addEventListener('turbolinks:load', function(){
var el = document.getElementById('js-parallax-window')
if (el) {
parallax(el);
}
window.addEventListener('scroll', function(e){
if (el) {
parallax(el);
}
module Sequential
extend ActiveSupport::Concern
module ClassMethods
def next_custom_id_for_tenant(tenant_id)
raise "Tenant is required" unless tenant_id.present?
# FIXME: Should probably store this value in some external resource, as this could cause race conditions and/or performance issues due to transaction locking.
# Possibly use PG Triggers?
@ryenski
ryenski / _row.html.erb
Created January 26, 2018 21:55
Clickable table rows with Stimulus.js
<tr data-action="click->table#click" data-controller="table">
<td> 2018-01-11 </td>
<td>
<a data-target="table.url" href="/invoices/1">$7,000.00</a>
</td>
</tr>
@ryenski
ryenski / index.html.slim
Last active January 13, 2022 04:08
Tabbed interface with Stimulus.js
div data-controller='tabs' data-tabs-index='1'
.tabs.is-boxed.is-marginless
ul
li data-target='tabs.tab'
a data={action: "tabs#change"} Tab 1
li data-target='tabs.tab'
a data={action: "tabs#change"} Tab 2
.tab.box data={target: 'tabs.tabPanel'} Tab panel 1
.tab.box data={target: 'tabs.tabPanel'} Tab panel 2
<%= f.collection_select(:shipping_method, @ship_method_options, :id, :name) %>
<%= f.input :shipping_method_other %>
<script src="http://<BEACON_HOST>/v1/config?configuration_id=<CONFIG_ID"></script>
<script src="http://<BEACON_HOST>/v1/config?configuration_id=<CONFIG_ID"></script>
# Run every day at midnight
# cd into the Rails app directory
# run the rake task `logs:prune`
0 0 * * * cd /Users/you/projects/myrailsapp && /usr/local/bin/rake RAILS_ENV=production logs:prune
@ryenski
ryenski / hello.vue
Last active April 7, 2025 21:28
Stimulus.js + Vue.js
<template>
<div id="app">
<p>{{ message }}</p>
</div>
</template>
<script>
export default {
data: function () {
return {
@ryenski
ryenski / identities.rb
Created July 27, 2018 14:41
Oauth Identities
# == Schema Information
#
# Table name: identities
#
# id :integer not null, primary key
# user_id :integer
# provider :string
# uid :string
# created_at :datetime not null
# updated_at :datetime not null