36
Scrippets What they are and how they work

Scrippets — the way to refine Snippets Application

Embed Size (px)

Citation preview

Page 1: Scrippets — the way to refine Snippets Application

ScrippetsWhat they are and how they work

Page 2: Scrippets — the way to refine Snippets Application

Code Snippets

HTML

CSS …

SQL

Pieces of re-usable code

<body> <div id="page-wrap"> <!-- general HTML here --> </div></body>

#page-wrap { width: 800px; margin: 0 auto;}

Centered Webpage

Page 4: Scrippets — the way to refine Snippets Application

Snippets AppSupported features

✓ Syntax highlighting ✓ Smart groups✓ Folders✓ Labels✓ Quick search✓ Menu bar integration

Page 5: Scrippets — the way to refine Snippets Application

• Collect• Edit• Manage• Copy• Paste

• Search• Sync• Export• Import• Share

What do we want to do with snippets?

Page 6: Scrippets — the way to refine Snippets Application

✓ Collect✓ Edit✓ Manage✓ Copy✓ Paste

✓ Search✓ Sync• Export• Import✗ Share

✓ Fully Implemented • Partially implemented ✗ Not implemented

Snippets AppWe’re almost there

Page 7: Scrippets — the way to refine Snippets Application

✓ Source code✓ PDF✓ RTF✓ HTML*

✓ HTML+CSS*

Export

✓ * — in development

Page 8: Scrippets — the way to refine Snippets Application

✓ Source code✓ PDF✓ RTF✓ HTML*

✓ HTML+CSS*

✗ XML✗ ZIP✗ FTP✗ Web✗ etc.

Export

✓ * — in development

?

Page 9: Scrippets — the way to refine Snippets Application

✓ Pasteboard✓ Selection✓ File system✓ iDisk

Import

Page 10: Scrippets — the way to refine Snippets Application

✓ Pasteboard✓ Selection✓ File system✓ iDisk

✗ XML✗ ZIP✗ FTP✗ Web✗ etc.

Import

?

Page 12: Scrippets — the way to refine Snippets Application

Conclusion

It’s almost impossible to cover all use cases by

standalone features…

Page 13: Scrippets — the way to refine Snippets Application

How to implement advanced Export,

Import and Sharing?

Here’s the challenge we’re facing

Problem

Page 14: Scrippets — the way to refine Snippets Application

Fact

Export, Import and Sharing have something in common

Page 15: Scrippets — the way to refine Snippets Application

Export, Import and Sharing have something in common

These are custom operations on snippets

Fact

Page 16: Scrippets — the way to refine Snippets Application

SolutionOffered by the Snippets App

Provide a platform to run custom operations on selected snippets!

Page 17: Scrippets — the way to refine Snippets Application

Example

1 Select snippets

How to share via Snipplr

Page 18: Scrippets — the way to refine Snippets Application

Example

1 Select snippets 2 Enter API Key

827364827301

How to share via Snipplr

User-speci!c string provided by the Snipplr service to allow authorized API-requests

Page 19: Scrippets — the way to refine Snippets Application

Example

1 Select snippets 2 Enter API Key

827364827301

3 Upload snippets

Script

How to share via Snipplr

Page 20: Scrippets — the way to refine Snippets Application

Example

1 Select snippets 4 Display links

snipplr.com/?id=1snipplr.com/?id=2snipplr.com/?id=3snipplr.com/?id=4

2 Enter API Key

827364827301

3 Upload snippets

Script

How to share via Snipplr

Page 21: Scrippets — the way to refine Snippets Application

Example

Custom operations

1 Select snippets 2 Enter API Key

827364827301

3 Upload snippets

Script

4 Display links

How to share via Snipplr

snipplr.com/?id=1snipplr.com/?id=2snipplr.com/?id=3snipplr.com/?id=4

Page 22: Scrippets — the way to refine Snippets Application

Example

Custom operations

HTML+JavaScript

+CSS

Ruby(Perl, Bash,

Python)

HTML+JavaScript

+CSS

1 Select snippets 2 Enter API Key

827364827301

3 Upload snippets

Script

4 Display links

How to share via Snipplr

snipplr.com/?id=1snipplr.com/?id=2snipplr.com/?id=3snipplr.com/?id=4

Page 23: Scrippets — the way to refine Snippets Application

Example

4 Display links2 Enter API Key 3 Upload snippets

input.htmlStep 1:

Authorization

uploader.rbStep 2:

Uploading

output.htmlStep 3:Result

Custom Steps

1 Select snippets

How to share via Snipplr

Page 24: Scrippets — the way to refine Snippets Application

input.htmlStep 1:

Authorization

uploader.rbStep 2:

Uploading

output.htmlStep 3:Result

Scrippet

Snippets AppProvides a mechanism to run any number of steps as…

Page 25: Scrippets — the way to refine Snippets Application

ScrippetCollection of scripts and resources

<html lang="en"><head>! <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>

<input></input></body></html>

require 'net/http'require 'uri'

snipplr_url = Net::HTTP.post_form(url, parameters).body.match(/href="([^\"]+)"/)[1]snipplr_url = snipplr_url.gsub…

<html lang="en"><head>! <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>

<div></div></body></html>

input.html uploader.rb output.html

+ +

Scripts + Resources = Scrippet

Page 26: Scrippets — the way to refine Snippets Application

ScrippetCan be developed to automate

almost any task you want

✓ Export✓ Import✓ Share✓ Backup

✓ Tweet✓ Transform✓ Evaluate✓ Run

Page 27: Scrippets — the way to refine Snippets Application

info.plist

ScrippetIncludes property list describing

all steps to perform

<Scrippet><Name>Share via Snipplr.com</Name><Icon>snipplr.png</Icon><Steps>

<Step><Name>Security Options</Name><Source>input.html</Source>

</Step><Step>

<Name>Uploading…</Name><Source>uploader.rb</Source>

</Step><Step>

<Name>Result</Name><Source>output.html</Source>

</Step></Steps>

</Scrippet>

input.html uploader.rb output.html

scrippet.js default.css snipplr.png

SAa

</> </>

Page 28: Scrippets — the way to refine Snippets Application

ScrippetIs a folder with .scrippet extension

Snipplr.scrippet/ Contents

info.plist/ Resources

/ input.html/ uploader.rb/ output.html/ scrippet.js/ default.css/ snipplr.png

root of the package

property list

UI for the 1st step script for the 2nd step UI for the 3rd step scrippet APIs CSS styles

icon image

Page 29: Scrippets — the way to refine Snippets Application

ScrippetsAre recognized by Mac OS X as Bundles

Snipplr

Snipt.org …

Pastie

Page 31: Scrippets — the way to refine Snippets Application

You can develop them

Scrippets

Developers

Page 32: Scrippets — the way to refine Snippets Application

Easy to share over the internet

Scrippets

Developers Internet

Page 33: Scrippets — the way to refine Snippets Application

Everyone can use them

Scrippets

Happy usersDevelopers Internet

Page 34: Scrippets — the way to refine Snippets Application

What’s Next

Happy usersDevelopers Internet

Easy & powerful APIs will be

published soon

Public scrippet database is in development*

Pastie, Snipplr, Snipt.org scrippets are available now;

more in development

✓ * — all scrippets will be tested for security before publishing

Page 35: Scrippets — the way to refine Snippets Application

Summary✓ Snippets application is a cool code

manager for Mac OS X

✓ Now we have universal solution for extending its functionality

✓ Scrippets let you create powerful custom scenarios

✓ Everybody can develop and use them