Skip to content

Instantly share code, notes, and snippets.

View fousa's full-sized avatar

Jelle Vandebeeck fousa

View GitHub Profile
@namannik
namannik / MGLMapView+MBTiles.swift
Last active April 10, 2024 16:28
MGLMapView+MBTiles
import Foundation
import Mapbox
import SQLite
// MARK: MbtilesSource
enum MBTilesSourceError: Error {
case CouldNotReadFileError
case UnknownFormatError
case UnsupportedFormatError
@Inferis
Inferis / ViewController.swift
Last active December 1, 2019 23:27
Beginnings of a GCD wrapper in swift
import UIKit
import QuartzCore
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel
@IBOutlet weak var counter: UILabel
override func viewDidLoad() {
super.viewDidLoad()
#! /usr/bin/env ruby
require "yaml"
require "pathname"
banner = <<BANNER
Looks for a config/database.yml file and supplies the command to get a
database dump/import. (mysql or postgres)
dumper <rails_env>
@Inferis
Inferis / CommonMacros.h
Last active February 5, 2018 03:01
Common Macros for Xcode projects.
//
// CommonMacros.h
// Created by Tom Adriaenssen (@inferis)
// Inspired by the awesome work by Piet Jaspers (@pjaspers)
//
/*
* How to use this file:
* 1. Find your .pch file
* 2. Import this file
@rais38
rais38 / gist:5766980
Created June 12, 2013 16:35
Create patch from stash
git stash show -p stash@{0} > Stash0.patch
@fousa
fousa / content.m
Created July 25, 2012 22:11
Obj-C Save Block
typedef void(^MyBlock)(void);
MyBlock savedBlock = ^ {
// Executed block
};
@fousa
fousa / content.m
Created July 23, 2012 21:24
NSNumber to NSData
NSUInteger index = 999;
NSData *payload = [NSData dataWithBytes:&index length:sizeof(index)];
@fousa
fousa / content.m
Created July 23, 2012 18:17
Localize NSError
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
[userInfo setObject:@"You are not authenticated." forKey:NSLocalizedDescriptionKey];
NSError *error = [NSError errorWithDomain:@"mydomain" code:0 userInfo:userInfo];
@fousa
fousa / content.m
Created July 18, 2012 19:01
AFNetworking Reachability
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://www.apple.com"]];
[client setReachabilityStatusChangeBlock:^(BOOL isNetworkReachable) {
NSLog(@"Reachable %i", isNetworkReachable);
}];
@fousa
fousa / content.rb
Created July 18, 2012 09:22
Nested Resource Routes
resources :zones do
resources :users, :module => "zones"
end