bin/rails g migration AuthlogicToDevise- (see the file below for the actual migration,
authlogic_to_devise.rb) bin/rake db:migrate
gem "devise", "~> 2.2.0"bundle install
| /* The Grid ---------------------- */ | |
| .lt-ie9 .row { width: 940px; max-width: 100%; min-width: 768px; margin: 0 auto; } | |
| .lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; } | |
| .lt-ie9 .row.large-collapse .column, | |
| .lt-ie9 .row.large-collapse .columns { padding: 0; } | |
| .lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; } | |
| .lt-ie9 .row .row.large-collapse { margin: 0; } | |
| .lt-ie9 .column, .lt-ie9 .columns { float: left; min-height: 1px; padding: 0 15px; position: relative; } | |
| .lt-ie9 .column.large-centered, .columns.large-centered { float: none; margin: 0 auto; } |
| # This module for using AES encryption with ruby from | |
| # http://www.brentsowers.com/2007/12/aes-encryption-and-decryption-in-ruby.html | |
| require 'openssl' | |
| require "base64" | |
| module AESCrypt | |
| # Decrypts a block of data (encrypted_data) given an encryption key | |
| # and an initialization vector (iv). Keys, iv's, and the data | |
| # returned are all binary strings. Cipher_type should be | |
| # "AES-256-CBC", "AES-256-ECB", or any of the cipher types |
| require 'nokogiri' | |
| require 'open-uri' | |
| # Get a Nokogiri::HTML:Document for the page we're interested in... | |
| doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove')) | |
| # Do funky things with it using Nokogiri::XML::Node methods... | |
| #### |
| # put this in your staging.rb file. Obviously you'll need more config than this it's just an example. | |
| Rails.application.configure do | |
| config.action_mailer.preview_path ||= defined?(Rails.root) ? "#{Rails.root}/test/mailers/previews" : nil | |
| config.autoload_paths += [config.action_mailer.preview_path] | |
| routes.append do | |
| get '/rails/mailers' => "rails/mailers#index" | |
| get '/rails/mailers/*path' => "rails/mailers#preview" | |
| end |
| # Allow Rails to use assets from Node packages | |
| package_json = Rails.root.join("package.json") | |
| Rails.configuration.watchable_files << package_json | |
| Rails.configuration.to_prepare do | |
| node_config = JSON.parse(package_json.read) | |
| paths = Rails.configuration.assets.paths | |
| node_modules = Rails.root.join("node_modules") | |
| paths.reject! { |p| p.to_s.start_with?(node_modules.to_s) } | |
| node_config["dependencies"].keys.each do |node_module| | |
| module_dir = node_modules.join(node_module) |
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.
I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)
Before trying it out DIY, I considered using:
| # config/initializers/public_importmap.rb | |
| Rails.application.config.public_importmap = Importmap::Map.new | |
| Rails.application.config.public_importmap.draw(Rails.root.join("config/public_importmap.rb")) | |
| # app/helpers/application_helper.rb | |
| # copied from importmaps replacing javascript_inline_importmap_tag | |
| # | |
| # !!! No longer needed after this change https://github.com/rails/importmap-rails/pull/187 | |
| # | |
| # def javascript_public_importmap_tags(entry_point = "application", shim: true) |
While it's possible to stream most content to Apple Vision Pro directly over the internet, having the ability to use Apple Vision Pro as an HDMI display can still be useful.
Since Apple Vision Pro does not support connecting to an HDMI input directly or using an HDMI capture card, we have to be a little creative to make this work. NDI provides the ability to stream HDMI content over a local network with really low latency, and it works great with Apple Vision Pro.
This page shows the setup I’m using.