Skip to content

Instantly share code, notes, and snippets.

@ssp
ssp / nibtoxib.sh
Created December 11, 2009 11:57
nibtoxib
#! /bin/sh
find . -name "*.nib" -type d | awk '{sub(/.nib/,"");print}' | xargs -I % ibtool --write %.xib --upgrade %.nib
@kylefox
kylefox / gist:4512777
Created January 11, 2013 18:15
If you want to use Xcode's FileMerge as your git mergetool, this is how you set it up.
# Tell system when Xcode utilities live:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
# Set "opendiff" as the default mergetool globally:
git config --global merge.tool opendiff
@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active May 27, 2024 12:11
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>
@calebd
calebd / AsynchronousOperation.swift
Last active February 27, 2025 09:17
Concurrent NSOperation in Swift
import Foundation
/// An abstract class that makes building simple asynchronous operations easy.
/// Subclasses must implement `execute()` to perform any work and call
/// `finish()` when they are done. All `NSOperation` work will be handled
/// automatically.
open class AsynchronousOperation: Operation {
// MARK: - Properties
@smileyborg
smileyborg / Xcode7Macros.h
Last active May 26, 2020 12:08
Backwards compatible macros for Objective-C nullability annotations and generics
/**
* The following preprocessor macros can be used to adopt the new nullability annotations and generics
* features available in Xcode 7, while maintaining backwards compatibility with earlier versions of
* Xcode that do not support these features.
*/
#if __has_feature(nullability)
# define __ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
# define __ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
# define __NULLABLE nullable
@travisnewby
travisnewby / CMDeviceMotion.swift
Last active March 10, 2025 01:56
Determine the direction of "gaze" of the device in any orientation
extension CMDeviceMotion {
func gaze(atOrientation orientation: UIInterfaceOrientation) -> SCNVector4 {
let attitude = self.attitude.quaternion
let aq = GLKQuaternionMake(Float(attitude.x), Float(attitude.y), Float(attitude.z), Float(attitude.w))
let final: SCNVector4
switch orientation {
  1. 月薪是否全部通过银行工资单发放?还是部分通过第三方转账、第三方积分、发票报销的方式发放?
  2. 一年发几薪?多余 12 个月的部分一年分几次发放(影响税)?如当年未工作满 12 个月多余部分是否按工作月数等比例发放?
  3. 试用期多久,试用期工资是否有打折?
  4. 如果有股权、期权的话离职时公司是否保证会回购?
  5. 五险一金是否全额缴纳?
  6. 是否有补充公积金、补充医疗保险?
  7. 一年除了固定的基本薪资外是否有年终奖,年终奖是否有范围?
  8. 一周工作几天?一天的工作时间是几点到几点,弹性工作时间的话大家一般的工作时间是几点到几点?
  9. 是否支持长期或短期的在家办公?
  10. 是否有工作设备补贴、餐补、停车费补贴、住房补贴?补贴是否有限制条件?(比如住处距离小于多少公里才给房补贴,凑发票才给补贴)