Skip to content

Instantly share code, notes, and snippets.

@joech4n

joech4n/filter.bash

Last active Aug 29, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.