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
# Regenerated the API token, set it at the command line, added it to shell config scripts | |
shon@atlas ~> echo $HOMEBREW_GITHUB_API_TOKEN | |
fc...24 | |
shon@atlas ~> brew search json-c | |
json-c | |
Error: GitHub API rate limit exceeded for 107.192.237.60. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.) | |
Try again in 11 minutes 19 seconds, or create an personal access token: | |
https://github.com/settings/tokens | |
and then set the token as: HOMEBREW_GITHUB_API_TOKEN |
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
// Playground - noun: a place where people can play | |
import Cocoa | |
let polyPath = NSBezierPath() | |
var sides = 8 | |
var 𝛉 = 0.0 | |
var 𝜋 = 3.14159 | |
var 𝜋2 = 2*𝜋 |
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
enum UTF8SequenceLength { | |
Bytes1 = 0, | |
Bytes2 = 0b11000000, | |
Bytes3 = 0b11100000, | |
Bytes4 = 0b11110000, | |
BytesErr = 0b10000000, | |
}; | |
enum UTF8ParsingMode { | |
UTF8ParsingModeNone = 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
typedef enum { | |
StyleCircle = 'circ', | |
StylePie = '3.14', | |
StylePolygon = 'poly', | |
} Style; |
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
Class thisClass = [self class]; | |
BOOL conforms = class_conformsToProtocol(thisClass, @protocol(NSObject)); | |
XCTAssert(!conforms, @"*gasp*"); |
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
char *cString = "CHS - 中设置了私人内容文件夹 您可以随时访问此文件夹。.pdf"; | |
NSUInteger sLen = strlen(cString); | |
NSString *wrongString = [NSString stringWithFormat:@"%s", cString]; | |
NSLog(@"%@", wrongString); // CHS - 中设置了私人内容文件夹 您可以随时访问此文件夹。.pdf | |
NSString *rightString = [[NSString alloc] initWithBytes:cString length:sLen encoding:NSUTF8StringEncoding]; | |
NSLog(@"%@", rightString); // CHS - 中设置了私人内容文件夹 您可以随时访问此文件夹。.pdf |
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
void dispatch_wait_while(dispatch_wait_condition_t condition_block, dispatch_time_t interval, dispatch_wait_completion_t completion_block) { | |
if ( !condition_block ) return; | |
if ( !interval ) return; | |
if ( !completion_block ) return; | |
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_current_queue()); | |
dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, interval, 0.25*NSEC_PER_SEC); | |
dispatch_source_set_event_handler(timer, ^{ | |
if (!condition_block()) { | |
dispatch_source_cancel(timer); |
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
<!-- sudo DailySoftwareUpdate.plist /Library/LaunchDaemons/ --> | |
<!-- sudo launchctl load /Library/LaunchDaemons/DailySoftwareUpdate.plist --> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" | |
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>DailySoftwareUpdate</string> |
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
// | |
// dispatch-timer.c | |
// | |
// Created by Shon Frazier on 4/22/13. | |
// Copyright (c) 2013 Shon Frazier. All rights reserved. | |
// | |
#include <stdio.h> | |
#include <dispatch/dispatch.h> |
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
, . | |
, / . | |
, / .- . | |
. .- .- | |
./ .-- ... | |
.-------- * .-- | |
/ ....... | |
, .. | |
........ ---- | |
. --.. |