Skip to content

Instantly share code, notes, and snippets.

Paul Solt PaulSolt

Block or report user

Report or block PaulSolt

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
@PaulSolt
PaulSolt / Markdown Table of Contents Playground
Last active Jul 13, 2018
Sample code to extract the table of contents and output in-line for a blog post on Ghost (copy/paste, buggy output currently)
View Markdown Table of Contents Playground
//: Table of contents generator for Markdown using {{TOC}} for text replacement and link insertion
//: Fixed the bug with {{TOC}} on second pass, added some more logic to prevent losing whitespace, and making
//: non-unicode links from the TOC (good start prototyping and working with strings, now I need to cleanup and do TDD + Mac UI)
//: I plan to wrap it up more and fix the bugs, so that I can use it as a Mac app, but this was my starting point
//: with lots of todos
//: Paul Solt (Swift 4.2 in Xcode 10)
//: 7-12-18
import Cocoa
@PaulSolt
PaulSolt / ViewController.swift
Created Feb 28, 2018
Animate Auto Layout Constraints Swift 4
View ViewController.swift
//
// ViewController.swift
// SwiftButton
//
// Created by Paul Solt on 7/21/15.
// Copyright (c) 2015 Paul Solt. All rights reserved.
//
import UIKit
View VideoDurationCalculator.py
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"
View gist:47f5d75805f6a91e14d3
- (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 {
@PaulSolt
PaulSolt / AECocos2D.h
Created Jan 4, 2014
A wrapper around Cocos2d so that you can use it with UIKit as a view.
View AECocos2D.h
//
// 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:8256785
Created Jan 4, 2014
Modal Context to Layer UIViewControllers with Transparency
View gist:8256785
- (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;
View gist:5903970
@class MatBorder;
@class FractionLabel;
@interface ViewController : UIViewController <UINavigationControllerDelegate, UIImagePickerControllerDelegate,
MeasurementStepperDelegate,
UnitSliderSquareDelegate,
MatViewDelegate,
CropViewDelegate> {
CropViewController *_cropViewController;
}
@PaulSolt
PaulSolt / gist:5523000
Created May 6, 2013
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
View gist:5523000
//
// main.m
// FindWords
//
// Created by Paul Solt on 5/5/13.
// Copyright (c) 2013 Paul Solt. All rights reserved.
//
#import <Foundation/Foundation.h>
View gist:4746913
// 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
View gist:4746558
- (void)loadView {
[super loadView];
NSLog(@"load view");
self.starButton.layer.cornerRadius = 20; // this value vary as per your desire
self.starButton.clipsToBounds = YES;
}
You can’t perform that action at this time.