#Stay Standalone
A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.
| <html> | |
| <head> | |
| </head> | |
| <body> | |
| <div style="text-align:center" onmouseover="Play()" onmouseout="Pause()"> | |
| <video id="video1" width="480"> | |
| <source src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" type="video/mp4" /> | |
| <source src="http://clips.vorwaerts-gmbh.de/VfE_html5.ogg" type="video/ogg" /> | |
| Your browser does not support HTML5 video. | |
| </video> |
| // iOS 11.3 Safari / macOS Safari 11.1 empty <input type="file"> XHR bug workaround. | |
| // This should work with every modern browser which supports ES5 (including IE9). | |
| // https://stackoverflow.com/questions/49614091/safari-11-1-ajax-xhr-form-submission-fails-when-inputtype-file-is-empty | |
| // https://github.com/rails/rails/issues/32440 | |
| document.addEventListener('ajax:before', function(e) { | |
| var inputs = e.target.querySelectorAll('input[type="file"]:not([disabled])') | |
| inputs.forEach(function(input) { | |
| if (input.files.length > 0) return | |
| input.setAttribute('data-safari-temp-disabled', 'true') |
| class ExampleJob < ApplicationJob | |
| queue_as :default | |
| def perform(user) | |
| # do some work | |
| # HACK: get around limitations in devise/warden when rendering | |
| # views outside the context of a formal http request | |
| renderer = ::ApplicationController.renderer.new | |
| renderer_env = renderer.instance_eval { @env } |
| import { CALL_API } from 'redux-api-middleware' | |
| export function fetchLocations() { | |
| return { | |
| [CALL_API]: { | |
| endpoint: 'http://api.somesite.com/api/locations', | |
| method: 'GET', | |
| // Don't have to manually add the Authorization header to every request. | |
| headers: { 'Content-Type': 'application/json' }, | |
| types: ['REQUEST', 'SUCCESS', 'FAILURE'] |
| 1. Change rails version in Gemfile | |
| > gem 'rails', '~> 5.1', '>= 5.1.4' | |
| 2. Remove Gemfile.lock | |
| > git rm Gemfile.lock | |
| 3. Run bundle install command | |
| > bundle install --jobs=5 | |
| 4. Run rails' app update to apply changes to app |
#Stay Standalone
A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.
| # lib/custom_logger.rb | |
| class CustomLogger < Logger | |
| def format_message(severity, timestamp, progname, msg) | |
| "#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n" | |
| end | |
| end | |
| logfile = File.open("#{Rails.root}/log/custom.log", 'a') # create log file | |
| logfile.sync = true # automatically flushes data to file | |
| CUSTOM_LOGGER = CustomLogger.new(logfile) # constant accessible anywhere |
| # app/config/deploy.rb | |
| # Most of the changes specific to your environment will be set in | |
| # the `app/config/deploy/[env].rb` files. | |
| # define multiple deployments | |
| set :stages, %w(production staging) | |
| set :default_stage, "staging" |
| package lv.org.substance.crypt | |
| import java.security.spec.AlgorithmParameterSpec; | |
| import java.security.spec.KeySpec; | |
| import javax.crypto.Cipher; | |
| import javax.crypto.SecretKey; | |
| import javax.crypto.SecretKeyFactory; | |
| import javax.crypto.spec.PBEKeySpec; | |
| import javax.crypto.spec.PBEParameterSpec; |