Skip to content

Instantly share code, notes, and snippets.

@CocoaBeans
CocoaBeans / git-delete-local-tags.sh
Created Mar 25, 2014
Delete all locate tags in a git repository and fetch the remote tags
View git-delete-local-tags.sh
git tag -l | xargs git tag -d
git fetch
@CocoaBeans
CocoaBeans / set_bundle_version.sh
Created Apr 3, 2014
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.
View set_bundle_version.sh
#!/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
View MOGenerator.sh
#!/bin/bash -x
############################################################################################################################
###
### MOGenerator.command
###
### Managed Object Generator Build Script.
### Implements generation gap codegen pattern for Core Data.
### http://rentzsch.github.com/mogenerator/
###
View NSAppKitVersionNumberExample.c
NSInteger osxVersion;
if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_6) {
//10.6.x or earlier systems
osxVersion = 106;
NSLog(@"Mac OSX Snow Leopard");
} else if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_7) {
/* On a 10.7.x or earlier system */
osxVersion = 107;
NSLog(@"Mac OSX Lion");
} else if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_8) {
View architecture.md

Architectural Questions

  • Are responsibilities well defined?
  • Are the collaborations well defined?
  • Is coupling minimized?
  • Can you identify potential duplication?
  • Are interface definitions and constraints acceptable?
  • Can modules access needed data—when needed?
@CocoaBeans
CocoaBeans / KRStaticAnalyzerAnnotations.h
Created Feb 21, 2012
KRStaticAnalyzerAnnotations.h - Source code notations for the clang static analyser
View KRStaticAnalyzerAnnotations.h
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// 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 Oct 4, 2015
Corrupt journal and bitmap of a given disk identifier
View DirectoryDestoryer.command
#!/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,
View Crashlytics-10.7-fixup.h
// Crashlytics have defined these so that if we use a new SDK then build then we get errors. We'll define these macros to remove any typed collections.
#ifdef CLS_GENERIC_NSARRAY
#undef CLS_GENERIC_NSARRAY
#define CLS_GENERIC_NSARRAY(type) NSArray
#endif
#ifdef CLS_GENERIC_NSDICTIONARY
#undef CLS_GENERIC_NSDICTIONARY
#define CLS_GENERIC_NSDICTIONARY(key_type,object_key) NSDictionary
@CocoaBeans
CocoaBeans / .profile
Created Jan 16, 2013
Custom Bash Prompt
View .profile
###############################################################
## Add custom command prompt
# Fill with minuses
# (this is recalculated every time the prompt is shown in function prompt_command):
fill="--- "
reset_style='\[\033[00m\]'
status_style=$reset_style'\[\033[0;90m\]' # gray color; use 0;37m for lighter color
prompt_style=$reset_style
#command_style=$reset_style'\[\033[1;29m\]' # bold black
@CocoaBeans
CocoaBeans / git-delete-tag
Created Jan 16, 2013
Delete a tag from the local git repository and push it to origin
View git-delete-tag
#!/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}"