Skip to content

Instantly share code, notes, and snippets.

@steipete
steipete / Macros.h
Last active January 6, 2024 07:24
Declare on your main init that all other init methods should call. It's a nice additional semantic warning. Works with Xcode 5.1 and above. Not tested with earlier variants, but should just be ignored. A reference to this macro shortly appeared in https://developer.apple.com/library/ios/releasenotes/ObjectiveC/ModernizationObjC/AdoptingModernObj…
#ifndef NS_DESIGNATED_INITIALIZER
#if __has_attribute(objc_designated_initializer)
#define NS_DESIGNATED_INITIALIZER __attribute((objc_designated_initializer))
#else
#define NS_DESIGNATED_INITIALIZER
#endif
#endif
@cliss
cliss / organize-photos.py
Created October 6, 2013 14:43
Photo management script. This script will copy photos from "~/Pictures/iPhone Incoming" into a tree the script creates, with folders representing month and years, and photo names timestamped. Completely based on the work of the amazing Dr. Drang; see here: http://www.leancrew.com/all-this/2013/10/photo-management-via-the-finder/ You can see more…
#!/usr/bin/python
import sys
import os, shutil
import subprocess
import os.path
from datetime import datetime
######################## Functions #########################
@fractaledmind
fractaledmind / Create Notebook Index Note With Hyperlinks to All Notes in that Notebook
Created September 2, 2013 05:14
This script creates a new Note in a selected Notebook that contains hyperlinks to all of the other notes in that notebook. Thus, it create a Notebook Index note for a chosen Notebook.
@boredzo
boredzo / gist:6090585
Created July 26, 2013 17:16
Generic NSMenuItem/NSControl validation method, so you can implement a separate -validate<Action>: method for each action
//This validation method is completely generic; it dispatches to validate<Action>:, where <Action> is the item's action, duly initially-capitalized.
- (BOOL) validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item {
SEL action = [item action];
if (![self respondsToSelector:action]) {
//We don't respond to the action, so unconditionally return NO.
return NO;
}
/*Determine the selector of the message to send ourselves for actual validation.
*/
@juliengrimault
juliengrimault / CrashlyticsLogger.h
Created March 30, 2013 10:39
CocoaLumberjack logger that works with crashlytics
//
// CrashlyticsLogger.h
//
// Created by Julien Grimault on 4/1/13.
//
//
#import "DDLog.h"
@interface CrashlyticsLogger : DDAbstractLogger
@chourobin
chourobin / RKAppDelegate.m
Last active October 22, 2018 14:22
Setting up magical record with RestKit
#import <RestKit/RestKit.h>
#import "CoreData+MagicalRecord.h"
// Use a class extension to expose access to MagicalRecord's private setter methods
@interface NSManagedObjectContext ()
+ (void)MR_setRootSavingContext:(NSManagedObjectContext *)context;
+ (void)MR_setDefaultContext:(NSManagedObjectContext *)moc;
@end
@implementation AppDelegate
@briandoll
briandoll / A_toast_to_you.md
Last active March 19, 2022 01:17
Toasts! - scripts to convert images attached to GitHub issues into an animated gif for serious celebratory purposes

To toast:

  • Make sure you have ImageMagick installed (brew install imagemagick)
  • Change line 7 of toast.rb to the repository name you're working with
  • toast!
$ bundle install
$ ./get_token [user] [pass]
$ export GHUSER=[myuser]
@Rovanion
Rovanion / noLicense.diff
Created September 22, 2012 19:58
Remove license check from Subsonic 4.7
diff --git a/subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java b/subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java
index f7031bf..39ee5b4 100644
--- a/subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java
+++ b/subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java
@@ -620,14 +620,11 @@ public class SettingsService {
}
public boolean isLicenseValid() {
- return isLicenseValid(getLicenseEmail(), getLicenseCode()) && licenseValidated;
+ return true;
@dfox
dfox / route53-user-policy.json
Created January 25, 2012 16:45
An IAM policy for Amazon AWS to allow limited access to Route 53
{
"Statement":[
{
"Action":[
"route53:ChangeResourceRecordSets",
"route53:GetHostedZone",
"route53:ListResourceRecordSets"
],
"Effect":"Allow",
"Resource":[
@jpwatts
jpwatts / xcode-git-version.sh
Created May 11, 2011 16:42
This Xcode 4 build phase script automatically sets the version and short version string of an application bundle based on information from the containing Git repository.
#!/bin/bash
# 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