This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example code of using MQTT.js to interact with AWS IoT via a presigned url. | |
// See https://gist.github.com/scott-stewart/2d7dc6a01d5da4326a7ad8b49d467354 for | |
// an exmaple of creating a presigned AWS IoT URL from a Rails controller. | |
// This script makes assumptions about page elements and variables not in the | |
// gist, but hopefully demonstrates the gist of using a presigned url approach, | |
// which can work to interact with AWS IoT WebSocket MQTT connections. | |
var iotClient = null; | |
function runIotClient() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate Presigned URLS for AWS IoT MQTT WebSockets. There are 2 ways to | |
# connect to AWS IoT; certificates and Sigv4. Certificates are great for real | |
# things, but not so great for JavaScript. This presign Rails controller | |
# example, will allow you to make an authorized ajax call from your apps | |
# JavaScript to this controller's endpoint, and get back a short lived presign | |
# url to use to open the connection to your AWS IoT endpoint. | |
# Note: It is assumed your app already has some sort of session based security | |
# taking place in ApplicationController, which is omitted here for brevity. You | |
# would not want an unauthenticated request to be able to get presigned url's | |
# to your AWS IoT endpoint. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
require 'shoulda/matchers' | |
class BlogTest < ActiveSupport::TestCase | |
fixtures :blogs | |
test "validations" do | |
assert validate_presence_of(:title).matches?(Blog.new) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# <rails_root>/lib/simple_form/label_nested_input.rb | |
module SimpleForm | |
module Components | |
module LabelInput | |
extend ActiveSupport::Concern | |
included do | |
include SimpleForm::Components::Labels | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem install ruby-debug19 -- --with-ruby-include="/Users/scott/.rbenv/versions/1.9.2-p290" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in *.html.erb; do mv "$i" "${i/.erb/}".haml; done |