Skip to content

Instantly share code, notes, and snippets.

View johndpope's full-sized avatar

John D. Pope johndpope

View GitHub Profile
@johndpope
johndpope / Dockerfile
Last active October 21, 2016 18:29 — forked from djtfmartin/Dockerfile
Base swift3 dockerfile
FROM swiftdocker/swift
MAINTAINER John Pope <jp@fieldstormapp.com>
RUN apt-get update && apt-get -y install openssh-server supervisor
RUN mkdir /var/run/sshd
RUN echo 'root:password' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
# -*- coding: utf-8 -*-
#
# Some gems cannot/should not be installed on heroku and/or travis, but
# `bundle --without` cannot be used. Put these gems into group :development
# in such situations
is_travis = !!ENV['TRAVIS']
# should work until heroku changes the HOME directory location
is_heroku = ['/app/','/app'].include?(ENV['HOME']) # ENV['HOME'] = '/app' in rails console or rake
therubyracer_group = (is_travis || is_heroku) ? :development : :assets
sqlite3_group = is_heroku ? :development : :sqlite3
- (UIImage *)pointillizedImageFromImage:(UIImage *)image withPointDiameter:(CGFloat)diameter
{
CGFloat width = image.size.width;
CGFloat height = image.size.height;
CGImageRef inImage = [image CGImage];
CFDataRef m_dataRef = CGDataProviderCopyData(CGImageGetDataProvider(inImage));
UInt8* m_pixelBuf = (UInt8*)CFDataGetBytePtr(m_dataRef);
UIGraphicsBeginImageContextWithOptions(image.size, YES, 0);
@johndpope
johndpope / RemoveATSExceptions.sh
Created December 22, 2016 04:17 — forked from Ashton-W/RemoveATSExceptions.sh
Xcode Build Phase Script to remove NSAppTransportSecurity from the Info.plist based on the custom REMOVE_ATS_EXCEPTIONS build setting.
#!/usr/bin/env bash
# Build Phase Script for removing NSAppTransportSecurity exceptions from Info.plist
# https://gist.github.com/Ashton-W/07654259322e43a2b6a50bb289e72627
set -o errexit
set -o nounset
if [[ -z "${REMOVE_ATS_EXCEPTIONS+SET}" ]]; then
echo "error: User Defined Build Setting REMOVE_ATS_EXCEPTIONS must be set"
exit 1
/*
ericasadun.com
Sometimes letting go doesn't mean saying goodbye
*/
prefix operator ++
prefix operator --
postfix operator ++
/*
ericasadun.com
Sometimes letting go doesn't mean saying goodbye
*/
prefix operator ++
prefix operator --
postfix operator ++
@johndpope
johndpope / AngleTypes.swift
Created May 21, 2017 02:16 — forked from jcampbell05/AngleTypes.swift
This was the only way I could create units in Swift and mimic a generic number system as well.
//
// AngleTypes.swift
// Sup
//
// Created by James Campbell on 22/12/2015.
// Copyright © 2015 Sup. All rights reserved.
//
// This File defines representations of Degrees and Radians as Type Safe Alogrithm Types
import Foundation
@johndpope
johndpope / Header.swift
Last active May 22, 2017 17:58 — forked from alonecuzzo/Header.swift
Get HeaderView Sized with SnapKit
//
// ViewController.swift
// SnapKitTest
//
// Created by Robert Payne on 10/11/15.
// Copyright © 2015 Zwopple Limited. All rights reserved.
//
import SnapKit
import UIKit
@johndpope
johndpope / IO.swift
Created May 27, 2017 00:14 — forked from alecthomas/IO.swift
Swift IO
//
// Swift.IO
//
// Created by Alec Thomas on 25/02/2015.
// Copyright (c) 2015 SwapOff. All rights reserved.
//
//
// This file provides a consistent, simple interface to stream-based data sources.
// It is based on Go's I/O library.
//
@johndpope
johndpope / IO.swift
Last active May 27, 2017 00:24 — forked from alecthomas/IO.swift
Swift IO
//
// Swift.IO
//
// Created by Alec Thomas on 25/02/2015.
// Updated by Tommie N. Carter, Jr., MBA on 2/12/16.
// Copyright (c) 2015 SwapOff. All rights reserved.
//
//
// This file provides a consistent, simple interface to stream-based data sources.
// It is based on Go's I/O library.