Instantly share code, notes, and snippets.

View README.md

This is what Craft does:

function loadFramework(pluginRoot) {
  if (NSClassFromString('PanelsManager') == null) {
    var mocha = [Mocha sharedRuntime];
    return [mocha loadFrameworkWithName:'Panels' inDirectory:pluginRoot];
  } else {
    return true;
  }
View sketch-diff-in-git.md

Using sketchtool to diff your .sketch files using text

Requirements

You need to have SketchTool installed somewhere in your path.

Setup

Add this in your ~/.gitconfig file (for some reason, it won't work in a local .gitconfig file):

View gist:9d820e8752cd69b028f0
// Disable all Blurs in document
var doc = context.document,
pages = doc.pages()
for (var i = 0; i < [pages count]; i++) {
var currentPage = [pages objectAtIndex:i]
var all_layers = [currentPage children]
for (var j = 0; j < [all_layers count]; j++) {
var current_layer = [all_layers objectAtIndex:j]
if(current_layer.style != undefined){
View gist:a43325131793f71a7b25
// Show All Layers in All Pages
var doc = context.document,
pages = doc.pages()
for (var i = 0; i < [pages count]; i++) {
var currentPage = [pages objectAtIndex:i]
var all_layers = [currentPage children]
for (var j = 0; j < [all_layers count]; j++) {
var current_layer = [all_layers objectAtIndex:j]
[current_layer setIsVisible:true]
View gist:9a2df820f2422537d5be
function copy_text(txt){
var pasteBoard = [NSPasteboard generalPasteboard]
[pasteBoard declareTypes:[NSArray arrayWithObject:NSPasteboardTypeString] owner:nil]
[pasteBoard setString:txt forType:NSPasteboardTypeString]
}
var s = context.selection[0]
var css = s.CSSAttributeString()
var framerCSS = css.replace("border-radius", "borderRadius")
View gist:b42f78bd61894de79582
13/10/15 23:46:03,067 Framer Studio Beta[48787]: -[NSWindow setTitleVisibility:]: unrecognized selector sent to instance 0x6080001ffc00
13/10/15 23:46:03,068 Framer Studio Beta[48787]: (
0 CoreFoundation 0x00007fff8882525c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff891cee75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8882812d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff88783272 ___forwarding___ + 1010
4 CoreFoundation 0x00007fff88782df8 _CF_forwarding_prep_0 + 120
5 Framer Studio Beta 0x000000010110af46 -[PDDocsWindowController windowDidLoad] + 163
6 AppKit 0x00007fff8caf73ac -[NSWindowController _windowDidLoad] + 450
7 AppKit 0x00007fff8caddfa6 -[NSWindowController window] + 110
View cms.md
View sketch-users-madrid-meetup-talk-ale.md

Supercharging Sketch

(The deck for this transcript is available at https://speakerdeck.com/bomberstudios/supercharging-sketch)

When Sketch 1 came out, 5 years ago, I remember spending a few minutes playing with it and thinking "this could totally replace Fireworks" (my weapon of choice at the time). I sent Pieter an email to tell him how excited I was about the app, and while writing it I thought "you know what? This thing would be awesome if it was scriptable"

This is the email I sent him:

screen shot 2015-09-15 at 08 23 09

View restore-colours.sh
mv ~/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application\ Support/com.bohemiancoding.sketch3/assets-55.sketchpreset ~/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application\ Support/com.bohemiancoding.sketch3/assets-55.sketchpreset.old
cp /Applications/Sketch.app/Contents/Resources/assets.sketchpreset ~/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application\ Support/com.bohemiancoding.sketch3/assets-55.sketchpreset
View svgmin.sh
# Cleanup SVG files exported from Sketch
# Needs SVGO (install by running 'npm install -g svgo')
if [[ -d $1 ]]; then
svgo -f $1 --pretty --disable=convertShapeToPath --enable=removeTitle --enable=removeDesc --enable=removeDoctype --enable=removeEmptyAttrs --enable=removeUnknownsAndDefaults --enable=removeUnusedNS --enable=removeEditorsNSData
elif [[ -f $1 ]]; then
svgo -i $1 --pretty --disable=convertShapeToPath --enable=removeTitle --enable=removeDesc --enable=removeDoctype --enable=removeEmptyAttrs --enable=removeUnknownsAndDefaults --enable=removeUnusedNS --enable=removeEditorsNSData
else
echo "Usage: svgmin <file> or svgmin <folder>"
fi