Skip to content

Instantly share code, notes, and snippets.

olxios olxios

Block or report user

Report or block olxios

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
View NotificationView.swift
// Swift 3
import UIKit
class TestView: UIView {
// MARK: Observers
override func didMoveToWindow() {
View NotificationView.m
@implementation TestView
#pragma mark - Observers
- (void)didMoveToWindow
{
if (self.window) // If self.window != nil, it means view was added to the window
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(test:)
@olxios
olxios / AverageValue.swift
Last active Nov 29, 2016
Average array value
View AverageValue.swift
// Swift 3
let testArray: [Double] = [15.67, 9.87, 4.56, 3.45, 3.45, 8.76, 6, 1, 20.11]
let average: Double = (testArray as NSArray).value(forKeyPath: "@avg.self") as! Double
print("Average \(average)")
@olxios
olxios / AverageValue.m
Created Nov 29, 2016
Average array value
View AverageValue.m
NSArray *testArray = @[@(15.67), @(9.87), @(4.56), @(3.45), @(8.76), @(6), @(1), @(20.11)];
NSNumber *average = [testArray valueForKeyPath:@"@avg.self"];
NSLog(@"Average %@", average);
View GalleryItemsLayout1.h
#import <UIKit/UIKit.h>
@interface GalleryItemsLayout : UICollectionViewLayout
@property (nonatomic, readonly) CGFloat horizontalInset;
@property (nonatomic, readonly) CGFloat verticalInset;
@property (nonatomic, readonly) CGFloat minimumItemWidth;
@property (nonatomic, readonly) CGFloat maximumItemWidth;
@property (nonatomic, readonly) CGFloat itemHeight;
View GalleryItemsLayout1.swift
import UIKit
class GalleryItemsLayout: UICollectionViewLayout {
var horizontalInset = 0.0 as CGFloat
var verticalInset = 0.0 as CGFloat
var minimumItemWidth = 0.0 as CGFloat
var maximumItemWidth = 0.0 as CGFloat
var itemHeight = 0.0 as CGFloat
View JailbreakCheck1.m
#import <sys/stat.h>
void checkJailbreakSymlinks()
{
NSArray *linksChecks = @[LOO_CRYPT_STR_N("/Applications", 13),
LOO_CRYPT_STR_N("/usr/libexec", 12),
LOO_CRYPT_STR_N("/usr/share", 10),
LOO_CRYPT_STR_N("/Library/Wallpaper", 18),
LOO_CRYPT_STR_N("/usr/include", 12)];
View DebugPrint.swift
/// Writes the textual representations of `items` most suitable for
/// debugging, separated by `separator` and terminated by
/// `terminator`, into the standard output.
///
/// The textual representations are obtained for each `item` via
/// the expression `String(reflecting: item)`.
///
/// - Note: To print without a trailing newline, pass `terminator: ""`
///
/// - SeeAlso: `print`, `Streamable`, `CustomStringConvertible`,
@olxios
olxios / Log.h
Last active May 22, 2017
How to use NSLog and print only for debugging? http://swiftiostutorials.com/use-nslog-debugging/
View Log.h
#import <Foundation/Foundation.h>
@interface Log : NSObject
extern void SSLog(BOOL releaseLog, NSString *format, ...) NS_FORMAT_FUNCTION(2,3);
@end
View GalleryItem.swift
import Foundation
class GalleryItem {
var itemImage: String
init(dataDictionary:Dictionary<String,String>) {
itemImage = dataDictionary["itemImage"]!
}
You can’t perform that action at this time.