Skip to content

Instantly share code, notes, and snippets.

View Sega-Zero's full-sized avatar

Сергей Галездинов Sega-Zero

  • Nizhnekamsk
View GitHub Profile
@timonus
timonus / UIWindow+AppSwitchScrollStopper.h
Last active January 6, 2017 19:01
AppSwitchScrollStopper
// UIWindow+AppSwitchScrollStopper.h
// Created by Tim Johnsen on 3/27/16.
#import <UIKit/UIKit.h>
@interface UIWindow (AppSwitchScrollStopper)
/// Call this early on in your app's lifecycle to avoid
/// scroll-related flashing when your app resumes from the background
- (void)installAppSwitchScrollStopper;
@pesterhazy
pesterhazy / nuke-certs.sh
Created February 16, 2016 11:18
Reset code signing certificates to fix builds using `gym`
#!/usr/bin/env bash
# nuke-certs
#
#
# This script has been reported to help with errors like
#
# this:
# + xcodebuild -exportArchive -exportOptionsPlist /var/folders/rj/8lnf662s3mlgzv5mcq2r2fnc0000gn/T/gym20160216-41694-14bt0ur_config.plist -archivePath '/Users/pe/Library/Developer/Xcode/Archives/2016-02-16/016-02-16 12.09.02.xcarchive' -exportPath /var/folders/rj/8lnf662s3mlgzv5mcq2r2fnc0000gn/T/gym20160216-41694-17mfck9.gym_output
# 2016-02-16 12:10:03.004 xcodebuild[43629:464102] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/rj/8lnf662s3mlgzv5mcq2r2fnc0000gn/T/016-02-16_12-10-03.003.xcdistributionlogs'.
@jmcd
jmcd / Foo.swift
Last active February 22, 2018 07:10
MKMapView contested annotation location handling in Swift
import UIKit
import MapKit
/**
* Define behaviour of app through its lifetime
*/
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"More" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
// maybe show an action sheet with more options
[self.tableView setEditing:NO];
}];
moreAction.backgroundColor = [UIColor lightGrayColor];
UITableViewRowAction *blurAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Blur" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
[self.tableView setEditing:NO];
}];
@scottjacksonx
scottjacksonx / NSFileManager+WhereFromXAttr.h
Last active June 12, 2016 23:45
Quick category on NSFileManager to read in and return the kMDItemWhereFroms extended attribute of a file on disk.
#import <Foundation/Foundation.h>
@interface NSFileManager (WhereFromXAttr)
/// Returns the value of a given file's com.apple.metadata:kMDItemWhereFroms extended attribute.
- (NSArray *)valueForWhereFromExtendedAttributeOfFile:(NSString *)path;
@end
@JaviSoto
JaviSoto / gist:5906004
Last active June 27, 2023 10:25
Mark designated initializer at compile time
#define MSDesignatedInitializer(__SEL__) __attribute__((unavailable("Invoke the designated initializer `" # __SEL__ "` instead.")))
// Sample usage:
- (instancetype)initWithObject:(id)object;
- (instancetype)init MSDesignatedInitializer(initWithObject:); // <- This even gets auto-complete.
// Now calling init on this class would throw a warning.
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@Shilo
Shilo / UIImage+Additions.h
Created October 17, 2011 07:43
A UIImage category that will replace or remove colors. This allows multiple colors to be changed on a single image, until it has alpha values.
//
// UIImage+Additions.h
// Sparrow
//
// Created by Shilo White on 10/16/11.
// Copyright 2011 Shilocity Productions. All rights reserved.
//
#define COLOR_PART_RED(color) (((color) >> 16) & 0xff)
#define COLOR_PART_GREEN(color) (((color) >> 8) & 0xff)