Skip to content

Instantly share code, notes, and snippets.

- (void)loadDefaultSettings
{
NSMutableDictionary *defaults = [NSMutableDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default-Settings" ofType:@"plist"]];
// other setup...
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithDictionary:defaults]];
}
- (void)resetDefaultSettings
@sdevore
sdevore / gist:1267198
Created October 6, 2011 11:35 — forked from redsweater/gist:1266047
If you ship Growl framework in a Mac App Store target… add this build phase to strip PPC
#!/bin/sh
echo "Stripping PPC from Growl framework..."
cd "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/Growl.framework/Versions/Current"
lipo ./Growl -verify_arch ppc
if test $? -ne 1 ; then
lipo ./Growl -remove ppc -output ./Growl
fi
@sdevore
sdevore / TODO_FIXME_build_phase.sh
Created October 30, 2011 21:50
add a build phase to mark TODO: and FIXME: as warnings in Xcode 4.x
KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
# Uncrustify 0.59
#
# General options
#
# The type of line endings
newlines = auto # auto/lf/crlf/cr
# The original size of tabs in the input
# Copies the selected tweet's URL from Twitter.app, and
# opens corresponding page for Aaron Swartz's Twitter Viewer.
#
# Original by John Gruber: https://gist.github.com/1440914
# This version by Daniel Jalkut
#
# I'm hooking this up to a keyboard shortcut specifically in Twitter.app,
# using my scripting utility FastScripts.
#
# Requires "Access for Assistive Devices" to be enabled.
CFAbsoluteTime startTime = CFAbsoluteTimeGetCurrent();
CVImageBufferRef cameraFrame = CMSampleBufferGetImageBuffer(sampleBuffer);
int bufferWidth = CVPixelBufferGetWidth(cameraFrame);
int bufferHeight = CVPixelBufferGetHeight(cameraFrame);
int maxTextureSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
bufferWidth = MIN(bufferWidth, maxTextureSize); // bad access here? for maxTextureSize
@sdevore
sdevore / 0_reuse_code.js
Created January 30, 2014 04:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am sdevore on github.
  • I am sdevore (https://keybase.io/sdevore) on keybase.
  • I have a public key whose fingerprint is E401 1523 7B80 83E6 04FE 2A7B 8EB7 6206 EE25 10A2

To claim this, I am signing this object:

<?php // in a model
if (empty($this->_modelWithCustomSource)) {
App::import('Model', 'MyPlugin.MyPluginModel');
$this->_modelWithCustomSource = new MyPluginModel();
$this->_modelWithCustomSource->useDbConfig; // is an instance of the datasouce
}

Keybase proof

I hereby claim:

  • I am sdevore on github.
  • I am sdevore (https://keybase.io/sdevore) on keybase.
  • I have a public key ASDZB-mhOIoxQbSh7DVOkoayQGDexOpkygXH23jEfSU6Sgo

To claim this, I am signing this object: