This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |