Coder Social home page Coder Social logo

jc-units's Introduction

Alfred 2 Workflow for unit conversion

Screenshot

Download

This is a really simple workflow that uses the Pint unit library to convert an input string. The calculator is called as you type, so as soon as you put in something it considers valid, you'll see output.

Actioning the result will copy the value (just the number) to the clipboard. That's it!

Basic conversion is performed with a command like:

u {value} {in units} > {out units}

You can include a space after the u keyword, but it's not required. Units can generally be abbreviated or not, as long as the input is unambiguous. A greater than sign (>) is required between the input value and output units. Some example commands:

  • u 5k > miles
  • u5k>miles
  • u5k>mi

You can also do more advanced queries that use unit math, like:

u 1cm + 1in - 1mm > in

or

u 1cm * 1mm > in^2

Installation

To install, just download the prepackaged workflow. Double-click on the downloaded file, or drag it into the Alfred Workflows window, and Alfred should install it.

Configuration

Three options can be set in the workflow configuration file (accessible via the 'u>' command):

  • separator - separator to use between input value and output units; default is ">"
  • precision - if set to an integer value, this is the number of digits to include after a decimal point; default is null
  • loglevel - what level of messages to send to the debug log; default is "INFO"

Requirements

  • Python 2.7 (standard in Lion and Mountain Lion)
  • My jcalfred python library (included in the workflow download)

Credits

Currency exchange rates are courtesy of Yahoo! Finance.

jc-units's People

Contributors

jason0x43 avatar

Watchers

 avatar

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.