Alfred Workflow - Gist
A workflow for Alfred to create Gists from your clipboard contents or selected files.
Requirements
- Alfred Version 2.
- The Alfred Powerpack.
- A GitHub account.
- Gist.alfredworkflow.
Setup
This workflow requires API access to gist.github.com. This requires a personal access token. Follow these steps to create and configure this token into the workflow.
- Go to Personal access tokens in your account settings.
- Click Generate New Token.
- Enter in a reasonable token description such as 'Alfred Gist Workflow'.
- Ensure that the only selected scope is 'gist'.
- Click 'Generate Token'.
- Copy the newly generated token to your clipboard.
- In Alfred, type
gistconfig
and select the 'Your API access token is' line to set your token.
It should look something like this:
Configure
Type gistconfig
to view the existing configuration or change them. When
changing the token and server the value is taken from the clipboard.
If you want to share your configuration across multiple machines (ie. via Dropbox) you can provide a shared configuration directory. This directory must exist before setting it via the configuration.
Help
Type gist help
to view this help. If you need more help
open an issue and I'll see what I can do.
Usage
Files
If activated as a file action, the contents of the selected file(s) will be gisted using whatever public/private setting is currently in effect.
Clipboard Contents
Public/private gists:
gist private
- a private gist.gist public
- a public gist.gist p
- a gist using the opposite of your current public configuration value. That is, if by default your gists are privategist p
will create a public one (and vice versa).
Anonymous gists:
Gists will be associated with your account by default.
gist a
- an anonymous gist.gist anon
- an anonymous gist.
All of the following examples can take the public/private or the anonymous parameter (but only one of them) as the first argument.
gist rb
- a gist with a filename of "gist.rb" (ie. Ruby syntax).gist .rb
- a gist with a filename of "gist.rb" (ie. Ruby syntax).gist foo.rb
- a gist with a filename of "foo.rb".gist ipsum lorem
- a gist with no filename/syntax and a description of "ipsum lorem"gist - ipsum lorem
- a gist with no filename/syntax and a description of "ipsum lorem"gist .rb ipsum lorem
- a gist with a filename of "gist.rb" and a description of "ipsum lorem"gist foo.rb ipsum lorem
- a gist with a filename of "foo.rb" and a description of "ipsum lorem"gist rb ipsum lorem
- a gist with no filename and a description of "rb ipsum lorem"gist - foo.rb ipsum lorem
- a gist with no filename and a description of "foo.rb ipsum lorem"
Note the lack of a period or the addition of "-" in the filename argument has when specifying a description.
Contributions & Thanks
- JJ Asghar
License:
(The MIT License)
Copyright (c) 2012 Philip Hallstrom
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.