Skip to content

Instantly share code, notes, and snippets.

Daniele Di Bernardo marzapower

Block or report user

Report or block marzapower

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@marzapower
marzapower / count_hand.swift
Last active Aug 29, 2015
Swift Ninja Final Challenge
View count_hand.swift
enum Suit {
case Clubs, Diamonds, Hearts, Spades
}
enum Rank {
case Jack, Queen, King, Ace
case Num(Int)
}
struct Card {
@marzapower
marzapower / MPSimpleLog.h
Last active Jul 17, 2019
A simple way to make your Xcode console logs more readable. SLog stands for "Short Log", DLog for "Debug Log" and ALog for "Always Log". Automagically, all the NSLog calls will be redirected to the new SLog. SLog just replaces NSLog and removes all the log noise (complete timestamp, app name, memory addresses, etc.). DLog and ALog will also prep…
View MPSimpleLog.h
#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
You can’t perform that action at this time.