Skip to content

Instantly share code, notes, and snippets.

Working from home

Chris Jungmann jungchris

Working from home
Block or report user

Report or block jungchris

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 ItemModel.swift
// ItemModel.swift
// HelloToDoSwift
// Created by Chris Jungmann on 4/2/16.
// Copyright © 2016 Chris Jungmann. All rights reserved.
import UIKit
View MetalController.swift
// Chris Jungmann Metal Experimentation
// Based on Ray Wenderlich's tutorial
import UIKit
import Metal
import QuartzCore // had to set to Generic iOS Device for this to import properly
jungchris / Tetrahedron.m
Last active Feb 5, 2016
Objective-C Method to Create a Four Sided 3-D Polyhedron
View Tetrahedron.m
// Method to calc a four sided polyhedron
- (void)createTetrahedron {
// constants & vars based on four faces (triangles)
int trianglesAroundZ = 3; // arbitrary choice of z axis
float seedPointAngle = 90.0; // first point P1 vertex angle from x-y plane
float distanceToOrigin = 1.0;
float angleBetweenPoints = 360/trianglesAroundZ;
// determine cone aspects
jungchris / Icosahedron.m
Last active Jan 26, 2016
A Gist to Create a 20 Sided Icosphere
View Icosahedron.m
// Declare data types
// This data type is used to store information for each vertex
typedef struct {
GLKVector3 positionCoords;
// Define vertex data for a triangle to use in example
jungchris / CCJFileEngine.m
Created Nov 10, 2015
Code snippet to save array data using NSKeyedArchiver
View CCJFileEngine.m
// save array data
- (void)saveArrayData {
NSMutableDictionary *dataDict = [[NSMutableDictionary alloc] initWithCapacity:365];
if (urgeArray != nil) {
[dataDict setObject:urgeArray forKey:@"events"]; // save the urges array
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectoryPath = [paths objectAtIndex:0];
jungchris / CCJTextEngine.m
Created Oct 23, 2015
Converting ISO8601 date-times to NSDate and vice-versa
View CCJTextEngine.m
#pragma mark - ISO8601 to NSDate & vice-versa
// Convert ISO 8601 standard Zulu date+time to NSDate
+ (NSDate*)convertISO8601ToNSDate:(NSString*)isoString {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"];
// Always use this locale when parsing fixed format date strings
NSLocale *posix = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
[formatter setLocale:posix];
jungchris / CCJVideoPlayerVC.m
Last active Oct 7, 2015
Video Player View Controller Force Rotate Back to Portrait
View CCJVideoPlayerVC.m
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
// check if exiting
if (self.isMovingFromParentViewController) {
// set public property to indicate this view will not longer be presented
self.isPresented = NO;
// forces a return to portrait orientation
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
jungchris / AppDelegate.m
Last active Sep 29, 2015
Control Rotation and Allow for Only One View
View AppDelegate.m
// this delegate is executed before each rotation. Here we allow only one view to go to landscape
- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
// get the array of VCs from the nav controller
UINavigationController *navControl = (UINavigationController*)self.window.rootViewController;
NSArray *controllerArray = navControl.viewControllers;
NSUInteger controllerCount = [controllerArray count];
// safety check, make sure we have at least one view controller on the stack
if (controllerCount > 0) {
jungchris / SessionsTableViewController.m
Last active Sep 17, 2015
Sessions Table Filtered both by Date and Track
View SessionsTableViewController.m
// this is the .h file
// properties set by previous view controllers DatesTableVC or TracksTableVC
@property (assign, nonatomic) NSInteger selectedRow;
@property (nonatomic, strong) NSDate *selectedDate;
@property (nonatomic, strong) NSString *selectedTrack;
// ---------------------------------------------------------------------------------------------
// this is the .m file
@interface SessionTableVC ()
jungchris / TracksTableViewController.m
Last active Sep 17, 2015
Filter Method For Tracks
View TracksTableViewController.m
// NOTES: sessionType property from JSON file 'sessions.json' compared to 'tracksString' from 'tracks.json'
@property (nonatomic, strong) NSString *selectedTrack;
@property (nonatomic, strong) NSArray *filteredArray;
@property (nonatomic, strong) NSArray *sortedArray;
@implementation TracksTableVC
You can’t perform that action at this time.