Skip to content

Instantly share code, notes, and snippets.

View andrey-str's full-sized avatar

Andrey Streltsov andrey-str

View GitHub Profile
@andrey-str
andrey-str / xcodeSwitch.sh
Created March 20, 2012 07:47 — forked from doronkatz/xcodeSwitch.sh
XCode switch script
$ sudo /usr/bin/xcode-select -switch /Applications/Xcode.app
@andrey-str
andrey-str / UIColor+Hex.h
Last active August 29, 2015 14:12
Convert hex color to UIColor
//
// UIColor+Hex.h
// Gists
//
// Created by Andrey Streltsov on 24 Dec 2014.
// Copyright (c) 2014 Scopicsoftware. All rights reserved.
//
#import <UIKit/UIKit.h>
@andrey-str
andrey-str / NSString+Additions.h
Created December 25, 2014 09:14
String with format macros
#define $S(format, ...) [NSString stringWithFormat:format, ## __VA_ARGS__]
@andrey-str
andrey-str / NSURL+Additions.h
Created December 25, 2014 09:16
NSURL with format [Macros]
#define $URL(format, ...) [NSURL URLWithFormat:format, ## __VA_ARGS__]
@andrey-str
andrey-str / NSLog+Additions.h
Last active February 12, 2017 14:20
NSLogging helpers [Macroses]
#ifndef __NSLOG_ADDITIONS_H__
#define __NSLOG_ADDITIONS_H__
// DLog will output like NSLog only when the DEBUG variable is set
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
@andrey-str
andrey-str / UIFont+ContentSize.h
Created December 25, 2014 09:42
UIFont + Custon font with Dynamic Sizes
#import <UIKit/UIKit.h>
extern NSString* const UIFontTextStyleBoldBody;
@interface UIFont (ContentSize)
+ (UIFont*)preferredSystemFontForTextStyle:(NSString*)textStyle;
@end
@andrey-str
andrey-str / loadres_mac.h
Created January 7, 2015 10:53
Convinient macroses for resources loading
#define $loadResource(res, ext) [[NSBundle mainBundle] pathForResource:res ofType:ext]
@andrey-str
andrey-str / CMRotationMatrix+SCNQuaternion.mm
Last active August 29, 2015 14:14
a bit of quaternions algebra;
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;
#!/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
@andrey-str
andrey-str / isup.py
Last active August 29, 2015 14:17 — forked from andrix/isup.py
#!/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")