Skip to content

Instantly share code, notes, and snippets.

@antons
antons / tf-feedback-reply.js
Last active October 9, 2021 09:25
Bookmarklet for one-click replies to TestFlight Feedback in App Store Connect.
//
// Bookmarklet for one-click replies to TestFlight Feedback in App Store Connect.
// ‪Automatically fills in tester’s email address, title, and quotes all (or selected) text.
//
// Add to your browser with Bookmarkleter.
// https://chriszarate.github.io/bookmarkleter/
//
// Copyright © 2020 Anton Sotkov. MIT Licensed.
//
#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonHMAC.h>
#import <CoreFoundation/CoreFoundation.h>
static NSString *Base64URLEncodedStringWithData(NSData *data) {
NSMutableString *string = [[data base64EncodedStringWithOptions:0] mutableCopy];
[string replaceOccurrencesOfString:@"+" withString:@"-" options:0 range:NSMakeRange(0, string.length)];
[string replaceOccurrencesOfString:@"/" withString:@"_" options:0 range:NSMakeRange(0, string.length)];
[string replaceOccurrencesOfString:@"=" withString:@"" options:0 range:NSMakeRange(0, string.length)];
return string.copy;
@antons
antons / HUTF8MappedUTF16String.h
Created November 19, 2017 16:56 — forked from rsms/HUTF8MappedUTF16String.h
Convert a UTF-16 string to UTF-8, mapping indices to provide low-complexity range and index lookups
#ifndef H_UTF8_MAPPED_UTF16_STRING_H_
#define H_UTF8_MAPPED_UTF16_STRING_H_
#import <Foundation/Foundation.h>
#import <string>
/*
* Convert a UTF-16 string to UTF-8, mapping indices to provide low-complexity
* range and index lookups.
*
@antons
antons / xcode-plugin-update.sh
Last active May 4, 2016 20:04
Script to make all your Xcode plugins “compatible” with currently selected version of Xcode.
#!/bin/sh
PLIST_BUDDY=/usr/libexec/PlistBuddy
xcode-plugin-add-compatibility() {
"$PLIST_BUDDY" -c "Add DVTPlugInCompatibilityUUIDs:10 string $2" \
"$1/Contents/Info.plist"
}
xcode-plugin-has-compatibility() {
@antons
antons / mas.js
Last active March 29, 2016 04:30
Script to automatically replace `http://` with `macappstore://` (and `https://` with `macappstores://`) on Lion, Mountain Lion, and Mavericks.
// 1. Add `data-mac-app-store` attribute to all Mac App Store links.
// 2. Use this script to automatically replace `http://` with `macappstore://` (and `https://` with `macappstores://`) for those links on Lion, Mountain Lion, and Mavericks.
if (/Mac OS X 10[_.][0-9]/i.test(navigator.userAgent)) {
var MASLinks = document.querySelectorAll('a[data-mac-app-store]')
for (var MASLinkIndex = 0; MASLinkIndex < MASLinks.length; MASLinkIndex++) {
var MASLink = MASLinks[MASLinkIndex]
MASLink.setAttribute('href', MASLink.getAttribute('href').replace(/^http/, 'macappstore'))
}
}