Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ascii Plugin #560

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added PluginDirectories/1/ascii.bundle/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions PluginDirectories/1/ascii.bundle/README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This is an auto-generated plugin skeleton. Edit the `examples.txt`, `info.json` and `plugin.py` files to turn it into the plugin you need.

For more info on how this works, see [the docs](https://github.com/nate-parrott/Flashlight/wiki/Creating-a-Plugin).

If you're building a search plugin, you may want to base your code off [a search plugin](https://github.com/nate-parrott/Flashlight/tree/master/PluginDirectories/1/googlesearch.bundle) instead.
Binary file added PluginDirectories/1/ascii.bundle/Screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions PluginDirectories/1/ascii.bundle/examples.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
chr ~chr(97)
chr ~chr(97 90 100 76 91 93 97 99 101)
asc ~asc(+)
asc ~asc(a b $ ‘ “ \ D % ^)
ascii ~asc(a b $ ‘ “ \ D % ^)
12 changes: 12 additions & 0 deletions PluginDirectories/1/ascii.bundle/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"categories" : [
"Utilities"
],
"displayName" : "Utility for ascii",
"name" : "ascii",
"description" : "Show ascii.",
"examples" : [
"chr a b",
"asc 97 90"
]
}
23 changes: 23 additions & 0 deletions PluginDirectories/1/ascii.bundle/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
def results(fields, original_query):
html=""
if("~chr" in fields):
message = fields['~chr']
title = "char of "+message
for tmp in message.split():
html=html+" "+chr(int(tmp))
data = html.lstrip()
else:
message = fields['~asc']
title = "ascii of "+message
for tmp in message.split():
html=html+" "+str(ord(tmp))
data = html.lstrip()
return {
"title": title,
"run_args": [data],
"html": html
}

def run(message):
import subprocess
subprocess.call(['printf "' + message + '" | LANG=en_US.UTF-8 pbcopy && osascript -e \'display notification "Copied!" with title "Flashlight"\''], shell=True)