Skip to content

Instantly share code, notes, and snippets.

View epologee's full-sized avatar
💭
🔌

Eric-Paul Lecluse epologee

💭
🔌
View GitHub Profile
@epologee
epologee / Binary STL parser.swift
Last active August 17, 2023 14:44
Create SceneKit geometry from Binary STL files in Swift 4
import Foundation
import SceneKit
public enum BinarySTLParser {
public enum STLError: Error {
case fileTooSmall(size: Int)
case unexpectedFileSize(expected: Int, actual: Int)
case triangleCountMismatch(diff: Int)
}
@epologee
epologee / ALAssetsLibrary+EEEConcurrency.h
Created February 8, 2014 21:34
Thread locking category method on ALAssetsLibrary, to illustrate how to block background threads until the assets library method finishes
#import <Foundation/Foundation.h>
#import <AssetsLibrary/AssetsLibrary.h>
@interface ALAssetsLibrary (EEEConcurrency)
- (NSUInteger)eee_enumerateGroupsLockedWithTypes:(ALAssetsGroupType)types
usingBlock:(ALAssetsLibraryGroupsEnumerationResultsBlock)enumerationBlock
failureBlock:(ALAssetsLibraryAccessFailureBlock)failureBlock;
@end
@epologee
epologee / 0001-argument-is-captured.patch
Last active January 3, 2016 20:59
I deleted the fork of allending/Kiwi that this patch was originally created with, because the pull request was not merged and there was no use to keep the fork around. In case someone cares to have a look at it, here's the patch.
From 4cde2c8b86131466ba6902b08b037d689eb44f8f Mon Sep 17 00:00:00 2001
From: Eric-Paul Lecluse <...>
Date: Fri, 10 Jan 2014 11:01:48 +0100
Subject: [PATCH] Re-introduced a property to check whether an argument was
captured on KWCaptureSpy
---
Classes/Core/KWCaptureSpy.h | 1 +
Classes/Core/KWCaptureSpy.m | 5 ++++-
Tests/KWCaptureTest.m | 11 +++++++++++
@epologee
epologee / NSBundle+TTTOverrideLanguage.h
Created October 11, 2013 19:26
Use method swizzling to change both language and locale at runtime, to use in your unit tests.
#import <Foundation/Foundation.h>
@interface NSBundle (TTTOverrideLanguage)
+ (void)ttt_overrideLanguage:(NSString *)language;
+ (void)ttt_resetLanguage;
@end
@epologee
epologee / Example.m
Last active December 16, 2015 09:38
[UIImage tttImageWithSize:CGSizeMake(44, 44)
drawing:^(CGContextRef ctx, CGSize size) {
UIColor *blue = [UIColor blueColor];
CGContextSetFillColorWithColor(ctx, blue.CGColor);
CGFloat half = size.height / 2;
rect = (CGRect){{0, half}, {size.width, half}};
CGContextFillRect(ctx, rect);
{
"m" : {
"sid" : "61683C29-2828-4E2D-AB07-BA9B10B11D24",
"os" : "OSX 1138.32",
"l" : "nl_NL",
"uid" : "B93DF2AF-BBE4-426C-BF04-34A157D79257"
},
"e" : [
{
"n" : "allow statistics",
@epologee
epologee / .gitignore
Created January 27, 2012 21:01 — forked from griff/.gitignore
AsyncCopyTest
AsyncCopyTest.xcodeproj/*.mode1v3
AsyncCopyTest.xcodeproj/*.pbxuser
AsyncCopyTest.xcodeproj/xcuserdata/*
AsyncCopyTest.xcodeproj/*/xcuserdata/*
build
@epologee
epologee / Signal.h
Created January 24, 2011 19:13
Simple Objective-C take on Robert Penner's Signals-AS3
//
// Signal.h
//
// Created by Eric-Paul Lecluse on 22-01-11.
// Copyright 2011 epologee. All rights reserved.
//
// This class was actually inspired and named by the brilliant work of Robert Penner & friends
// with the ActionScript 3.0 library called Signals: https://github.com/robertpenner/as3-signals
// It's not even close to a port, but it meets the demands of my current project.
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"Home";
self.tableView.rowHeight = 57.0;
tableViewData = [[NSArray arrayWithObjects:
[NSDictionary dictionaryWithObjectsAndKeys:@"Instagram", @"title", @"InstagramViewController", @"class", @"Icon.png", @"image", nil],
[NSDictionary dictionaryWithObjectsAndKeys:@"Path™", @"title", @"PathViewController", @"class", @"app-icon-114.png", @"image", nil],
@epologee
epologee / Warnings on device, not simulator
Created December 18, 2010 02:43
New project, window based for iPad, saved and then hit 'build & run' right after XCode is done. Then I get this, and no running app.
[Session started at 2010-12-18 03:40:41 +0100.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1510) (Fri Oct 22 04:12:10 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys000
Loading program into debugger…