Skip to content

Instantly share code, notes, and snippets.

@KhaosT
KhaosT / HDMI on Apple Vision Pro.md
Last active May 23, 2024 19:12
Guide for using Apple Vision Pro as HDMI display

Displaying HDMI sources on Apple Vision Pro

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.

@varyform
varyform / multiple_importmaps.rb
Last active April 3, 2024 21:58
Multiple importmaps
# 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)
@jesster2k10
jesster2k10 / README.md
Last active April 25, 2024 00:54
JWT Auth + Refresh Tokens in Rails

JWT Auth + Refresh Tokens in Rails

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:

@tobiashm
tobiashm / node_modules.rb
Last active October 26, 2023 22:26
Add node modules to Rails assets paths
# 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)
@mkarliner
mkarliner / aes_crypt.rb
Created March 22, 2013 11:17
Using OpenSSL with Ruby to do AES encryption
# 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
/* 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; }