Code Monkey home page Code Monkey logo

drafts_to_gist's Introduction

Drafts App Action: Create Gist

A Drafts App URL action combined with a python script for creating quick gists on iOS.

Requirements

Installation

Step 1: Create GitHub OAuth token

Since this script runs on an iOS app, a GitHub OAuth token must be created prior to use. It's easy to create a token using curl from the terminal. Make sure to add your GitHub username to the following command:

curl https://api.github.com/authorizations \
--user "YOUR_GITHUB_USERNAME" \
--data '{"scopes":["gist"],"note":"Drafts"}'

Edit DraftsGist.py

The response will contain a line: "token" : foo where foo is the token string. Add the token to line 14.

There is also an option for creating public or private gists on line 17.

You can verify the token is enabled at: https://github.com/settings/applications

##Step 2: Create a Drafts URL Action

Paste the following URL into Mobile Safari to a create an URL action in Drafts:

drafts://x-callback-url/import_action?type=URL&name=Gist&url=pythonista%3A%2F%2FDraftsGist%3Faction%3Drun%26args%3D%2522%5B%5Btitle%5D%5D%2522%2520%2522%5B%5Bbody%5D%5D%2522

Or manually create a URL Action:

pythonista://DraftsGist?action=run&args=%22[[title]]%22%20%22[[body]]%22

Step 3: Create Pythonista Script

Paste the contents of Drafts.py into a new Pythonista file. It must have the title: DraftsGist.

Using The Drafts Action.

Easy peasy. Format your note as such:

This is the first line of the note and the gist's title
Everything else is the content of the note. This is the 1st paragraph.

Line breaks are preserved.

This will be the third paragraph of the note.

Use the Gist action to send the note to Pythonista. Once gist is created, a web browser will open to show the raw contents of the gist.

drafts_to_gist's People

Contributors

chewingpencils avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

rayyan imclab

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.