Skip to content

Instantly share code, notes, and snippets.

@PsychoH13
PsychoH13 / PSYBlockTimer.h
Created December 7, 2009 06:19
Fire an NSTimer using a block as execution code.
/*
Copyright (c) 2009 Remy Demarest
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
@0xced
0xced / gist:372236
Created April 20, 2010 09:34
Automatically show keyboard in MFMailComposeViewController
@try
{
id textView = [mailComposeViewController valueForKeyPath:@"internal.mailComposeView.textView"];
if ([textView respondsToSelector:@selector(becomeFirstResponder)])
[textView becomeFirstResponder];
}
@catch (NSException *e) {}
@soffes
soffes / install.markdown
Last active July 3, 2024 03:04
New computer setup

New Machine

Updated this for the first time in awhile in late 2020.

System Preferences

  • Enable iCloud
  • Disable iCloud mail
  • Display to medium
  • Turn up trackpad speed
@lukeredpath
lukeredpath / AssertEventually.h
Created August 3, 2010 13:20
Enables simple and elegant testing of asynchronous/threaded code with OCUnit, blocks and OCHamcrest
//
// AssertEventually.h
// LRResty
//
// Created by Luke Redpath on 03/08/2010.
// Copyright 2010 LJR Software Limited. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "HCMatcher.h"
var path = "/Users/jsb/Desktop/LayerTest";
var filename = "jefftest.acorn";
var acorn = JSTalk.application("Acorn");
var doc = acorn.open(path + "/" + filename);
var count = doc.layers().count();
for (i = 0; i < count; i++)
{
activerehashing yes
appendfsync everysec
appendonly no
bind 0.0.0.0
daemonize yes
databases 1
dbfilename dump_1.rdb
dir /var/redis/
glueoutputbuf yes
hash-max-zipmap-entries 512
@incanus
incanus / gist:926686
Created April 19, 2011 02:21
live move of UIPopoverController
// check that popover won't try to move off-screen; dismiss if so
//
CGFloat pX = newAttachPoint.x;
CGFloat pY = newAttachPoint.y;
CGFloat pWidth = balloon.popoverContentSize.width;
CGFloat pHeight = balloon.popoverContentSize.height;
CGFloat mWidth = map.bounds.size.width;
CGFloat mHeight = map.bounds.size.height;
UIPopoverArrowDirection d = balloon.popoverArrowDirection;
@guybrush
guybrush / nodeconf_2011.md
Created May 6, 2011 07:22
a list of slides from nodeconf 2011
@haikusw
haikusw / NSData+CommonDigest.h
Created May 24, 2011 06:45 — forked from 0xced/NSData+CommonDigest.h
NSData+CommonDigest: The most elegant NSData category for cryptographic hash functions
/*
Licensed under the MIT License
Copyright (c) 2011 Cédric Luthi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@bsneed
bsneed / build_runscript.sh
Created July 21, 2011 06:33
Copy a settings bundle and set a useful version for testflight if its a Debug build. This happens post file copy and won't change your source files.
#!/bin/bash
BUILD_VER=$(/usr/bin/defaults read ${CODESIGNING_FOLDER_PATH}/Info CFBundleVersion)
BUILD_APPNAME=$(/usr/bin/defaults read ${CODESIGNING_FOLDER_PATH}/Info CFBundleDisplayName)
if [ "$CONFIGURATION" == "Debug" ]; then
echo leaving Settings.bundle in place.
/usr/bin/defaults write ${CODESIGNING_FOLDER_PATH}/Info CFBundleDisplayName "WM ß - $BUILD_VER"
else
rm -rf ${CODESIGNING_FOLDER_PATH}/Settings.bundle