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
// | |
// UIColor+Hex.h | |
// Gists | |
// | |
// Created by Andrey Streltsov on 24 Dec 2014. | |
// Copyright (c) 2014 Scopicsoftware. All rights reserved. | |
// | |
#import <UIKit/UIKit.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
#define $S(format, ...) [NSString stringWithFormat:format, ## __VA_ARGS__] |
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 $URL(format, ...) [NSURL URLWithFormat:format, ## __VA_ARGS__] |
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
#import <UIKit/UIKit.h> | |
extern NSString* const UIFontTextStyleBoldBody; | |
@interface UIFont (ContentSize) | |
+ (UIFont*)preferredSystemFontForTextStyle:(NSString*)textStyle; | |
@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
#define $loadResource(res, ext) [[NSBundle mainBundle] pathForResource:res ofType:ext] |
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
SCNQuaternion CalculateRotation(CMRotationMatrix a){ | |
SCNQuaternion q; | |
float trace = a.m11 + a.m22 + a.m33; // I removed + 1.0f; see discussion with Ethan | |
if( trace > 0 ) { // I changed M_EPSILON to 0 | |
float s = 0.5f / sqrtf(trace + 1.0f); | |
q.w = 0.25f / s; | |
q.x = ( a.m32 - a.m23 ) * s; | |
q.y = ( a.m13 - a.m31 ) * s; |
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
#!/bin/bash | |
# https://gist.github.com/949831 | |
# http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/ | |
# command line OTA distribution references and examples | |
# http://nachbaur.com/blog/how-to-automate-your-iphone-app-builds-with-hudson | |
# http://nachbaur.com/blog/building-ios-apps-for-over-the-air-adhoc-distribution | |
# http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/ | |
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html |
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
#!/usr/bin/env python | |
import re | |
import sys | |
from urllib import urlopen | |
def isup(domain): | |
resp = urlopen("http://www.isup.me/%s" % domain).read() | |
return "%s: %s" % (domain, "UP" if re.search("It's just you.", resp, | |
re.DOTALL) else "DOWN") |
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
import lldb | |
def __lldb_init_module(debugger, internal_dict): | |
debugger.HandleCommand('type summary add QString -F lldb_qt.QString_summary') | |
debugger.HandleCommand('type summary add QUuid -F lldb_qt.QUuid_summary') | |
print 'lldb_qt.py has been loaded and is ready for use.' | |
def QString_summary(value, internal_dict): | |
name = value.GetName() | |
deref = '->' if value.TypeIsPointerType() else '.' |
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
QString dateDiff(const QString&origDate) { | |
NSDateFormatter* df = [$CE dateFormatter]; | |
NSDate *convertedDate = [df dateFromString:origDate.toNSString()]; | |
NSDate *todayDate = [NSDate date]; | |
double ti = [convertedDate timeIntervalSinceDate:todayDate]; | |
ti = ti * -1; |
OlderNewer