├── .editorconfig
├── .gitignore
├── icon.png
├── index.js
├── info.plist
├── license
├── package.json
└── readme.md
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | end_of_line = lf
5 | charset = utf-8
6 | trim_trailing_whitespace = true
7 | insert_final_newline = true
8 | indent_style = space
9 | indent_size = 2
10 |
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # swap
2 | [._]*.s[a-w][a-z]
3 | [._]s[a-w][a-z]
4 | # session
5 | Session.vim
6 | # temporary
7 | .netrwhist
8 | *~
9 | # auto-generated tag files
10 | tags
11 |
12 |
13 |
14 |
15 | *.DS_Store
16 | .AppleDouble
17 | .LSOverride
18 |
19 | # Icon must end with two \r
20 | Icon
21 |
22 |
23 | # Thumbnails
24 | ._*
25 |
26 | # Files that might appear in the root of a volume
27 | .DocumentRevisions-V100
28 | .fseventsd
29 | .Spotlight-V100
30 | .TemporaryItems
31 | .Trashes
32 | .VolumeIcon.icns
33 | .com.apple.timemachine.donotpresent
34 |
35 | # Directories potentially created on remote AFP share
36 | .AppleDB
37 | .AppleDesktop
38 | Network Trash Folder
39 | Temporary Items
40 | .apdisk
41 |
42 |
43 | node_modules
44 | awe.json
45 |
--------------------------------------------------------------------------------
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/importre/alfred-awe/8ffff9a999d225b831b4e7893d8c9dc51b286959/icon.png
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | const alfy = require('alfy');
2 | const got = require('got');
3 | const alfredNotifier = require('alfred-notifier');
4 | const input = alfy.input.toLowerCase();
5 |
6 | function comp(a, b) {
7 | const i = a.indexOf(input);
8 | const j = b.indexOf(input);
9 | if (i >= 0 && j >= 0) {
10 | if (i - j === 0) return a.length - b.length;
11 | return i - j;
12 | }
13 | if (i >= 0) return -1;
14 | if (j >= 0) return 1;
15 | return a.localeCompare(b);
16 | }
17 |
18 | function filter(items) {
19 | return items
20 | .filter(item => {
21 | const i = input.replace(/[-_.\/+&\s\W]/g, '');
22 | const title = item.title.toLowerCase().normalize('NFD');
23 | const subtitle = item.subtitle.toLowerCase().normalize('NFD');
24 | const category = item.category.toLowerCase().normalize('NFD');
25 | const parent = item.parent.toLowerCase().normalize('NFD');
26 | return title.replace(/[-_.\/+&\s\W]/g, '').indexOf(i) >= 0 ||
27 | subtitle.replace(/[-_.\/+&\s\W]/g, '').indexOf(i) >= 0 ||
28 | category.replace(/[-_.\/+&\s\W]/g, '').indexOf(i) >= 0 ||
29 | parent.replace(/[-_.\/+&\s\W]/g, '').indexOf(i) >= 0;
30 | })
31 | .sort((a, b) => comp(a.subtitle.toLowerCase(), b.subtitle.toLowerCase()))
32 | .sort((a, b) => comp(a.category.toLowerCase(), b.category.toLowerCase()))
33 | .sort((a, b) => comp(a.parent.toLowerCase(), b.parent.toLowerCase()))
34 | .sort((a, b) => comp(a.title.toLowerCase(), b.title.toLowerCase()))
35 | .map(item => {
36 | var parent = item.parent;
37 | if (parent !== '') parent += ' > ';
38 | var desc = item.subtitle;
39 | if (desc !== '') desc = ' | ' + desc;
40 | return {
41 | title: item.title,
42 | subtitle: parent + item.category + desc,
43 | arg: item.url
44 | };
45 | });
46 | }
47 |
48 | const url = 'https://alfred-workflows-62254.firebaseio.com/awe.json';
49 | alfy.fetch(url, {
50 | maxAge: 86400000, // 24 hours
51 | })
52 | .then(items => {
53 | const output = filter(items);
54 | alfy.output(output);
55 | alfredNotifier();
56 | });
57 |
58 |
--------------------------------------------------------------------------------
/info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | bundleid
6 | com.importre.alfred.awe
7 | category
8 | Productivity
9 | connections
10 |
11 | 8F7B901D-3BCD-4094-A694-D0E0D7367B62
12 |
13 |
14 | destinationuid
15 | 9B09DFD7-184E-4DBE-81C1-9A83455D3048
16 | modifiers
17 | 0
18 | modifiersubtext
19 |
20 | vitoclose
21 |
22 |
23 |
24 |
25 | createdby
26 | importre
27 | description
28 | Search awesome projects!
29 | disabled
30 |
31 | name
32 | awe
33 | objects
34 |
35 |
36 | config
37 |
38 | browser
39 |
40 | spaces
41 |
42 | url
43 | {query}
44 | utf8
45 |
46 |
47 | type
48 | alfred.workflow.action.openurl
49 | uid
50 | 9B09DFD7-184E-4DBE-81C1-9A83455D3048
51 | version
52 | 1
53 |
54 |
55 | config
56 |
57 | alfredfiltersresults
58 |
59 | argumenttype
60 | 0
61 | escaping
62 | 102
63 | keyword
64 | awe
65 | queuedelaycustom
66 | 3
67 | queuedelayimmediatelyinitially
68 |
69 | queuedelaymode
70 | 2
71 | queuemode
72 | 1
73 | runningsubtext
74 | Searching...
75 | script
76 | ./node_modules/.bin/run-node index.js "$1"
77 | scriptargtype
78 | 1
79 | scriptfile
80 |
81 | subtext
82 |
83 | title
84 | Search awesome projects
85 | type
86 | 0
87 | withspace
88 |
89 |
90 | type
91 | alfred.workflow.input.scriptfilter
92 | uid
93 | 8F7B901D-3BCD-4094-A694-D0E0D7367B62
94 | version
95 | 2
96 |
97 |
98 | readme
99 | Search awesome projects!
100 | uidata
101 |
102 | 8F7B901D-3BCD-4094-A694-D0E0D7367B62
103 |
104 | xpos
105 | 40
106 | ypos
107 | 30
108 |
109 | 9B09DFD7-184E-4DBE-81C1-9A83455D3048
110 |
111 | xpos
112 | 280
113 | ypos
114 | 30
115 |
116 |
117 | version
118 | 0.2.2
119 | webaddress
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/license:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Jaewe Heo
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "alfred-awe",
3 | "version": "0.3.0",
4 | "description": "Alfred 3 workflow to find awesome projects",
5 | "license": "MIT",
6 | "repository": "importre/alfred-awe",
7 | "author": {
8 | "name": "Jaewe Heo",
9 | "email": "jaeweheo@gmail.com",
10 | "url": "importre.com"
11 | },
12 | "engines": {
13 | "node": ">=4"
14 | },
15 | "scripts": {
16 | "postinstall": "alfy-init",
17 | "preuninstall": "alfy-cleanup"
18 | },
19 | "files": [
20 | "index.js",
21 | "icon.png",
22 | "info.plist"
23 | ],
24 | "keywords": [
25 | "alfred",
26 | "awesome"
27 | ],
28 | "dependencies": {
29 | "alfred-notifier": "^0.2.0",
30 | "alfy": "^0.6.0",
31 | "got": "^6.6.3"
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # 
alfred-awe
2 |
3 | > [Alfred 3](https://www.alfredapp.com) workflow to find **awesome projects** from [sindresorhus/awesome](https://goo.gl/EUJAEM)
4 |
5 | 
6 |
7 |
8 | ## Prerequisites
9 |
10 | You need [Node.js 4+](https://nodejs.org) and [Alfred 3](https://www.alfredapp.com) with the paid [Powerpack](https://www.alfredapp.com/powerpack/) upgrade.
11 |
12 |
13 | ## Install
14 |
15 | ```
16 | $ npm i -g alfred-awe
17 | ```
18 |
19 |
20 | ## Reference
21 |
22 | - [importre/alfred-workflows: 🔧my alfred workflows](https://goo.gl/GOFxDC)
23 |
24 |
25 | ## License
26 |
27 | MIT © Jaewe Heo
28 |
--------------------------------------------------------------------------------