Skip to content

Instantly share code, notes, and snippets.

View stevemoser's full-sized avatar
🐫
🥶

Steve Moser stevemoser

🐫
🥶
View GitHub Profile
@0xced
0xced / Emoji.json
Last active November 22, 2023 15:53
Extract emoji by category using the EmojiFoundation framework
{
"People" : [
"😀",
"😃",
"😄",
"😁",
"😆",
"😅",
"😂",
"🤣",
@b3ll
b3ll / UIActivityViewControllerPreheat.swift
Created February 21, 2017 09:19
UIActivityViewController is crazy slow :(
// Preheat the UIActivityViewController because it's crazy slow.
let activityViewController = UIActivityViewController(activityItems: [ UIImage(named: "Halo.jpg")! ], applicationActivities: nil)
activityViewController.view.alpha = 0.0
let fakeViewController = UIViewController()
fakeViewController.present(activityViewController, animated: false) {
activityViewController.dismiss(animated: false, completion: nil)
}
@ethanhuang13
ethanhuang13 / xcode-beta-slink.sh
Last active February 3, 2023 20:21
Symbolic link from Xcode.app to Xcode-beta.app (Xcode 11.2)
# Usage:
# 1) Ctr+S downloads page to ~/Desktop/books.html
# 2) Run script
# 3) Find your books in /tmp/humble_books
# 4) Read them
# 5) Profit
cat ~/Desktop/books.html |
grep "https://dl.humble.com" |
sed -n -E 's/.data-web\=\"(https://dl.humble.com/([.]+).([a-z]+)?["]+)./\1 \2 \3/p' |
sed 's/&/&/g' > /tmp/humble_books_list && cat /tmp/humble_books_list |
@danielctull
danielctull / AppDelegate.m
Last active April 12, 2019 07:15
Shows selection of table view cells on pressing the up/down arrow keys.
@implementation AppDelegate
#pragma mark - Key Command Controller
- (KeyCommandController *)keyCommandController {
if (!_keyCommandController) {
UIViewController *rootViewController = self.window.rootViewController;
if (rootViewController){
@gonzalolarralde
gonzalolarralde / tvos_prohibited.md
Last active December 24, 2019 16:19
Classes and Methods prohibited to tvOS
$ grep -lR "__TVOS_PROHIBITED" . | while read L; do echo "## $L"; echo "\`\`\`obj-c"; grep "__TVOS_PROHIBITED" "$L"; echo "\`\`\`"; echo; done

./AVFoundation.framework/AVAudioSession.h

AVAudioSessionPortOverrideSpeaker __TVOS_PROHIBITED = 'spkr'

AVAudioSessionCategoryOptionAllowBluetooth	__TVOS_PROHIBITED		= 0x4,
AVAudioSessionCategoryOptionDefaultToSpeaker __TVOS_PROHIBITED		= 0x8,
@fastred
fastred / NS_SWIFT_UNAVAILABLE.md
Last active February 6, 2022 15:35
NS_SWIFT_UNAVAILABLE

Results of searching for NS_SWIFT_UNAVAILABLE macro in iOS 9 and OS X 10.11 headers reveal some new Swift-specific APIs.

Highlights

GameplayKit.framework/Headers/GKEntity.h
70: - (nullable GKComponent *)componentForClass:(Class)componentClass
NS_SWIFT_UNAVAILABLE("Exposed in Swift as componentForClass<ComponentType: GKComponent>(componentClass: ComponentType.Type) -> ComponentType?");

GameplayKit.framework/Headers/GKStateMachine.h
@matthewmueller
matthewmueller / osx-for-hackers.sh
Last active February 22, 2024 08:52
OSX for Hackers (Mavericks/Yosemite)
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
@steipete
steipete / UITableViewMore.m
Last active January 29, 2018 14:19
Using the "More" button. Of course the simple way that Apple uses in Mail/iOS is not public. rdar://16600859
- (NSString *)tableView:(UITableView *)tableView titleForSwipeAccessoryButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
return @"More";
}
- (void)tableView:(UITableView *)tableView swipeAccessoryButtonPushedForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"I wanted to be a pretty public API, but then time ran out and they forgot me...");
// Hide the More/Delete menu.
[self setEditing:NO animated:YES];
}
@nuthatch
nuthatch / iOS 7 dynamic font mappings
Last active January 9, 2023 13:55
What is UIFontTextStyleHeadline *really*? Dump out preferredFontForTextStyle for UIFontTextStyleHeadline, UIFontTextStyleSubheadline, UIFontTextStyleBody, UIFontTextStyleFootnote, UIFontTextStyleCaption1, UIFontTextStyleCaption2 to examine the font name, weight, and point size.
+ (void)describePreferredFonts
{
static NSArray *textStyles;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
textStyles = @[UIFontTextStyleHeadline,
UIFontTextStyleSubheadline,
UIFontTextStyleBody,
UIFontTextStyleFootnote,
UIFontTextStyleCaption1,