Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@joech4n
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joech4n/3f4222773a1aca9c491a to your computer and use it in GitHub Desktop.
Save joech4n/3f4222773a1aca9c491a to your computer and use it in GitHub Desktop.
MathJS - Alfred Workflow Script Filter
# Created with the following resources
# http://www.alfredforum.com/topic/37-feature-request-run-javascriptnodejs-scripts/#entry2262
# https://github.com/lrrfantasy/alfred-feedback-xml-generation/#nodejs
# Bootstrapped workflow here is probably better: https://github.com/giangvo/alfred-workflow-nodejs
/usr/local/bin/node <<-'CODE'
try {
var query = "{query}";
var Feedback = require('./Feedback');
var math = require('./math');
var result = math.eval(query);
var foo = new Feedback({
uid: 'itemuid',
arg: 'itemarg',
title: result,
subtitle: query,
icon: 'icon.png',
valid: 'yes',
autocomplete: 'autocomplete'
});
console.log(foo.toString());
} catch (e) {
console.log(e.message);
}
CODE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment