Skip to content

Instantly share code, notes, and snippets.

@barriault
barriault / cells.rb
Last active October 20, 2021 23:33
I couldn't get the kaminari-cells gem to work with Rails 6, so I copied these two files from the gem into my project and made some slight changes.
# app/models/concerns/kaminary/cells.rb
module Kaminari
module Cells
extend ActiveSupport::Concern
included do
include Kaminari::Helpers::CellsHelper
end
end
end
@barriault
barriault / DualFlowMeter.ino
Last active October 28, 2015 18:21
Dual Flow Meter (see hardware video at: https://youtu.be/110fMAtmgmk)
// Copyright (c) 2014 Jeff Barriault
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
@barriault
barriault / jquery-dynamic-submitable.coffee
Last active August 29, 2015 14:16
An easy way to add a link to a form that changes the submit action from the default format to .pdf, .csv, etc. and then submits the form.
# Function allows you to change the action of a form when clicking a link. This comes
# in handy when you want to change the format of a form from its default to .csv, .pdf
# or something other than the default. This is also set up to work outside of the
# <form></form> tag.
#
# Typical use:
#
# <%= link_to '#', data: { behavior: "dynamicsubmitable", target: "#form_id", link: resource_path(format: :pdf) } %>
#
$ = jQuery
@barriault
barriault / .powenv
Created October 29, 2013 21:57
I scraped this code from http://ryandeussing.com/blog/2013/05/27/make-pow-and-rvm-play-nice-dot-rvmrc-powenv/. I've placed it here so I can find it again . . .
if [ -f "$rvm_path/scripts/rvm" ]; then
source "$rvm_path/scripts/rvm"
if [ -f ".rvmrc" ]; then
source ".rvmrc"
fi
if [ -f ".ruby-version" ]; then
rvm use `cat .ruby-version`
fi