This file contains 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 dispatch_after_example.m -o dispatch_after_example | |
// Compiling with gcc requires separating declaration of b from assignment, | |
// but you can omit the -framework flag for GCC. | |
/* @author Jeremy W. Sherman | |
* @date 2011-06-03 | |
* | |
* Demonstrates use of a recursive block to set up a repeating action | |
* using `dispatch_after()`. | |
* Assumes 10.6+ or iOS with GCD and blocks (whichever version that was). | |
*/ |
This file contains 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/local/bin/tt++ | |
/* Who wants to write out "inventory" in full? */ | |
#alias {i} {inventory} | |
#alias {inv} {inventory} | |
/* Simpler AFK handling. | |
* ifMUD has a 2-step AFK process. | |
* This turns it into a one-step "afk MSG" process. */ | |
#alias {afk} {@away me=%0} |
This file contains 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 -g -Weverything -framework Foundation literals.m -o literals | |
/* @file literals.m | |
* @author Jeremy W. Sherman | |
* @url http://jeremywsherman.com/ | |
* @date 2012-08-27 */ | |
#import <Foundation/Foundation.h> | |
int | |
main(void) | |
{ |
This file contains 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
2012-09-05 13:23:50.803 bind-abperson[53387:707] dudeView name: DUDE! | |
2012-09-05 13:23:50.804 bind-abperson[53387:707] dudeView name: Duuuuuuuude | |
2012-09-05 13:23:50.805 bind-abperson[53387:707] dudeView.name binding: { | |
NSObservedKeyPath = name; | |
NSObservedObject = "<Dude: 0x7f9ce3c15ac0>"; | |
NSOptions = { | |
NSMultipleValuesPlaceholder = "<null>"; | |
NSNoSelectionPlaceholder = "<null>"; | |
NSNotApplicablePlaceholder = "<null>"; | |
NSNullPlaceholder = "<null>"; |
This file contains 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++ -std=c++11 -stdlib=libc++ -framework Foundation nsarray.mm -o nsarray | |
/* Note: | |
* - libstdc++ has been frozen by Apple at a pre-C++11 version, so you must opt | |
for the newer, BSD-licensed libc++ | |
* - Apple clang 4.0 (based on LLVM 3.1svn) does not default to C++11 yet, so | |
you must explicitly specify this language standard. */ | |
/* @file nsarray.mm | |
* @author Jeremy W. Sherman | |
* | |
* Demonstrates three different approaches to converting a std::vector |
This file contains 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 -fobjc-arc data-to-str.m -o data-to-str | |
#import <Foundation/Foundation.h> | |
#import <sysexits.h> | |
void | |
usage(void) { | |
fprintf(stderr, "usage: %s DATA\n" | |
" treats data as hex bytes, skips spaces,\n" | |
" writes UTF-8 text interpretation to stdout\n", | |
getprogname()); |
This file contains 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/sh | |
gem install camper_van | |
CAMPER_VAN="`which camper_van`" | |
if test \! -x "$CAMPER_VAN"; then | |
echo >&2 "error: camper_van not found on path - unable to install plist" | |
exit 1 | |
fi | |
# Substitute in the fixed path to use to launch camper_van. |
This file contains 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
% nslookup -h | |
*** Invalid option: h | |
> set querytype=soa | |
> www.roominant.com | |
Server: 8.8.8.8 | |
Address: 8.8.8.8#53 | |
Non-authoritative answer: | |
www.roominant.com canonical name = toyama-3685.herokussl.com. | |
toyama-3685.herokussl.com canonical name = elb022637-991043341.us-east-1.elb.amazonaws.com. |
This file contains 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
//cc -Wall -framework Foundation nsargs.m -o nsargs | |
/* @author Jeremy W. Sherman | |
* @date 2013-08-02 | |
* | |
* Demonstrates NSArgumentDomain. | |
* | |
* Try: | |
* ./nsargs -a YES -foo fishy -x 3 | |
* | |
* 2013-08-02 19:49:35.331 nsargs[48904:707] nsargs: command-line args: |
This file contains 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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta http-equiv="Content-Style-Type" content="text/css"> | |
<title></title> | |
<meta name="Generator" content="Cocoa HTML Writer"> | |
<meta name="CocoaVersion" content="1187.39"> | |
<style type="text/css"> | |
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; text-indent: 18.0px; font: 14.0px Cochin} |
OlderNewer