Skip to content

Instantly share code, notes, and snippets.

# Uncrustify 0.59
#
# General options
#
# The type of line endings
newlines = auto # auto/lf/crlf/cr
# The original size of tabs in the input
@chrisbloom7
chrisbloom7 / BeyondCompare-CrossOver.sh
Created September 29, 2010 18:05
Bash shell script to use Beyond Compare from Versions.app
#!/bin/bash
# This script will open a file compare dialog for files you select in Versions.app. This script requires
# Beyond Compare to be installed into CrossOver for Mac. Note that the BC window doesn't always open
# in the foreground nor does it appear in the Dock, so you will need to CMD-TAB to find it. If you have problems
# using this from Versions try executing the commands below in a normal Terminal window running bash and replace
# the $1 and $2 variables with complete paths to two existing files.
# Setup some variables that CrossOver will need. You should replace these with your own values which can
# be found by opening CrossOver, going to Programs -> Run Command, selecting the bottle you installed
@Azuritul
Azuritul / Check UIViewController Visibility
Created August 31, 2011 08:54
Check if a view controller is visible
/*
* Check http://stackoverflow.com/questions/2777438/how-to-tell-if-uiviewcontrollers-view-is-visible
* to see the discussions.
* If the container is a UINavigationController,
* we can use the visibleViewController property
* to check the visibility.
*/
navigationController visibleViewController == self
/* Or, we can add a category to UIViewController
@icyleaf
icyleaf / umeng_ios_publish_channel_package_tool.sh
Last active October 4, 2015 14:08
iOS 友盟发布渠道自动化脚本
#
# iOS 友盟发布渠道自动化脚本
#
# - 在 Archive 的 "Post-action" 添加脚本去执行 "/bin/sh $SRCROOT/package.sh"
# - 确保在 "Provide build setting from" 选择了当前的 App
# - 在项目根目录($SRCROOT)添加 "iTunesArtwork" 文件(符合 App Store 提交要求的 512x512 px, PNG 格式)
# - 在下面 "" 设置你需要的发布渠道(空格分隔)
# - 在下面设置打包后的 ipa 的输出路径(可选)
# - 执行 "Product > Archive"
#
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active June 28, 2024 08:58
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@rnapier
rnapier / fix-xcode
Last active March 18, 2022 01:17
Links Xcode SDKs from the /SDKs directory (which you maintain yourself)
#!/usr/bin/python
# fix-xcode
# Rob Napier <robnapier@gmail.com>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
# Under those, store the SDKs:
@snikch
snikch / gist:3661188
Created September 6, 2012 23:16
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}
@adamgit
adamgit / .gitignore
Last active June 27, 2024 13:16
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.6
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
@xiangyuan
xiangyuan / gist:5289489
Created April 2, 2013 02:25
iphone流量统计
通过读取系统网络接口信息,获取当前iphone设备的流量相关信息,统计的是上次开机至今的流量信息. 2
倒入库:
[html] view plaincopy
SystemConfiguration.framework
加入头文件:
[html] view plaincopy
#include <ifaddrs.h>
#include <sys/socket.h>
#include <net/if.h>
@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>