Skip to content

Instantly share code, notes, and snippets.

View mbaranowski's full-sized avatar

Matthew Baranowski mbaranowski

View GitHub Profile
@mbaranowski
mbaranowski / cmake_iphone
Created October 25, 2012 12:30
command line to build with cmake for iphone
export ios_version=6.0
cmake --debug -DCMAKE_C_COMPILER_WORKS:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_C_COMPILER=/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang -DCMAKE_OSX_ARCHITECTURES:STRING=armv7 -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${ios_version}.sdk/ ..
@mbaranowski
mbaranowski / gist:4253529
Created December 10, 2012 21:21
openGL Axis
glBegin(GL_LINES);
glColor3f(1.0f,0.0f,0.0f); glVertex3f(0.0f, 0.0f, 0.0f); glVertex3f(1.0f, 0.0f, 0.0f);
glColor3f(0.0f,1.0f,0.0f); glVertex3f(0.0f, 0.0f, 0.0f); glVertex3f(0.0f, 1.0f, 0.0f);
glColor3f(0.0f,0.0f,1.0f); glVertex3f(0.0f, 0.0f, 0.0f); glVertex3f(0.0f, 0.0f, 1.0f);
glEnd( );
@mbaranowski
mbaranowski / gist:5245710
Created March 26, 2013 14:20
Slice The Images
package main
import (
"fmt"
"image"
"image/png"
"os"
"log"
"strconv"
)
int main(int argc, const char * argv[])
{
// c++98
int* array[2];
array[0] = new int[5];
array[1] = new int[2];
// c++11 only, 1d initializer
int array4[] = {1,2,3,4,5};
int* array3= new int[3]{1,2,3};
UIMotionEffectGroup* effectGroup = [[UIMotionEffectGroup alloc] init];
UIInterpolatingMotionEffect* horizontalParallax =
[[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center"
type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
UIInterpolatingMotionEffect* verticalParallax =
[[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center"
type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
@mbaranowski
mbaranowski / NSObject + injected
Created February 13, 2015 17:02
Give every NSObject a typesafe dependency injection class method (injected)
//
// NSObject+injected.h
//
#import <Foundation/Foundation.h>
#import <JInjector.h>
@interface NSObject (injected) <JInjectable>
+(instancetype)injected;
@end
@mbaranowski
mbaranowski / ReObjectiveC.h
Created August 24, 2016 12:33
ReObjectiveC.h
#import <Foundation/Foundation.h>
@protocol Action <NSObject>
@end
@interface ActionStateInit : NSObject <Action>
@end
@protocol StateType <NSObject>
@end
#import "MinReact.h"
@implementation ActionStateInit
@end
@implementation Subscription
@end
@interface Store ()
@mbaranowski
mbaranowski / CylinderViewController.swift
Created January 3, 2018 18:11
Make a Cylinder using SceneKit in swift
//
// GameViewController.swift
// SceneKitTest
//
// Created by Matt Baranowski on 12/19/17.
// Copyright © 2017 Matt Baranowski. All rights reserved.
//
import SceneKit
import QuartzCore
@mbaranowski
mbaranowski / sourcekitten_class_inheritance.jq
Created July 20, 2018 18:24
SourceKitten Class Inheritance JQ script
# run with
# jq -S -f sourcekitten_class_inheritance.jq sourcekitten_doc_output.json > output.json
def splitDotLast: split(".") | .[-1];
def isClassOrExtension(kind):
kind == "class" or kind == "extension" or kind == "protocol";
def isSelected:
isClassOrExtension(.["key.kind"] | splitDotLast)