Skip to content

Instantly share code, notes, and snippets.

View VladKorzun's full-sized avatar

Vlad Korzun VladKorzun

  • Portland, OR
View GitHub Profile
@Koze
Koze / HorizonDetection.m
Created June 7, 2017 18:39
Horizon Detection with Vision Framework
- (void)correctAngleWithImage:(UIImage *)image
{
VNImageRequestHandler *handler = [[VNImageRequestHandler alloc] initWithCGImage:image.CGImage options:@{}];
VNDetectHorizonRequest *request = [[VNDetectHorizonRequest alloc] initWithCompletionHandler:^(VNRequest * _Nonnull request, NSError * _Nullable error) {
if (error) {
NSLog(@"%@", error);
}
else {
NSAssert(request.results.count > 0, @"No Results");
@warpling
warpling / extraUIActivityTypes.m
Created November 24, 2016 07:42
Extra UIActivityTypes
// UIActivityTypes
NSString * const UIActivityTypePostToInstagram = @"com.burbn.instagram.shareextension";
NSString * const UIActivityTypeFacebookMessenger = @"com.facebook.Messenger.ShareExtension";
NSString * const UIActivityTypeWhatsApp = @"net.whatsapp.WhatsApp.ShareExtension";
NSString * const UIActivityTypeTelegraph = @"ph.telegra.Telegraph.Share";
NSString * const UIActivityTypeGmail = @"com.google.Gmail.ShareExtension";
NSString * const UIActivityTypeTencent = @"com.tencent.mqq.ShareExtension";
NSString * const UIActivityTypeViber = @"com.viber.app-share-extension";
NSString * const UIActivityTypeTumblr = @"com.tumblr.tumblr.Share-With-Tumblr";
NSString * const UIActivityTypeSkype = @"com.skype.skype.sharingextension";
@TheCodedSelf
TheCodedSelf / Disable Alert Button.swift
Last active March 31, 2024 18:00
Disable Alert Controller button if Alert Controller text field is empty or whitespace
import UIKit
// Create an alert controller
let alertController = UIAlertController(title: "Alert", message: "Please enter text", preferredStyle: .alert)
// Create an OK Button
let okAction = UIAlertAction(title: "OK", style: .default) { (_) in
// Print "OK Tapped" to the screen when the user taps OK
print("OK Tapped")
}
@lenamuit
lenamuit / DeviceUuidFactory.java
Created January 12, 2015 02:33
Generate UUID for Android
import android.content.Context;
import android.content.SharedPreferences;
import android.provider.Settings.Secure;
import android.telephony.TelephonyManager;
import java.io.UnsupportedEncodingException;
import java.util.UUID;
public class DeviceUuidFactory {
@igrigorik
igrigorik / mobile-networks-types.md
Created August 22, 2014 17:48
Bandwidth ceiling mappings for different generation networks. See: https://github.com/w3c/netinfo/issues/13#issuecomment-53095864
Android iOS Gen Down max
NETWORK_TYPE_CDMA 2G
NETWORK_TYPE_IDEN 2G
NETWORK_TYPE_GPRS CTRadioAccessTechnologyGPRS 2.5G
NETWORK_TYPE_EDGE CTRadioAccessTechnologyEdge 2.75G
NETWORK_TYPE_1xRTT CTRadioAccessTechnologyCDMA1x 3G
NETWORK_TYPE_UMTS CTRadioAccessTechnologyWCDMA 3G
NETWORK_TYPE_EVDO_0 CTRadioAccessTechnologyCDMAEVDORev0 3.5G
NETWORK_TYPE_EVDO_A CTRadioAccessTechnologyCDMAEVDORevA 3.5G
@matt-curtis
matt-curtis / NumberPadDoneBtn.h
Last active December 31, 2020 14:29
Done Button for UIKeyboard NumberPad (must be set as inputAccessoryView)
#import <UIKit/UIKit.h>
@interface NumberPadDoneBtn : UIView
@end
@interface NumberPadButton : UIButton
@end
@mattt
mattt / uiappearance-selector.md
Last active March 19, 2024 12:52
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
@sebfisch
sebfisch / replace-classes-in-apk.sh
Created May 22, 2012 08:58
Replaces classes in Android Package Files
#!/bin/bash
# Replaces classes in Android Package Files
# (c) Sebastian Fischer, CC-BY
# Can be used to rebuild an App with a modified version of a used library,
# as required for closed works that link to an LGPL library.
# Depends on: https://code.google.com/p/dex2jar/
#!/bin/sh
# Check if the individual developer has his own hook
CMD_NAME=`basename $0`
if [ -f $GIT_DIR/hooks/personal/$CMD_NAME ]
then
# If so, run it. $@ passes all the command line arguments passed to this function
# If the personal hook fails, fail this one as well
if ! $GIT_DIR/hooks/personal/$CMD_NAME $@
then