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
import Darwin
// Swift hates uninitialized values but we need to create stuff without
// an explicit initial value. This protocol is for anything that can be
// created with any sort of default value (e.g. all integer types init
// with zero.
protocol Initable {
init()
@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>
@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
///
@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 / 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}"
@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 / .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
@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
@mikeash
mikeash / gist:1355671
Created November 10, 2011 18:28
Multiple return
// clang -W -Wall -Wno-unused-parameter -framework Foundation -fobjc-arc test.m
#import <Foundation/Foundation.h>
#define IDARRAY(...) ((id[]){ __VA_ARGS__ })
#define IDCOUNT(...) (sizeof(IDARRAY(__VA_ARGS__)) / sizeof(id))
typedef id (^Tuple)(int);