Skip to content

Instantly share code, notes, and snippets.

View kristopherjohnson's full-sized avatar
💭
Huh?

Kristopher Johnson kristopherjohnson

💭
Huh?
View GitHub Profile
@kristopherjohnson
kristopherjohnson / emacs.el
Last active December 11, 2015 06:18
My .emacs
;; .emacs
;;; uncomment this line to disable loading of "default.el" at startup
;; (setq inhibit-default-init t)
;; Add MELPA package repository
(when (>= emacs-major-version 24)
(require 'package)
(package-initialize)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
@kristopherjohnson
kristopherjohnson / unicodeTriangleEntities.js
Created February 3, 2013 01:02
HTML entities for various Unicode triangle characters
var blackUpPointingTriangle = '▲',
whiteUpPointingTriangle = '△',
blackUpPointingSmallTriangle = '▴',
whiteUpPointingSmallTriangle = '▵',
blackRightPointingTriangle = '▶',
whiteRightPointingTriangle = '▷',
blackRightPointingSmallTriangle = '▸',
whiteRightPointingSmallTriangle = '▹',
blackRightPointingPointer = '►',
whiteRightPointingPointer = '▻',
@kristopherjohnson
kristopherjohnson / gist:4741945
Created February 8, 2013 21:11
Errors trying to build kxmovie with Xcode 4.6
kdj@luna kxmovie [master]$ rake
Executing cd ffmpeg; ./configure --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-ffprobe --disable-doc --disable-bzlib --target-os=darwin --enable-cross-compile --enable-gpl --enable-version3 --assert-level=2 --disable-mmx --arch=i386 --cpu=i386 --extra-ldflags='-arch i386' --extra-cflags='-arch i386' --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc --as='gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc' --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk --extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/usr/lib/system
/Users/kdj/work/kxmovie/ffmpeg
install prefix /usr/local
source path .
C compiler /Applications/Xcode.app/Contents/Developer/Pl
@kristopherjohnson
kristopherjohnson / gist:4745570
Created February 9, 2013 14:56
Debug output from kxmovie sample
2013-02-09 09:55:34.559 KxMovieExample[56176:c07] AudioRoute: Speaker
2013-02-09 09:55:34.560 KxMovieExample[56176:c07] AudioRoute: Speaker
2013-02-09 09:55:34.560 KxMovieExample[56176:c07] We've got 2 output channels
2013-02-09 09:55:34.561 KxMovieExample[56176:c07] Current sampling rate: 44100.000000
2013-02-09 09:55:34.561 KxMovieExample[56176:c07] Current output volume: 1.000000
2013-02-09 09:55:34.562 KxMovieExample[56176:c07] Current output bytes per sample: 2
2013-02-09 09:55:34.562 KxMovieExample[56176:c07] Current output num channels: 2
[h264 @ 0xb227200] RTP: missed 1 packets
[h264 @ 0xb227200] RTP: missed 1 packets
[h264 @ 0xb227200] out of range intra chroma pred mode at 9 5
@kristopherjohnson
kristopherjohnson / gist:4751457
Created February 10, 2013 23:10
Output of kxmovieexample with rtsp_transport=tcp set
2013-02-10 18:07:30.347 KxMovieExample[32397:c07] AudioRoute: Speaker
2013-02-10 18:07:30.349 KxMovieExample[32397:c07] AudioRoute: Speaker
2013-02-10 18:07:30.349 KxMovieExample[32397:c07] We've got 2 output channels
2013-02-10 18:07:30.350 KxMovieExample[32397:c07] Current sampling rate: 44100.000000
2013-02-10 18:07:30.350 KxMovieExample[32397:c07] Current output volume: 1.000000
2013-02-10 18:07:30.352 KxMovieExample[32397:c07] Current output bytes per sample: 2
2013-02-10 18:07:30.352 KxMovieExample[32397:c07] Current output num channels: 2
[rtsp @ 0x10126600] Estimating duration from bitrate, this may be inaccurate
Input #0, rtsp, from 'media.amp?tcp':
 Metadata:
@kristopherjohnson
kristopherjohnson / afhttpclient_example.m
Last active December 13, 2015 18:08
Example of using AFNetworking's AFHTTPClient for simple GET request
- (void)performHttpGetForPath:(NSString *)path {
NSLog(@"%s: GET %@", __PRETTY_FUNCTION__, path);
if (self.webServiceAuthority.length == 0) {
NSLog(@"%s: webServiceAuthority not set", __PRETTY_FUNCTION__);
return;
}
NSURL *baseURL = [NSURL URLWithString:self.webServiceAuthority];
@kristopherjohnson
kristopherjohnson / UIWebView+XXXLoadHTMLResourceNamed.h
Last active December 13, 2015 19:39
UIWebView category method for loading HTML from the resource bundle. Content will be loaded such that the resource bundle directory is the base URL, so relative links (spreadsheets, images, etc.) work properly.
#import <UIKit/UIKit.h>
@interface UIWebView (XXXLoadHTMLResourceNamed)
// Load content from HTML resource file with specified name.
//
// Resource will be loaded using URL, and base URL will be the
// resource bundle directory, so relative paths will work properly.
- (void)loadHTMLResourceNamed:(NSString *)resourceName;
@kristopherjohnson
kristopherjohnson / NSDictionary+XXXConvertValues.h
Created February 18, 2013 20:41
Category on NSDictionary that will convert string values to numbers or vice versa. Useful for JSON deserialization.
#import <Foundation/Foundation.h>
@interface NSDictionary (XXXConvertValues)
// Return value associated wth key, converted to NSString
- (NSString *) stringValueForKey:(id)key;
// Return integer value associated with key, converted to integer
- (NSInteger) integerValueForKey:(id)key;
@kristopherjohnson
kristopherjohnson / formatjson.js
Last active May 25, 2025 20:08
Read JSON from standard input and writes formatted JSON to standard output. Requires Node.js.
#!/usr/bin/env node
// Reads JSON from stdin and writes equivalent
// nicely-formatted JSON to stdout.
var stdin = process.stdin,
stdout = process.stdout,
inputChunks = [];
stdin.resume();
Ld /Users/kdj/Library/Developer/Xcode/DerivedData/kxmovie-arodpbizpjyhwlcojwsjwswurwpa/Build/Products/Debug-iphoneos/KxMovieExample.app/KxMovieExample normal armv7
cd /Users/kdj/work/kxmovie
setenv IPHONEOS_DEPLOYMENT_TARGET 5.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -L/Users/kdj/Library/Developer/Xcode/DerivedData/kxmovie-arodpbizpjyhwlcojwsjwswurwpa/Build/Products/Debug-iphoneos -L/Users/kdj/work/kxmovie/libs -F/Users/kdj/Library/Developer/Xcode/DerivedData/kxmovie-arodpbizpjyhwlcojwsjwswurwpa/Build/Products/Debug-iphoneos -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/kdj/Library/Developer/Xcode/Derive