Skip to content

Instantly share code, notes, and snippets.

View PaulSolt's full-sized avatar

Paul Solt PaulSolt

View GitHub Profile
@PaulSolt
PaulSolt / ImageHelper.h
Created December 13, 2010 15:54
A simple UIImage to RGBA8 conversion function
/*
* The MIT License
*
* Copyright (c) 2011 Paul Solt, PaulSolt@gmail.com
*
* https://github.com/PaulSolt/UIImage-Conversion/blob/master/MITLicense.txt
*
*/
#import <Foundation/Foundation.h>
@PaulSolt
PaulSolt / MyTransparentTableViewController.h
Created May 14, 2011 19:47
MyTransparentTableViewController
/*
* The MIT License
*
* Copyright (c) 2011 Paul Solt, PaulSolt@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
- (void)loadView {
[super loadView];
NSLog(@"load view");
self.starButton.layer.cornerRadius = 20; // this value vary as per your desire
self.starButton.clipsToBounds = YES;
}
// ViewController.m
// Use at top
#import <QuartzCore/QuartzCore.h>
//...
// Add below the @implementation
- (void)loadView {
[super loadView]; // important to have this call, otherwise things might not load
@PaulSolt
PaulSolt / gist:5523000
Created May 6, 2013 02:07
Chapter 15 Solution: Objective-C Programming Guide Ed. 1. The book says that words doesn't contain proper names, but it does. We can check for non-proper names that match by testing isEqualToString: and having it fail. -Paul Solt
//
// main.m
// FindWords
//
// Created by Paul Solt on 5/5/13.
// Copyright (c) 2013 Paul Solt. All rights reserved.
//
#import <Foundation/Foundation.h>
@class MatBorder;
@class FractionLabel;
@interface ViewController : UIViewController <UINavigationControllerDelegate, UIImagePickerControllerDelegate,
MeasurementStepperDelegate,
UnitSliderSquareDelegate,
MatViewDelegate,
CropViewDelegate> {
CropViewController *_cropViewController;
}
@PaulSolt
PaulSolt / gist:8256785
Created January 4, 2014 16:00
Modal Context to Layer UIViewControllers with Transparency
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.gameState = GameStateMenu;
self.definesPresentationContext = NO;
self.modalPresentationStyle = UIModalPresentationFormSheet;
self.menuScreenViewController = [[MenuScreenViewController alloc] init];
self.menuScreenViewController.definesPresentationContext = YES;
@PaulSolt
PaulSolt / AECocos2D.h
Created January 4, 2014 16:20
A wrapper around Cocos2d so that you can use it with UIKit as a view.
//
// AECocos2D.h
// CocosUIKitTest
//
// Created by Paul Solt on 7/4/13.
// Copyright (c) 2014 Paul Solt. All rights reserved.
//
#import <Foundation/Foundation.h>
@PaulSolt
PaulSolt / gist:47f5d75805f6a91e14d3
Created June 13, 2014 18:24
Load Data in iPhone App
- (void)loadData {
NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
NSString *filepath = [documentsDirectory stringByAppendingPathComponent:@"cityData.txt"];
NSError *error = nil;
NSString *textFromFile = [NSString stringWithContentsOfFile:filepath encoding:NSUTF8StringEncoding error:&error];
if(error) {
NSLog(@"Error: Unable to load file: %@", [error localizedDescription]);
} else {
import os
import commands
# Paul Solt - get the length of all videos within a folder (recursive)
#
# Depending on the number of files/folders, it can take time to complete
#(100 files ~2.018 seconds to run)
# Set your video folder path here
path = "/Users/Shared/Course Videos/1 - Swift in 31 Days/Swift1 - Handbrake 1080"