Skip to content

Instantly share code, notes, and snippets.

@voxels
voxels / glsdk_template
Created Jul 30, 2012
GLSDK Template using GLFW
View glsdk_template
1) VS2010 Empty Project
2) Add glsdk_template.cpp file to the Source Files folder
3) Project > Properties > C/C++ > Additional Include Directories:
a) xxx..\glutil\include\
b) xxx..\glload\include\
c) xxx..\glimg\include\
d) xxx..\glm\
e) xxx..\glfw\include\
f) xxx..\freeglut\include\
4) Project > Properties > Linker > General > Additional Library Directories
View cleanTweets.py
import re
import datetime, time
import os
raw = open( "output.txt", 'r')
lines = []
noReturns = []
@voxels
voxels / ConcurrentOperation.swift
Created Jan 15, 2017 — forked from calebd/AsynchronousOperation.swift
Concurrent NSOperation in Swift
View ConcurrentOperation.swift
import Foundation
/// An abstract class that makes building simple asynchronous operations easy.
/// Subclasses must implement `execute()` to perform any work and call
/// `finish()` when they are done. All `NSOperation` work will be handled
/// automatically.
open class Operation: Foundation.Operation {
// MARK: - Properties
@voxels
voxels / universal-framework.sh
Last active May 30, 2018 — forked from atsepkov/universal-framework.sh
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures). This version works with Cocoapods, merging simulator and device architectures for intermediate libraries as well. To use this script, go to Product > Scheme > Edit S…
View universal-framework.sh
# This XCode scheme archive post-action script combines the device and iOS simulator frameworks into a single binary
# so that the encapsulated library can be run in both contexts. PLEASE NOTE: the iOS Simulator framework must be REMOVED
# before submitting this binary to the app store
# Source: https://gist.github.com/voxels/0ec095d567bcb0bc30a7c80122b17396
# Based on: https://gist.github.com/atsepkov/1673c2d899470270e3eb313912aafc6f
# Resources:
# - https://developer.apple.com/library/content/technotes/tn2215/_index.html
# - https://pewpewthespells.com/blog/buildsettings.html
@voxels
voxels / remove_unused_architectures.sh
Last active May 30, 2018 — forked from steipete/FilterScriptPhase.sh
This filter script phase is required to remove unused architectures from your application, which would be flagged as issue during upload to the Apple AppStore. Read more at http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/
View remove_unused_architectures.sh
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
@voxels
voxels / 96efadcdf4e5b178a3bf20cc278dbb80.md
Created Jun 20, 2018
Converting a CMSampleBufferRef to a single channel of color
View 96efadcdf4e5b178a3bf20cc278dbb80.md
- (void) toSingleChannel:(CMSampleBufferRef)sampleBuffer
{
    CVImageBufferRef imageBuffer =  CMSampleBufferGetImageBuffer(sampleBuffer);
    CVPixelBufferLockBaseAddress(imageBuffer, 0);
    
    size_t width = CVPixelBufferGetWidthOfPlane(imageBuffer, 0);
    size_t height = CVPixelBufferGetHeightOfPlane(imageBuffer, 0);
    
    size_t bytesPerRow = CVPixelBufferGetBytesPerRowOfPlane(imageBuffer, 0);
@voxels
voxels / ToyPhotoGalleryObjectMap.md
Last active Jul 10, 2018
ToyPhotoGallery Object Map
View ToyPhotoGalleryObjectMap.md

ToyPhotoGallery Object Map

Author: Michael Edgcumbe Date: 07/10/18

The design goals of the object map include:

  • Provide abstract protocols for common services so that libraries can be swapped if needed
  • Hide API interfaces behind model controllers
  • Provide launch safety for reachability or other issues
  • Provide thread safe access to network fetching and local storage
@voxels
voxels / BufferedImageView.swift
Last active Jul 14, 2018
Used for incrementally loading progressive JPEGs, used best with NetworkSessionInterface and NetworkSessionInterfaceTaskDelegate
View BufferedImageView.swift
//
// BufferedImageView.swift
//
// Created by Boris Bügling on 11/03/15.
// Customized by Michael Edgcumbe on 07/06/18
// Copyright (c) 2018 Michael Edgcumbe. All rights reserved.
//
import UIKit
@voxels
voxels / NetworkSessionInterface+NetworkSessionInterfaceDataTaskDelegate.swift
Created Jul 14, 2018
Gist for using data delegates in a NetworkSessionInterface
View NetworkSessionInterface+NetworkSessionInterfaceDataTaskDelegate.swift
//
// NetworkSessionInterface.swift
// ToyPhotoGallery
//
// Created by Voxels on 7/6/18.
// Copyright © 2018 Michael Edgcumbe. All rights reserved.
//
import Foundation
@voxels
voxels / NetworkSessionInterface_DataTask.swift
Last active Jul 14, 2018
Simplified NetworkSessionInterface for fetching data tasks only
View NetworkSessionInterface_DataTask.swift
//
// NetworkSessionInterface.swift
// ToyPhotoGallery
//
// Created by Voxels on 7/6/18.
// Copyright © 2018 Michael Edgcumbe. All rights reserved.
//
import Foundation
You can’t perform that action at this time.