Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View joshwlewis's full-sized avatar

Josh W Lewis joshwlewis

View GitHub Profile
joshwlewis /
Created December 6, 2022 21:38
Falcon Player GPIO DO_NOT_PRESS Button Scripts
# runs when the physical DO NOT PRESS button is depressed.
# This is designed to provide feedback as to whether or not the button release
# will activate a sequence. If the $PREFIX is not already playing, this runs
# an ok sound + effect. If $PREFIX is already playing (somebody is spamming
# the button), this runs an err sound + effect. Either way, the sound + effect
# will play in the background without interrupting anything already playing.
# For this reason, use short sounds and sequences with this script (under 1
# second).

Keybase proof

I hereby claim:

  • I am joshwlewis on github.
  • I am joshwlewis ( on keybase.
  • I have a public key ASAIpXAvWMfvfbCFhOn4NjLXG4OuKRPcXPHb79teCBqhLQo

To claim this, I am signing this object:

joshwlewis / hipcat_emoticons.json
Last active July 6, 2016 19:48
Hipchat emoticon data
joshwlewis / application.rb
Last active August 29, 2015 13:56
Rack::Cors doesn't insert headers when Rails app errors out. Fix it by inserting Rack::Cors at the top of your middleware stack.
config.middleware.insert 0, Rack::Cors do
allow do
resource '*',
headers: :any,
methods: [:get, :put, :post, :delete]
joshwlewis / app.rb
Created March 3, 2014 20:22
Get request json for Sinatra
class App < Sinatra::Base
helpers do
def request_json
put '/foobar' do
@data = request_json
joshwlewis / user.rb
Created November 21, 2013 16:31
When using paper_trail and devise, new user versions are saved on each request. The following prevents saving new user versions when devise trackable columns (sign_in_count, current_sign_in_at, last_sign_in_at, current_sign_in_ip, last_sign_in_ip) are updated.
class User < ActiveRecord::Base
devise :trackable
def update_tracked_fields!(request)
without_versioning { super(request) }
joshwlewis / wercker.yml
Created November 14, 2013 21:39
Wercker configuration for Ruby 2.0, Rails 4.0, Rspec, Postgres stack with deployment to Heroku and Hipchat notifications.
box: wercker/ubuntu12.04-ruby2.0.0
- wercker/postgresql
- bundle-install
- rails-database-yml
- script:
name: db:setup
code: bundle exec rake db:setup
joshwlewis / scss_format_validator.rb
Created November 19, 2012 20:09
Rails validation for scss (or sass)
# app/validators/scss_format_validator.rb
class ScssFormatValidator < ActiveModel::EachValidator
def validate_each(object, attribute, value)
# Attempt to parse SCSS, syntax: :scss).render
rescue Exception => e
# Add error if parsing fails
object.errors.add(attribute, :invalid_scss, error: e.inspect)