Skip to content

Instantly share code, notes, and snippets.

View CocoaBeans's full-sized avatar

Kevin Ross CocoaBeans

View GitHub Profile
@CocoaBeans
CocoaBeans / git-delete-local-tags.sh
Created March 25, 2014 19:48
Delete all locate tags in a git repository and fetch the remote tags
git tag -l | xargs git tag -d
git fetch
@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
#!/bin/bash -x
############################################################################################################################
###
### MOGenerator.command
###
### Managed Object Generator Build Script.
### Implements generation gap codegen pattern for Core Data.
### http://rentzsch.github.com/mogenerator/
###
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) {

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 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,
// 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 / 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 / .profile
Created January 16, 2013 19:48
Custom Bash Prompt
###############################################################
## 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