Skip to content

Instantly share code, notes, and snippets.

View CocoaBeans's full-sized avatar

Kevin Ross CocoaBeans

View GitHub Profile
@CocoaBeans
CocoaBeans / set_bundle_version.sh
Created April 3, 2014 19:38
This script automatically sets the version and short version string of an Xcode project from the Git repository containing the project. To use this script in Xcode 4, add the contents to a "Run Script" build phase for your application target.
#!/bin/bash -x
# This script automatically sets the version and short version string of
# an Xcode project from the Git repository containing the project.
#
# To use this script in Xcode 4, add the contents to a "Run Script" build
# phase for your application target.
set -o errexit
set -o nounset
@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active March 10, 2024 19:23
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>
@CocoaBeans
CocoaBeans / .gitattributes
Created January 16, 2013 20:05
Common .gitattributes for Cocoa development
##################################################
## Attribute for diff'ing UTF-8 .strings files
*.strings -crlf set diff
##################################################
## Attribute to for easy merging of Xcode project files
*.pbxproj merge=union
@CocoaBeans
CocoaBeans / .gitignore
Created January 16, 2013 19:53
Common .gitignores for Cocoa development
*.xcuserdatad/
docset-installed.txt
# OS X Finder
.DS_Store
# Xcode per-user config
*.mode1
*.mode1v3
*.mode2v3
@CocoaBeans
CocoaBeans / git-delete-tag
Created January 16, 2013 19:26
Delete a tag from the local git repository and push it to origin
#!/bin/bash #-x
GIT_TAG="${1}"
echo "Deleting remote git tag: ${GIT_TAG}"
git tag -d "${GIT_TAG}"
git push origin ":refs/tags/${GIT_TAG}"
@r2k0
r2k0 / Think_FIB_Plot_1
Last active December 8, 2019 23:41
Automatic Opening Range and Fibonacci Levels This Thinkscript is designed to plot the OR high, low, 50% fib retrace, and fib extensions for the current day. This will only work correctly on time-based charts, where the OR time frame is divisible by the bar period e.g. 30 minute OR, 10 min bars. An extra fib extension may be used if desired to cr…
#
def na=double.nan;
#
# Define time that OR begins (in hhmm format,
# 0930 is the default):
#
input ORBegin = 0930;
#
# Define time that OR is finished (in hhmm format,
# 10:00 is the default):
@nertzy
nertzy / README
Created December 9, 2012 22:32 — forked from symposion/README
Convert OS X Keychain exported entries into logins for 1Password import
These two files should help you to import passwords from mac OS X keychains to 1password.
Assumptions:
1) You have some experience with scripting/are a power-user. These scripts worked for me
but they haven't been extensively tested and if they don't work, you're on your own!
Please read this whole document before starting this process. If any of it seems
incomprehensible/frightening/over your head please do not use these scripts. You will
probably do something Very Bad and I wouldn't want that.
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they
@CocoaBeans
CocoaBeans / DirectoryDestoryer.command
Last active October 4, 2015 15:37
Corrupt journal and bitmap of a given disk identifier
#!/bin/bash
#########################################################################################
###
### DirectoryDestoryer.command
### Corrupt journal and bitmap of a given disk identifier
###
### Copyright (c) 2013 Kevin Ross. All rights reserved.
###
### Redistribution and use in source and binary forms, with or without modification,
@CocoaBeans
CocoaBeans / KRStaticAnalyzerAnnotations.h
Created February 21, 2012 20:05
KRStaticAnalyzerAnnotations.h - Source code notations for the clang static analyser
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// KRStaticAnalyzerAnnotations.h
///
/// The Clang frontend supports several source-level annotations in the form of GCC-style attributes and pragmas
/// that can help make using the Clang Static Analyzer more useful. These annotations can both help suppress
/// false positives as well as enhance the analyzer's ability to find bugs.
///
/// For more info see: http://clang-analyzer.llvm.org/annotations.html
///
@spycos
spycos / PhotoGrabber.h
Created February 7, 2012 00:19 — forked from erkie/PhotoGrabber.h
Capture photos from built in iSight-camera or other connected cameras using Objective-C
//
// PhotoGrabber.h
// By Erik Rothoff Andersson <erikrothoff.com>
//
#import <Foundation/Foundation.h>
#import <QTKit/QTKit.h>
@protocol PhotoGrabberDelegate <NSObject>