-
Open the Figma desktop app
-
Go to Plugins > Development > New Plugin > Figma Design > Run Once
This creates a plugin with starter source code to drop five orange rectangles on the canvas -
Setup the plugin:
cd <project-dir>
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
require 'net/smtp' | |
require 'rubygems' | |
require 'tlsmail' | |
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE) | |
class GMailer | |
SMTP_ADDR = 'smtp.gmail.com' | |
def initialize(opts = {}) | |
unless opts[:login] && opts[:password] |
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
module Truncate | |
# only add ellipsis on a word boundary, do not break a word | |
def truncate(char_num) | |
# return a new string | |
self.gsub(/((?:.|\n){#{char_num}}[\w.]*)((?:.|\n)*)/) {$2.empty? ? $1 : $1 + '...'} | |
end | |
end | |
class String | |
include Truncate |
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
How? | |
~$ which rvm | |
~$ alias | grep 'rvm=' | |
~$ rvm --version | |
rvm 0.1.32 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/] | |
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
#import "JPUtils.h" | |
extern void | |
JPUpdateDelegates(id<JPManagerDelegate,JPDeviceDelegate> aDelegate) | |
{ | |
JPManager *manager = [JPManager sharedManager]; | |
[manager setDelegate:aDelegate]; | |
for(JPDevice *dev in [manager connectedDevices]) | |
{ | |
[dev setDelegate:aDelegate]; |
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
// (string, swift, bytes, data, buffer, cstring) | |
print("--- using nulTerminated ---") | |
let x : String = "hello" | |
let buf = x.nulTerminatedUTF8 | |
print(buf) | |
print("\n--- using [UInt8] ---") | |
let buf2 : [UInt8] = [UInt8](x.utf8) | |
print(buf2) |
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 res : __res_9_state = __res_9_state() | |
res_9_ninit(&res) | |
var addr: in_addr = in_addr() | |
inet_aton("224.0.0.251", &addr) | |
res.nsaddr_list.0.sin_addr = addr | |
res.nsaddr_list.0.sin_family = sa_family_t(AF_INET) | |
res.nsaddr_list.0.sin_port = in_port_t(5353).bigEndian | |
res.nscount = 1 |
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
// Start repl with: | |
// $ xcrun swift -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks | |
// Or run as script: | |
// $ xcrun swift -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks % | |
import Foundation | |
if dlopen("/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework/Versions/A/XCTest", RTLD_NOW) == 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
diff --git a/plugin-typings/plugin-api.d.ts b/plugin-typings/plugin-api.d.ts | |
index d299a90..c4ea706 100644 | |
--- a/plugin-typings/plugin-api.d.ts | |
+++ b/plugin-typings/plugin-api.d.ts | |
@@ -12,7 +12,8 @@ declare type ArgFreeEventType = | |
interface PluginAPI { | |
readonly apiVersion: '1.0.0' | |
readonly command: string | |
- readonly editorType: 'figma' | 'figjam' | |
+ readonly editorType: 'figma' | 'figjam' | 'dev' |
Contents of MyApp.swift
import SwiftUI
@main
struct AnimateOnObservedPropertyChangeApp: App {
@State var trigger = false
var body: some Scene {
OlderNewer