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
| let sketch = require('sketch') | |
| let Rectangle = sketch.Rectangle | |
| let ShapePath = sketch.ShapePath | |
| let Style = sketch.Style | |
| let Group = sketch.Group | |
| let document = sketch.getSelectedDocument() | |
| let selection = document.selectedLayers.layers[0] | |
| let nativeSelection = selection.sketchObject |
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
| // Update color descriptions to include rgb code | |
| let paintStyles = figma.getLocalPaintStyles() | |
| paintStyles.forEach(paintStyle=>{ | |
| let color = paintStyle.paints[0].color | |
| let description = `rgb(${(color.r*256).toFixed(0)},${(color.g*256).toFixed(0)},${(color.b*256).toFixed(0)})` | |
| paintStyle.description = description | |
| }) |
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
| import os,json,pyexiv2 | |
| from datetime import datetime | |
| keypath = 'fbexport/' | |
| path_to_album= keypath+'posts/album/' | |
| json_files = [pos_json for pos_json in os.listdir(path_to_album) if pos_json.endswith('.json')] | |
| for album_json in json_files: | |
| with open(path_to_album+album_json) as f: |
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
| function onLoad() | |
| deck = getObjectFromGUID("72a19d") | |
| cards = deck.getObjects() | |
| pos = deck.getPosition() | |
| for index,card in ipairs(cards) do | |
| -- We need to wait each time we pull out a card | |
| -- The amount we wait is increased for each pull | |
| -- Need to handle the last card since the deck doesn't exist at that point | |
| Wait.frames(function() |
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
| let selection = context.selection[0] | |
| let data = selection.image().data() | |
| let imageRep = NSBitmapImageRep.imageRepWithData(data) | |
| let color = imageRep.colorAtX_y(1,2) | |
| console.log(MSColor.colorWithNSColor(color).CSSAttributeString()) |
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
| // { | |
| // properties: [string], | |
| // property1: { name: string, variants: [string] }, | |
| // property2: { name: string, variants: [string] }, | |
| // ... | |
| // } | |
| function getVariantMetaData(componetSet) { | |
| let variants = componetSet.children |
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
| let selection:FrameNode = figma.currentPage.selection[0] | |
| for (let i=400;i<selection.children.length;i++){ | |
| console.log("hello") | |
| createComponentsForChild(selection.children[i],i) | |
| } | |
| function createComponentsForChild(child:FrameNode,index) { | |
| console.log(child) | |
| let glyphs = figma.currentPage.findAll(n=>n.name==child.name) | |
| let components:Array<ComponentNode> = [] |
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
| let sketch = require('sketch') | |
| let ShapePath = sketch.ShapePath | |
| let doc = sketch.getSelectedDocument() | |
| let selectedArtboard = doc.selectedLayers.layers[0] | |
| let pasteboard = NSPasteboard.generalPasteboard() | |
| let items = pasteboard.pasteboardItems() | |
| let urls = pasteboard.readObjectsForClasses_options([NSURL.class()],nil) | |
| for (let i=0;i<urls.count();i++) { |
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
| let sketch = require('sketch') | |
| let pasteboard = NSPasteboard.generalPasteboard() | |
| let pboardManager = MSPasteboardManager.applicationPasteboardManager() | |
| let pboardLayers = pboardManager.readPasteboardLayersFromPasteboard_colorSpace_options_convertColorSpace(pasteboard,context.document.colorSpace(),nil,false) | |
| let layerArray = pboardLayers.layers().layers() | |
| let nativeLayers = [] | |
| for (let i=0; i<layerArray.count(); i++) { | |
| nativeLayers.push(layerArray[i]) | |
| } |
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
| let path = NSHomeDirectory() + '/Library/Logs/DiagnosticReports/' | |
| let fileManager = NSFileManager.defaultManager() | |
| let files = fileManager.contentsOfDirectoryAtPath_error(path,nil) | |
| let fileNames = [] | |
| for (let i=0; i<files.count();i++) { | |
| fileNames.push(files[i]) | |
| } | |
| let dateFormatter = NSDateFormatter.alloc().init() | |
| dateFormatter.dateStyle = NSDateFormatterMediumStyle |