- Start Chrome with a flag from the terminal by copy-pasting the following line and hitting enter
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --show-component-extension-options
- Open [chrome://extensions/] in the browser
- Find CryptoTokenExtension, and click its 'background page' link
- In the JS console that opens, type:
HTTP_ORIGINS_ALLOWED = true;
and hit enter - Keep the console open while testing with your U2F device
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
# frozen_string_literal: true | |
class SubmitWidgetJob < ApplicationJob | |
include JobIteration::Iteration | |
queue_as :default | |
attr_accessor :funding_token, :confirmation_number, :profile_id | |
STEPS = [ |
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
# From https://gist.github.com/pixeltrix/e2298822dd89d854444b / https://ruby-doc.org/stdlib-2.3.0/libdoc/date/rdoc/DateTime.html | |
# "Almost certainly you'll want to use Time since your app is probably dealing with current dates and times." | |
# Here's a practical example | |
require "time" | |
# The line below is probably set different for your system, or not at all | |
# On macOS I can see this with `sudo systemsetup -gettimezone` | |
# I'm in Montreal so for the examples to work you need to pretend to be as well | |
ENV["TZ"] = "America/Toronto" |
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
# Migrating from https://github.com/castle/ruby-u2f to https://github.com/cedarcode/webauthn-ruby | |
# Also see FIDO CTAP2 specs on backwards compatibility with CTAP1/U2F authenticators: | |
# https://fidoalliance.org/specs/fido-v2.0-rd-20180702/fido-client-to-authenticator-protocol-v2.0-rd-20180702.html#u2f-authenticatorMakeCredential-interoperability | |
# Chrome team encouraging to migrate: https://groups.google.com/a/chromium.org/forum/#!msg/security-dev/BGWA1d7a6rI/W2avestmBAAJ | |
require 'u2f' | |
require 'webauthn' | |
require 'webauthn/fake_client' | |
require 'webauthn/attestation_statement/fido_u2f' |
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
# frozen_string_literal: true | |
# | |
# Usage: | |
# $ LANGUAGE=de ruby currency.rb | |
require 'open-uri' | |
require 'nokogiri' | |
require 'active_support/time_with_zone' | |
CLDR_URI = "http://unicode.org/repos/cldr/trunk/common/main/#{ENV['LANGUAGE']}.xml" | |
CURRENCIES = %w(USD AED AFN ALL AMD ANG AOA ARS AUD AWG AZN BAM BBD BDT BGN BIF BMD BND BOB BRL BSD BWP BZD CAD CDF CHF CLP CNY COP CRC CVE CZK DJF DKK DOP DZD EGP ETB EUR FJD FKP GBP GEL GIP GMD GNF GTQ GYD HKD HNL HRK HTG HUF IDR ILS INR ISK JMD JPY KES KGS KHR KMF KRW KYD KZT LAK LBP LKR LRD LSL MAD MDL MGA MKD MMK MNT MOP MRO MUR MVR MWK MXN MYR MZN NAD NGN NIO NOK NPR NZD PAB PEN PGK PHP PKR PLN PYG QAR RON RSD RUB RWF SAR SBD SCR SEK SGD SHP SLL SOS SRD STD SVC SZL THB TJS TOP TRY TTD TWD TZS UAH UGX UYU UZS VND VUV WST XAF XCD XOF XPF YER ZAR ZMW) |
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
# config/application.rb | |
config.middleware.use 'ConditionalContentLength', ['/foo', '/bar'] |
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 'bigdecimal' | |
# https://en.wikipedia.org/wiki/Pixel_density#Calculation_of_monitor_PPI | |
def calculate_ppi(height_pixels, width_pixels, diagonal_inches) | |
diagonal_pixels = Math.sqrt((height_pixels**2) + (width_pixels**2)) | |
ppi = diagonal_pixels / diagonal_inches | |
end | |
def calculate_ppi_rounded(height_pixels, width_pixels, diagonal_inches) | |
ppi = calculate_ppi(height_pixels, width_pixels, diagonal_inches) |