Skip to content

Instantly share code, notes, and snippets.

View Goos's full-sized avatar

Robin Goos Goos

  • Envoy
  • On the road
View GitHub Profile
@Goos
Goos / convert.py
Last active August 25, 2021 23:45
import sys, getopt, os
from osgeo import ogr, gdal
def main(argv):
inputfile = ''
outputfile = ''
point = ''
try:
opts, args = getopt.getopt(argv, "hi:o:p:", ["input=", "output=", "point="])
except getopt.GetoptError:
@Goos
Goos / Task.swift
Last active July 10, 2018 18:21
Functional playground
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
import UIKit
func bind<T, U, V>(_ first: (T) -> U, _ second: (U) -> V) -> (T) -> V {
return { (input: T) in
let res = first(input)
return second(res)
@Goos
Goos / asset_identifiers.rb
Last active August 29, 2015 14:22
A hacky script that takes .xcassets directories and produces a Swift file defining an enum with a case for each image in the asset directories, as well as an UIImage convenience initializer that takes said enum as an argument instead of a string. This enables compiler-checked UIImage initialization returning non-optional images. Inspired by the …
require "pathname"
class XCAsset
def initialize(path, is_root)
@path = path
@is_root = is_root
name = @path.split.last
@is_container = !(name.to_s =~ /\.imageset$/)
@Goos
Goos / MKPolygon+Containment.h
Last active January 22, 2017 22:25
A category for checking whether or not an MKPolygon contains a point or coordinate.
//
// MKPolygon+Containment.h
// Pods
//
// Created by Robin Goos on 28/04/15.
//
//
#import <MapKit/MapKit.h>
@Goos
Goos / GOFilteringURLCache.h
Last active October 2, 2018 19:31
An NSURLCache subclass supporting block-based filters.
#import <Foundation/Foundation.h>
@interface GOFilteringURLCache : NSURLCache
- (void)addFilterForURL:(NSURL *)URL response:(NSCachedURLResponse *(^)(NSURLRequest *request))responseBlock;
- (void)removeFiltersForURL:(NSURL *)URL;
@end
@Goos
Goos / UIView+PresentationLayerHitTesting.h
Last active August 29, 2015 14:02
A category for dynamically overriding -hitTest:withEvent: on UIView, in order to enable interaction with views during animations.
//
// UIView+EnableUserInteraction.h
// Pods
//
// Created by Robin Goos on 06/06/14.
//
//
#import <UIKit/UIKit.h>
@Goos
Goos / gist:b31f6b21660aa092e6c2
Last active August 29, 2015 14:02
DateAdditions.swift
//
// DateAdditions.swift
// OMGSWIFT
//
// Created by Robin Goos on 03/06/14.
// Copyright (c) 2014 OMG. All rights reserved.
//
import Foundation
@Goos
Goos / TypedJavascript.js
Last active January 2, 2016 18:29
A quick, dirty and probably slow implmentation of javascript-inheritance with type-checks through custom [gs]etters
function realTypeName (obj) {
if (obj === null) {
return "null";
}
if (obj === void(0)) {
return "undefined";
}
var t = typeof obj;
switch(t) {
case "function":
@Goos
Goos / jshoop.js
Created June 4, 2013 08:34
JShoop.js - gradient mapping images with canvas
(function (JShoop, $, window) {
function test_origin(url) {
var loc = window.location,
a = document.createElement('a');
a.href = url;
var cors = (a.hostname == loc.hostname &&
a.port == loc.port &&
@Goos
Goos / NSObject+EventEmitter.h
Last active December 16, 2015 01:49
Javascript-style events in cocoa
//
// NSObject+EventEmitter.h
// Sandbox
//
// Created by Robin Goos on 4/10/13.
// Copyright (c) 2013 Goos. All rights reserved.
//
#import <Foundation/Foundation.h>