Skip to content

Instantly share code, notes, and snippets.

0x53ae257805Bf48B892048a7c24C909a6E9A3B881
@benmorrow
benmorrow / Create iMessage App Sticker Pack Icons.jsx
Last active August 17, 2022 16:05 — forked from progrmr/Create iOS Icons.jsx
A Photoshop script that generates app icons for iMessage apps and sticker packs to use in iOS 10 and Xcode 8.
// Photoshop script that generates app icons for iMessage apps and sticker packs
// to use in iOS 10 and Xcode 8.
//
// This script accepts any image ratio and outputs to many aspect ratios. The
// default background color is white.
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
@benmorrow
benmorrow / db-manager
Created April 21, 2015 17:55
Alternative to NSUserDefaults write/read to filesystem (fix for glances in WatchKit on physical Apple Watch hardware)
var sharedContainerURL = NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier("group.com.company.project")!.URLByAppendingPathComponent("DB.plist")
func retrieve() -> AnyObject? {
if let data = NSData(contentsOfURL: sharedContainerURL) {
if let unarchived: AnyObject = NSKeyedUnarchiver.unarchiveObjectWithData(data) {
return unarchived
}
}
return nil
}
@benmorrow
benmorrow / GradientGenerator.swift
Last active November 18, 2016 18:17
Create a gradient to use as the background. Comes preloaded with many different colors. For any view, this will allow you to insert a sublayer with a multi-color background. Using Swift, iOS 8, and Xcode 6.
//
// GradientGenerator.swift
// WatchSimulator
//
// Created by Ben Morrow on 10/12/14.
//
// The most up-to-date version of this file is hosted at https://gist.github.com/benmorrow/aa3484dd3128875afbc0
//
import UIKit
@benmorrow
benmorrow / gist:5159514
Created March 14, 2013 07:33
Template Preserve Meteor Draggable JQueryUI
Template.item.preserve({
'.draggable': function (node) { return node.id; }
});
@benmorrow
benmorrow / gist:5159470
Created March 14, 2013 07:19
Meteor Template.rendered for JQueryUI Draggable
Template.item.rendered = function () {
var item = Items.findOne(this.data._id);
var item_left = item.left;
var item_top = item.top;
$(this.find('.draggable')).draggable({
cursor: 'move', stop:
function () {
var self = $(this);
Items.update(this._id, {$set: {top: self.css('top'), left: self.css('left')}});
}