This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSObject+ProcObservation.h | |
// Version 1.0 | |
// | |
// Andy Matuschak | |
// [email protected] | |
// Public domain because I love you. Let me know how you use it. | |
// | |
// NTW 2009-Oct-21: Added selectors with an options argument. | |
// NTW 2009-Oct-30: Transplanted new observation key from MYUtilities's KVUtils. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ios-configure runs a "configure" script using the iOS 4.3 SDK, generating a | |
# static library that will load and run on your choice of iPhone, iPad, and | |
# their respective simulators. | |
# | |
# Simply run in the same directory as a "configure" script. | |
# You can run this script for multiple targets and use lipo(1) to stitch them | |
# together into a universal library. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
// NSApplication has this weird habit of trying very hard to load a nib at | |
// launch. If there are none in the app bundle, it'll wander off into the | |
// frameworks until it finds one, then try to use it. | |
// | |
// You know this is what's happening if you get four log messages at launch | |
// saying "Could not connect the action buttonPressed: to target of class | |
// NSApplication". You've deleted MainMenu.nib and removed the "Main nib file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int IsC99() | |
{ | |
return (2//* */2 | |
== 2); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def wrap text, sigil, indent | |
text = text.map do |line| | |
line.match(/^\s*\S (.*)$/)[1] | |
end.join ' ' | |
lines = [] | |
while text and not text.empty? | |
cut = [text.length, 78 - indent].min | |
if cut < text.length and text[cut, 1] != ' ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
FSCRIPT_PATH = "/Library/Frameworks/FScript.framework" | |
if ARGV.empty? | |
puts "Usage: #{$0} process_name" | |
exit | |
end | |
GDB = IO.popen("gdb", 'w') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang -framework Foundation isequal.m | |
#include <mach/mach_time.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#import <Foundation/Foundation.h> | |
// Convert from mach time to seconds (gets set in main() below). | |
double ticksToNanos = 0; | |
// Run some code many times, timing how long it took, and announce the average |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/// A number formatter that usefully implements `attributedString(for:withDefaultAttributes:)`, which iOS's NumberFormatter does not. | |
final class AttributedNumberFormatter: NumberFormatter { | |
override func attributedString(for obj: Any, withDefaultAttributes defaultAttributes: [NSAttributedString.Key : Any]? = nil) -> NSAttributedString? { | |
guard | |
let number = obj as? NSNumber, | |
let plain = string(from: number) | |
else { return nil } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env swift | |
// Swift 3.0 | |
import Foundation | |
func main() -> Int32 { | |
if CommandLine.arguments.count < 2 { | |
print("") | |
print("Usage: \(CommandLine.arguments[0]) (path_to_pbxproj | path_to_xcodeproj)") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import json | |
from io import BytesIO | |
import logging | |
import os | |
import sys | |
try: | |
from urllib.request import Request, urlopen # py3 | |
from urllib.parse import quote |
OlderNewer