Skip to content

Instantly share code, notes, and snippets.

@peterflynn
peterflynn / syntax highlighting test.ts
Created November 13, 2024 20:36
TypeScript syntax highlighting test
function example1<T>(x: any): asserts x is T { }
function example2<T>(x: any): x is T { return true; }
@peterflynn
peterflynn / main.js
Created October 15, 2018 01:36
XD Plugins - part 3 finished code
/*
* Sample plugin code for Adobe XD.
*
* Visit http://adobexdplatform.com/ for API docs and more sample code.
*/
var {Rectangle, Color} = require("scenegraph");
var dialog;
@peterflynn
peterflynn / main.js
Created October 15, 2018 01:30
XD Plugins - part 2 finished code
/*
* Sample plugin code for Adobe XD.
*
* Visit http://adobexdplatform.com/ for API docs and more sample code.
*/
var {Rectangle, Color} = require("scenegraph");
function createRectangle(selection) {
var textNode = selection.items[0];
var fs = require("uxp").storage.localFileSystem;
function loadStyleguideFile(selection) {
return fs.getFileForOpening()
.then(function (file) {
console.log("User chose file: " + file);
return file.read();
})
.then(function (text) {
var json = JSON.parse(text);
@peterflynn
peterflynn / Step 1.js
Last active November 2, 2018 17:22
XD Plugin UI Examples
var dialog;
function createDialog() {
dialog = document.createElement("dialog");
dialog.innerHTML = `
<form method="dialog">
<h1>Hello, world!</h1>
<hr>
<footer>
<!-- Ok button is special: it will automatically close the dialog for us -->
@peterflynn
peterflynn / main.js
Last active October 12, 2018 20:19
XD Starter Plugin
/*
* Sample plugin code for Adobe XD.
*
* Visit http://adobexdplatform.com/ for API docs and more sample code.
*/
var {Rectangle, Color} = require("scenegraph");
function createRectangle(selection) {
// Insert a red square in the current artboard or group/container
diff --git a/Base.lproj/Main.storyboard b/Base.lproj/Main.storyboard
index 5344907..1f78691 100644
--- a/Base.lproj/Main.storyboard
+++ b/Base.lproj/Main.storyboard
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="9060" systemVersion="14F1021" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
+<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
@peterflynn
peterflynn / C++ Pointer Syntax Cheatsheet.cpp
Created September 16, 2015 20:36
C++ Pointer Syntax Cheatsheet
// If "const" is to the LEFT of "*" it applies to the object being pointed at
// If "const" is to the RIGHT of "*" it applies to the variable holding the pointer address
const T* ptr; // object is immutable
T const* ptr; // "
T* const ptr; // 'ptr' cannot be changed to point to a different address, but object is not immutable
// (i.e. the variable is const, not the thing it points to)
const T* const ptr; // object is immutable AND 'ptr' cannot be changed to point to a different address