Skip to content

Instantly share code, notes, and snippets.

View neonichu's full-sized avatar
🤬
GitHub, cancel your contract with ICE!

Boris Bügling neonichu

🤬
GitHub, cancel your contract with ICE!
View GitHub Profile
@0xced
0xced / CopyLaunchedApplicationsInFrontToBackOrder.c
Created August 7, 2009 14:06
Get an array of running applications ordered by last use
#import <Carbon/Carbon.h>
#import <dlfcn.h>
/*
* Returns an array of CFDictionaryRef types, each of which contains information about one of the processes.
* The processes are ordered in front to back, i.e. in the same order they appear when typing command + tab, from left to right.
* See the ProcessInformationCopyDictionary function documentation for the keys used in the dictionaries.
* If something goes wrong, then this function returns NULL.
*/
CFArrayRef CopyLaunchedApplicationsInFrontToBackOrder(void)
@neonichu
neonichu / checkdev.sh
Created June 6, 2011 19:40 — forked from stuartcarnie/checkdev.sh
Ping developer.apple.com and growl when it's up
#!/bin/sh
read -p "Apple Id: " appleid; echo
stty -echo
read -p "Password: " passw; echo
stty echo
while [ /bin/true ]; do
curl -s -u$APPLEID:$PASSW developer.apple.com/devcenter/ios/index.action | grep "soon" >/dev/null
if [ $? -eq 1 ]; then
echo "Done"
@steipete
steipete / iOSDocumentMigrator.m
Created December 6, 2011 15:21
Helps migrating documents between iOS <= 5.0 and >= 5.0.1 to comply with Apple's iCloud guidelines. Follow @steipete on Twitter for updates.
#include <sys/xattr.h>
/// Set a flag that the files shouldn't be backuped to iCloud.
+ (void)addSkipBackupAttributeToFile:(NSString *)filePath {
u_int8_t b = 1;
setxattr([filePath fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0);
}
/// Returns the legacy storage path, used when the com.apple.MobileBackup file attribute is not available.
+ (NSString *)legacyStoragePath {
@wesbos
wesbos / gist:1476820
Created December 14, 2011 14:36
PhantomJS Screenshot
var page = new WebPage(),
address, output, size;
address = "http://www.metachunk.com/";
width = 1024; height = 600;
output = "./screenshots/wat-"+width+"X"+height+".png";
page.viewportSize = { width: width, height: height };
if (phantom.args.length === 3 && phantom.args[1].substr(-4) === ".pdf") {
@atomicbird
atomicbird / NSObject+setValuesForKeysWithJSONDictionary.h
Created January 11, 2012 02:35
NSObject category for handling JSON dictionaries. Described in detail at http://www.cimgf.com/2012/01/11/handling-incoming-json-redux/
//
// NSObject+setValuesForKeysWithJSONDictionary.h
// SafeSetDemo
//
// Created by Tom Harrington on 12/29/11.
// Copyright (c) 2011 Atomic Bird, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
@neonichu
neonichu / git-sqlitediff
Created January 19, 2012 09:54
Git diff for SQLite databases
#!/bin/sh
##
# Git diff for SQLite databases
##
if [ -z "$DIFF" ]
then
DIFF=diff
fi
@bignerdranch
bignerdranch / BNRTimeBlock.h
Created March 9, 2012 13:51
Timing Utility Post 20120308
CGFloat BNRTimeBlock (void (^block)(void));
@Lysander
Lysander / md_to_moinmoin.rb
Created May 13, 2012 16:12
Small Converter to generate markdown for MoinMoin from github's markdown dialect using Redcarpet.
#!/usr/bin/env ruby
require 'redcarpet'
class MoinMoin < Redcarpet::Render::Base
def header(text, level)
prefix = "=" * level
"\n\n#{prefix} #{text} #{prefix}\n"
@mlgill
mlgill / New reminder from Launchbar
Last active May 18, 2021 13:19 — forked from Jayphen/New reminder from Launchbar
A script for quickly adding reminders to the Reminders app in Mountain Lion from Launchbar and Alfred. Save this as a .scpt and drop it in ~/Library/Application\ Support/LaunchBar/Actions
--Script for setting Reminders for LaunchBar and Alfred
--For Alfred, Applescript must NOT be set to run in Background otherwise date parsing does not work
--For LaunchBar, place the script in ~/Library/Scripts/LaunchBar
--by Michelle L. Gill, 10/07/2012
--Inspired by https://gist.github.com/3187630
--A related Alfred version 2 workflow can be found here: https://github.com/mlgill/alfred-workflow-create-reminder
--Changes
--02/01/2013 * Fixed an issue with setting the time when the hour is 12 and AM/PM (12-hour clock) is used
-- * Removed the ability to set seconds for the time since Reminders doesn't recognize them
//
// OLD AND BUSTED
//
if ([self.zoomingDelegate respondsToSelector:@selector(zoomingWindow:didZoomOutViewController:)] == YES)
{
// Do something important.
}
//