Skip to content

Instantly share code, notes, and snippets.

@patriknyblad
patriknyblad / xcrun_simctl_cheatsheet.md
Last active April 17, 2024 17:03
iOS Simulator Terminal Commands `$ xcrun simctl`

Managing iOS Simulators

List all simulators created

$ xcrun simctl list --json

Delete old and unavailable simulators

$ xcrun simctl delete unavailable
@PoomSmart
PoomSmart / ContainsEmoji.m
Last active April 7, 2023 02:08
Detect if string contains emoji (Using Objective-C and Swift)
#import <UIKit/UIKit.h>
#import <CoreFoundation/CoreFoundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <CoreText/CoreText.h>
@interface EmojiUtilities : NSObject
+ (CFMutableCharacterSetRef)emojiCharacterSet;
+ (BOOL)containsEmoji:(NSString *)emoji;
@end
@pirafrank
pirafrank / uninstall_office_2016.sh
Last active March 21, 2024 14:12
Uninstall Office 2016 from OS X completely
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo -e "
ROOT PRIVILEDGES NEEDED!
You have to run this script as root.
Aborting...
"
exit 1
else
@hwdsl2
hwdsl2 / .MOVED.md
Last active April 18, 2024 01:37
IPsec VPN Server Auto Setup Script for Ubuntu and Debian
@miguelgrinberg
miguelgrinberg / rest-server.py
Last active March 29, 2024 09:05
The code from my article on building RESTful web services with Python and the Flask microframework. See the article here: http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask_httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':
@bluebanboom
bluebanboom / OPRunOnce.h
Last active December 17, 2015 04:49
Run action only at current version first run. It is very easy to use. Just Call runOnce:action, specify the only key to the action and target.
//
// OPRunOnce.h
// Run action only at current version first run.
// It is very easy to use.
// Just Call runOnce:action, specify the only key to
// the action and target.
//
#import <Foundation/Foundation.h>
@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' | \
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@dhoerl
dhoerl / KeychainItemWrapper.h
Last active April 4, 2023 08:15
KeychainItemWrapper ARCified. Added the ability to manage a dictionary in place of just a string - the #define PASSWORD_USES_DATA in the .m file switches the mode.
/*
File: KeychainItemWrapper.h
Abstract:
Objective-C wrapper for accessing a single keychain item.
Version: 1.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
@xslim
xslim / gist:788840
Created January 20, 2011 22:39
encode and decode with PBEWithMD5AndDES
/*
Usage
NSString *password = @"1111";
NSString *message = @"xxx";
NSData *inData = [message dataUsingEncoding:NSUTF8StringEncoding];
NSData *encData = [securityUtils encryptPBEWithMD5AndDESData:inData password:password];
NSString *encString = [encData base64EncodedString];