Skip to content

Instantly share code, notes, and snippets.

View max-potapov's full-sized avatar
🌴
On vacation

Maxim V. Potapov max-potapov

🌴
On vacation
View GitHub Profile
@mbrandonw
mbrandonw / FB10144005.md
Last active March 22, 2024 17:05
iOS 16 Navigation API feedbacks

How to execute logic when NavigationLink is tapped?

FB10144005

Currently it doesn't seem possible to execute additional logic when a navigation link is tapped with the new NavigationLink(value:) initializer. When the link is tapped it updates path state all the way back at the root NavigationStack to drive navigation, but there are many times where we need to perform logic after the tap and before the drill down.

For example, after tapping a link we may want to pre-emptively load some data to show on the drill down screen. Or we may want to perform some form validation. Or we may want to track some analytics. This does not seem possible with the current link API.

A workaround is to use Buttons instead of NavigationLinks, but then you lose all of the styling and affordances given to links, such as chevrons when used in List.

If the API for NavigationLink cannot be changed to accomodate for this, perhaps a new ButtonStyle could be introduced that allows regular buttons to take on the sty

@madebylydia
madebylydia / oracle_infrastructure_101.md
Last active April 24, 2024 21:01
Oracle Cloud Infrastructure: My 101 guide to setup your new machine like new

Welcome to another tutorial of "What the f*ck is Oracle doing to my machine without me asking for it?"

I will cover in this guide how to correctly setup your machine to get rid of the stupid Oracle's agent on your machine, and even pimp your machine a little bit. You can't say no to that! :D Anyhow, let's start right now!

Just a warning!!!

When you create a machine, I HIGHLY recommend that you grab the SSH keys that Oracle gently ask you to also take. SSH keys are much more secure than passwords and you'll drastically avoid potential security issue with SSH. Oracle will automatically take care to refuse any password connection (Only allowing SSH keys connection) by then.

@jankais3r
jankais3r / iOS 13 Entitlements
Created May 1, 2020 12:46
iOS 13 Entitlements
//Sourced from http://newosxbook.com/ent.jl?ent=&osVer=iOS13
abs-client
absinthe-client
adi-client
allow-obliterate-device
allow-softwareupdated
appData
application-identifier
aps-connection-initiate
aps-environment
@toymil
toymil / MDRID291600.py
Created March 19, 2020 10:25
Sony WH-1000XM3 Downgrade Script
This file has been truncated, but you can view the full file.
# source:
# https://www.reddit.com/r/sony/comments/akynjz/psa_the_new_sony_wh1000xm3_firmware_v411_is/ekcytlg/
# https://paste.ubuntu.com/p/D5VRhs3rZj/
#
# version: 2019-04-11T21:18:17Z
"""
0) Please understand that this could brick/damage your device and that if something goes wrong there's no recovery possible.
1) Make sure your headphones are running firmware version 4.1.1
2) Perform a factory reset. Turn headphones off, then hold both "Power" and "NC" buttons until the blue led blinks 4 times (hold for about 7 seconds)
@dsabanin
dsabanin / enable-xcode-debug-menu.sh
Last active November 7, 2022 16:17
Enable internal Xcode debug menu in Xcode 11
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -bool YES
sudo mkdir -p /Applications/Xcode.app/Contents/Developer/AppleInternal/Library/Xcode
sudo touch /Applications/Xcode.app/Contents/Developer/AppleInternal/Library/Xcode/AppleInternal.plist
# Don't forget to restart Xcode
@algal
algal / Zipping.swift
Created February 17, 2019 01:18
Zip files on iOS, without using external libraries and without interoperating with the low-level Compression framework
// Zipping.swift
// known-good: Swift 4.2
// Alexis Gallagher
import Foundation
public extension URL {
/// Creates a zip archive of the file or folder represented by this URL and returns a references to the zipped file
///
@0xced
0xced / pin256.sh
Created August 30, 2017 14:50
Extract certificate + public key + pin from a TLS server
#!/usr/bin/env bash -e
HOST=${1:-cloudflare.com}
FILENAME=${2:-${HOST%%.*}}
# For file naming, see https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them
# For HTTP Public Key Pinning (HPKP), see https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key_Pinning
CERTIFICATE_PEM="${FILENAME}_certificate.ascii.crt"
CERTIFICATE_DER="${FILENAME}_certificate.crt"
PUBKEY_PEM="${FILENAME}_pubkey.ascii.key"
//
// RealmSwift+Codable.swift
//
// Created by Michael Gray on 8/16/17.
//
import Foundation
import RealmSwift
// swiftlint:disable line_length identifier_name
@wayne5540
wayne5540 / ios-how-to-communicate-with-iframes.md
Last active April 29, 2021 14:35
This article is to show how to inject JavaScript into iframs under iOS web view and so we can communicate with it.

[iOS - Swift] How to communicate with iFrames inside WebView

To provide better shopping experience for Onefill users, we want to support as many shopping site as we can by injecting our JavaScript engine into those sites. However, some of them are using iframe which is outdated HTML tag to implement some forms like payment and signup. And due to security issue JavaScript can’t communicate with iframe unless it’s same domain or it’s your domain. So here is the approach we did to support iframe under iOS web view and so we can communicate with it.

  • Xcode: Version 8.2.1 (8C1002)
  • Swift: Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)

Conclusion first

@newtover
newtover / backToGifs.js
Last active July 26, 2021 18:12
unreadAfterForLepra.js
void function(){
var toImg = function(e1){
var img = document.createElement('img');
img.setAttribute('src', e1.dataset.orig);
e1.parentNode.replaceChild(img, e1);
};
var videos = document.querySelectorAll('video[data-orig]');
for (var i = videos.length - 1; i >= 0; i--){