Skip to content

Instantly share code, notes, and snippets.

View dtrenz's full-sized avatar
🤡

Dan Trenz dtrenz

🤡
  • Detroit Labs
  • Ann Arbor, MI USA
View GitHub Profile
@dtrenz
dtrenz / Example.swift
Last active February 3, 2016 21:17
A Swift 2 error throwing example.
typealias CustomErrorType = protocol<ErrorType, CustomStringConvertible>
struct Example {
enum Error: CustomErrorType {
case ZombieApocalypse
case RobotOverlords
case Cthulhu
@dtrenz
dtrenz / DTCustomFormatter.h
Created January 14, 2016 16:53
Custom formatter for CocoaLumberjack to get XCGLogger (https://github.com/DaveWoodCom/XCGLogger) style log messages w/ log level, thread, file name, line #, & method name.
#import "DDLog.h"
@interface DTCustomFormatter : NSObject <DDLogFormatter>
@end
@dtrenz
dtrenz / xcodebuild.rb
Created March 5, 2015 22:50
xcodebuild fastlane action [WIP]
module Fastlane
module Actions
module SharedValues
XCODEBUILD_ARCHIVE = :XCODEBUILD_ARCHIVE
end
# xcodebuild man page:
# https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html
class XcodebuildAction
@dtrenz
dtrenz / app.js
Created March 19, 2014 21:51
Example node + socket.io chat app using express.
#!/usr/bin/env node
var express = require('express');
var app = express();
var server_port = process.env.PORT || 5000;
var server = require('http').createServer(app);
var io = require('socket.io').listen(server);
var users = {};
server.listen(server_port);
@dtrenz
dtrenz / composer.json
Created March 3, 2014 20:49
Laravel 4.1 + Behat/Mink
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.1.*"
},
"require-dev": {
"behat/behat": "2.5.*",
@dtrenz
dtrenz / AddressBook.php
Created December 17, 2013 20:36
Using traits to handle service container.
<?php
class AddressBook {
use ServiceConsumer;
public function findContactByEmail($email)
{
// get database connection
$db = $this->container['database'];
@dtrenz
dtrenz / copy-rest-api-postman.json
Created November 5, 2013 15:08
Copy REST API Postman Collection
{
"id": "c64a107a-39ab-27b4-9c37-d93b1e187589",
"name": "Copy API (REST)",
"description": "## API Calls\n\nThis is the meat and potatoes of this document. Here we'll discuss the various API calls you can make to our servers, along with what inputs we require, and what outputs you can expect back, and the required permissions to perform the request. Since this is a RESTful JSON API, you will need to know the URLs ahead of time.\n\nIn the URLs of the sample requests, words that appear in all CAPITAL letters represent the part of the URL which is meant to be changed by you, the developer, depending on the intention of your request.\n\n##### Request Headers\n\nYou will need to provide the following two HTTP request headers while talking to the Copy API:\n\n* **X-Api-Version**: 1\n* **Accept**: application/json\n\n##### Response Headers\n\nHere's a list of some typical response headers to expect from our server, most of which can be ignored.\n\n* **Access-Control-Allow-Headers**: X-AUTHORIZATION-ANON,