Skip to content

Instantly share code, notes, and snippets.

View jadnco's full-sized avatar

Jaden Dessureault jadnco

View GitHub Profile
@jadnco
jadnco / sketch-duplicate.sketchplugin
Last active August 29, 2015 14:21
A Sketch plugin that lets you create and specify how many duplicates of a layer you want.
var input = [doc askForUserInput:"Total copies:" initialValue:'']);
var count = parseInt(input);
var quit = input == null;
while (count != count) {
if (quit) break;
input = [doc askForUserInput:"Please enter an actual number for copies:" initialValue:''];
@jadnco
jadnco / truncate.js
Created June 1, 2015 14:59
Handlebars truncate helper method
Handlebars.registerHelper('truncate', function(length, value, opts) {
// Make sure value exists
if (value != null) {
// Don't truncate if already short
if (value.length <= length) {
return value;
}
// Truncate to length and add ellipsis
return value.substring(0, length) + '...';