Skip to content

Instantly share code, notes, and snippets.

View nevyn's full-sized avatar

Nevyn Bengtsson nevyn

View GitHub Profile
@nevyn
nevyn / output.txt
Created December 13, 2015 02:24
full output of pod spec lint --verbose
➜ MeshPipe (master) ✗ pod spec lint --no-clean --verbose MeshPipe.podspec
MeshPipe (0.1.0) - Analyzing on iOS 7.0 platform.
Preparing
[!] Unable to load a specification for the plugin `/Library/Ruby/Gems/2.0.0/gems/cocoapods-try-release-fix-0.1.2`
Analyzing dependencies
Fetching external sources
-> Fetching podspec for `MeshPipe` from `/Users/nevyn/Dev/CoreDragon/Libraries/MeshPipe/MeshPipe.podspec`
Pod::Spec.new do |s|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.name = "MeshPipe"
s.version = "0.1.0"
s.summary = "IPC library for iOS"
s.description = <<-DESC
MeshPipe is an IPC (inter-process communication) library for iOS using UDP networking.
It allows multiple running applications on a single iOS device to send arbitrary data to each other.
@nevyn
nevyn / after.m
Created December 11, 2015 19:09
Use loops instead of copy pasting
for(NSString *when in @[@"will", @"did"]) {
[_output writeRowWithValues:@[ // COLUMNS:
[NSString stringWithFormat:@"%.4f", [_output currentSessionTime]], // Time
type, // {interface|device}
when, // {will|did}
[NSString stringWithFormat:@"%d", newDegrees], // newOrientationInDegreesWhere0IsPortrait
[NSString stringWithFormat:@"%.2f", duration], // transitionDurationForInterfaceRotation
]];
}
import <UIKit/UIKit.h>
@interface UIControl (GFNextResponder)
@property(nonatomic, unsafe_unretained) IBOutlet UIControl *gf_nextResponder;
@end
@nevyn
nevyn / GFASLProxy.m
Created November 30, 2015 23:41
Capturing ASL on Mac/iOS
// See also https://github.com/CocoaLumberjack/CocoaLumberjack/blob/master/Classes/DDASLLogCapture.m
#import "GFASLProxy.h"
#include <asl.h>
#include <notify.h>
#include <notify_keys.h>
#include <sys/time.h>
@implementation GFASLProxy
// Wrong: Both synchronous and asynchronous errors
function Thing(a, b, c) {
if(!a)
throw "missing argument";
return Promise(...)
}
try {
yay = Thing(...).catch(function() {
console.log("Hello AwsStorageAdapter.coffee!!");
Interface = require("../../Interface/storage.coffee")
class AWSStorageAdapter extends Interface.Storage
Path = require 'path'
AWS = require 'aws-sdk'
...
class Foo : NSObject {
class func shared() -> Foo {
return Foo()
}
func foo() -> String {
return "hello"
}
}
#!env NODE_PATH=/usr/local/lib/node_modules node --harmony
var Promise = require("bluebird")
var b = Promise.method(function() {
throw new Error("omg");
return "b";
})
var a = Promise.coroutine(function *() {
@nevyn
nevyn / GFStuffMovingAroundViewController.swift
Created September 30, 2015 18:36
View controller to get stuff moving around on screen :D Demo video: https://lookback.io/watch/TouJLFvYCs9Kyd9XC
//
// GFStuffMovingAroundViewController.swift
// GFTest
//
// Created by Nevyn Bengtsson on 2015-09-10.
// Copyright © 2015 Lookback AB. All rights reserved.
//
import UIKit