Skip to content

Instantly share code, notes, and snippets.

View PaulWoodIII's full-sized avatar

Paul Wood III PaulWoodIII

View GitHub Profile
@PaulWoodIII
PaulWoodIII / Serializable.swift
Last active February 3, 2016 19:26 — forked from anaimi/Serializable.swift
Serialize a Swift object to JSON or Dictionary, with selective properties.
/**
Purpose:
Convert (or Serialize) an object to a JSON String or Dictionary.
Usage:
Use 'Serialize.toJSON' on instances of classes that:
- Inherit from NSObject
- Implement 'Serializable' protocol
- Implement the property 'jsonProperties' and return an array of strings with names of all the properties to be serialized
Inspiration/Alternative:
https://gist.github.com/anaimi/ad336b44d718430195f8
@PaulWoodIII
PaulWoodIII / UIImage+Trim.m
Last active December 29, 2015 09:49 — forked from spinogrizz/UIImage+Trim.m
adjusted to scale
- (UIImage *) imageByTrimmingTransparentPixels {
//adjust to scale
int rows = self.size.height * self.scale;
int cols = self.size.width * self.scale;
int bytesPerRow = cols*sizeof(uint8_t);
if ( rows < 2 || cols < 2 ) {
return self;
}
#!/bin/bash
# <UDF name="ssh_key" Label="Paste in your public SSH key" default="" example="" optional="false" />
# root ssh keys
mkdir /root/.ssh
echo $SSH_KEY >> /root/.ssh/authorized_keys
chmod 0700 /root/.ssh
# update to latest