derBingle Posted August 2, 2017 Share Posted August 2, 2017 Hey all, just published a little workflow so that I can change the case of the text in the clipboard quickly. The code is here: https://github.com/derBingle/alfred-change-case. It requires nodejs, so if you have it already, you can install via npm install -g alfred-change-case Screenshot: : Would love any feedback/suggestions! Link to comment
deanishe Posted August 2, 2017 Share Posted August 2, 2017 2 hours ago, derBingle said: Would love any feedback/suggestions! Node is a pretty hardcore dependency for such a simple workflow. Could this work as JXA? That way, it would run on every Mac. vitor 1 Link to comment
derBingle Posted August 4, 2017 Author Share Posted August 4, 2017 On 8/2/2017 at 3:41 PM, deanishe said: Node is a pretty hardcore dependency for such a simple workflow. Thanks for the feedback, @deanishe. I don't disagree—Node's just what I'm working day to day and JS is the only language I'm comfortable in (working on that, though!). I already knew/used the Lodash string functions and smart title case module, so it was quick and easy to put this together. I have quite a few personalized Alfred workflows that use node extensively, so I didn't even think about it. But you're right. I might just compile the script to a binary for non-node users — seems a lot less complicated that switching to JXA, adding browersify to bundle the required modules. But I'm open to suggestions. @dfay This workflow only exists because I was needing the 3 programming-related cases—the sentence related ones were more of a "might as well add it while I'm here" afterthought. So definitely no workflow-infringement intended here - if people don't need snake/kebab/camel case, they should definitely use yours! Link to comment
dfay Posted August 4, 2017 Share Posted August 4, 2017 haha no worries @derBingle - there is also this which I'm sure is overkill for most users including myself Link to comment
deanishe Posted August 4, 2017 Share Posted August 4, 2017 1 hour ago, derBingle said: I might just compile the script to a binary for non-node users — seems a lot less complicated that switching to JXA, adding browersify to bundle the required modules. But I'm open to suggestions Can the code not be more-or-less copy-pasted? Is some massive JS build-pipeline really required? How big, exactly, would that binary be? I mean, does it include Node? More generally, the "global install" method (in this case, using "npm install -g") is not a good idea. In terms of Alfred workflows, it means your workflow doesn't sync across machines like well-behaved (self-contained) workflows. In more general Node terms (though the same applies to Ruby and Python), it sets your workflow up to break/be broken by other software, as you can only install one version of a library at a time globally. You probably don't want to open yourself up to many years of support requests/bug reports because your globally-installed program requires a different version of library X to program Y. Link to comment
FroZen_X Posted August 4, 2017 Share Posted August 4, 2017 ummm am i wrong or can all this be achieved with Alfred functions oO "Replace" and "Transform", that's what I'm using however plus some regex. Link to comment
dfay Posted August 6, 2017 Share Posted August 6, 2017 It probably can, but the workflows date back to Alfred 2 before those features were available. Link to comment
deanishe Posted August 7, 2017 Share Posted August 7, 2017 On 04/08/2017 at 10:47 PM, FroZen_X said: ummm am i wrong or can all this be achieved with Alfred functions oO "Replace" and "Transform", that's what I'm using however plus some regex. Most of it, yeah. The workflow I use also has a "slugify" mode, which can't be done (easily) within Alfred. In any case, it's generally easier to write two lines of code that add a bunch of Alfred elements, and you can't show a "live preview" in a Script Filter, either. Link to comment
Anjadekar Posted October 5, 2017 Share Posted October 5, 2017 The implementation is beautiful but it runs very slowly for me. Any ideas why? I'm on a pretty powerful MacBook Pro so would expect it to run faster. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now