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
full_data = { | |
response: {body: StyledYAML.literal(DATA.read), status: 200}, | |
person: StyledYAML.inline('name' => 'Steve', 'age' => 24), | |
array: StyledYAML.inline(%w[ apples bananas oranges ]) | |
} | |
StyledYAML.dump full_data, $stdout | |
__END__ | |
{ |
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 Suit { | |
case Clubs, Diamonds, Hearts, Spades | |
} | |
enum Rank { | |
case Jack, Queen, King, Ace | |
case Num(Int) | |
} | |
struct Card { |
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
#define LOG_DEBUG | |
#define __PREPEND_DATE(format) ([NSString stringWithFormat:@"[%@] %@", [[[NSDate new] description] componentsSeparatedByString:@" "][1], [@"%@" stringByAppendingString:format]]) | |
#define SLog(args,...) do { [[NSFileHandle fileHandleWithStandardOutput] writeData:[[NSString stringWithFormat:__PREPEND_DATE(args), @"", ##__VA_ARGS__] dataUsingEncoding: NSUTF8StringEncoding]]; [[NSFileHandle fileHandleWithStandardOutput] writeData: [@"\n" dataUsingEncoding: NSUTF8StringEncoding]]; } while(0); | |
#ifdef LOG_DEBUG | |
#define NSLog SLog | |
#endif | |
// ALog always displays output regardless of the DEBUG setting |