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
| struct DecodeResult { | |
| uint32_t codepoint; | |
| uint32_t decodedBytes; | |
| }; | |
| static inline struct DecodeResult DecodeOneUTF8(const uint8_t *utf8) { | |
| static uint8_t byteCountTable[16] = { | |
| // 0xxx | |
| [0x0] = 1, | |
| [0x1] = 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
| NS_INLINE NSRange NSRangeMake(NSUInteger loc, NSUInteger len) { | |
| return NSMakeRange(loc, len); | |
| } | |
| NS_INLINE NSUInteger NSRangeMax(NSRange range) { | |
| return NSMaxRange(range); | |
| } | |
| NS_INLINE BOOL NSRangeContainsLocation(NSUInteger loc, NSRange range) { | |
| return NSLocationInRange(loc, range); |
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
| // Just before switching jobs: | |
| // Add one of these. | |
| // Preferably into the same commit where you do a large merge. | |
| // | |
| // This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
| // and then it quickly escalated into more and more evil suggestions. | |
| // I've tried to capture interesting suggestions here. | |
| // | |
| // Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
| // @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
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
| /* | |
| Distributed under The MIT License: | |
| http://opensource.org/licenses/mit-license.php | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the | |
| "Software"), to deal in the Software without restriction, including | |
| without limitation the rights to use, copy, modify, merge, publish, | |
| distribute, sublicense, and/or sell copies of the Software, and to |
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+Blocks.h | |
| // Filemator | |
| // | |
| // Created by Zachary Waldowski on 4/12/11. | |
| // Copyright 2011 Dizzy Technology. All rights reserved. | |
| // | |
| @interface NSObject (Blocks) |