This file contains 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
// (shift cmd c) | |
// This plugin copies FramerJS boiler plate code for the currently selected layer. | |
// Example: | |
/* | |
# Import Table Cell from Sketch | |
tableCell = layers.Table_Cell |
This file contains 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
// get text styles | |
var text_styles_library = doc.documentData().layerTextStyles().objectsSortedByName(); | |
// apply the style to the selected text layer | |
selection[0].setStyle(text_styles_library[0]); | |
// => Result: [MSSharedLayerStyle reflection]: unrecognized selector sent to instance |
This file contains 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
var request = require('request'), | |
query = require('querystring'), | |
args = require('optimist'). | |
options('key', { alias: 'k' }). | |
options('secret', { alias: 's' }). | |
options('signature', { alias: 'm', default: "HMAC-SHA1" }). | |
argv; | |
var options = { | |
url: 'https://secure.splitwise.com/api/v3.0/get_request_token', |
This file contains 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
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"2.0.3",function($,L){ | |
// speak current webpage | |
// jhobbs 2013 | |
// chunking by getflourish 2015 | |
function stop(){ | |
speechSynthesis.cancel(); |
This file contains 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
// (cmd shift b) | |
// set the scope to the layer group that the currently selected layer is in | |
var scope = selection[0].parentGroup().layers().array(); | |
// calculate the bottom position of the selected layer | |
var bottom = selection[0].absoluteRect().y() + selection[0].absoluteRect().height(); | |
// set up the predicate and receive an array of matched layers | |
var predicate = NSPredicate.predicateWithFormat("absoluteRect.y > %@", bottom); |
This file contains 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
var doc = context.document; | |
var layer = context.selection[0] | |
var style = layer.style().textStyle() | |
var scope = context.document.currentPage().children(); | |
selectLayersByTextStyle(style, scope) | |
function selectLayersByTextStyle(textStyle, scope) { | |
var predicate = NSPredicate.predicateWithFormat("(style.textStyle != NULL) && (style.textStyle isEqualForSync:%@)", textStyle); |
This file contains 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
var textStyle = context.selection[0].style().textStyle(); | |
var predicate = NSPredicate.predicateWithFormat("(style.textStyle != nil) && [style.textStyle isEqualForSync:%@ asPartOfSymbol:nil]", textStyle); | |
context.document.currentPage().children().filteredArrayUsingPredicate(predicate); | |
// error: Unable to parse the format string "(style.textStyle != nil) && [style.textStyle isEqualForSync:%@ asPartOfSymbol:nil]" |
This file contains 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
{ | |
"Menu": { | |
"statusbar-time": "12:30", | |
"profile-email": "heyfromjonathan@gmail.com", | |
"label-forums": "Forums", | |
"label-updates": "Updates", | |
"label-promos": "Promos", | |
"label-purchases": "Purchases", | |
"label-social": "Social", | |
"label-spam": "Spam", |
This file contains 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
for (var i = 0; i < context.selection.count(); i++) { | |
var layer = context.selection[i]; | |
var name = layer.name(); | |
layer.setName(name.replace("Schwarz", "Orange")); | |
} |
This file contains 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
for (var i = 0; i < context.selection.count(); i++) { | |
var layer = context.selection[i]; | |
var textLayer = layer.children().objectAtIndex(0) | |
var char = "" + i; | |
textLayer.setStringValue(char) | |
} |