-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
366 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.alexeyglushkov.LaunchBar.action.EvernoteExport</string> | ||
<key>CFBundleIconFile</key> | ||
<string></string> | ||
<key>CFBundleName</key> | ||
<string>Evernote Export</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>LBDebugLogEnabled</key> | ||
<true/> | ||
<key>LBScripts</key> | ||
<dict> | ||
<key>LBDefaultScript</key> | ||
<dict> | ||
<key>LBScriptName</key> | ||
<string>default.scpt</string> | ||
<key>LBRunInBackground</key> | ||
<true/> | ||
<key>LBRequiresArgument</key> | ||
<false/> | ||
<key>LBReturnsResult</key> | ||
<false/> | ||
<key>LBLiveFeedbackEnabled</key> | ||
<false/> | ||
</dict> | ||
</dict> | ||
<key>LBDescription</key> | ||
<dict> | ||
<key>LBSummary</key> | ||
<string>Export your evernote notes to be able to look through them by Evernote Search tool</string> | ||
<key>LBAuthor</key> | ||
<string>Glushkov Alexey</string> | ||
<key>LBWebsite</key> | ||
<string>https://medium.com/@sonicCat</string> | ||
<key>LBTwitter</key> | ||
<string>@soniccat</string> | ||
</dict> | ||
<key>NSHumanReadableCopyright</key> | ||
<string>Copyright © 2014 Gluhkov Alexey</string> | ||
</dict> | ||
</plist> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.alexeyglushkov.LaunchBar.action.EvernoteSearch</string> | ||
<key>CFBundleIconFile</key> | ||
<string></string> | ||
<key>CFBundleName</key> | ||
<string>Evernote Search</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>LBTextInputTitle</key> | ||
<string>Options after --:rtm</string> | ||
<key>LBDebugLogEnabled</key> | ||
<true/> | ||
<key>LBScripts</key> | ||
<dict> | ||
<key>LBDefaultScript</key> | ||
<dict> | ||
<key>LBScriptName</key> | ||
<string>default.rb</string> | ||
<key>LBRunInBackground</key> | ||
<true/> | ||
<key>LBRequiresArgument</key> | ||
<true/> | ||
<key>LBAcceptedArgumentTypes</key> | ||
<array> | ||
<string>string</string> | ||
</array> | ||
<key>LBReturnsResult</key> | ||
<true/> | ||
<key>LBLiveFeedbackEnabled</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
<key>LBDescription</key> | ||
<dict> | ||
<key>LBSummary</key> | ||
<string>Search through exported Evernote notes by text</string> | ||
<key>LBAuthor</key> | ||
<string>Glushkov Alexey</string> | ||
<key>LBWebsite</key> | ||
<string>https://medium.com/@sonicCat</string> | ||
<key>LBTwitter</key> | ||
<string>@soniccat</string> | ||
</dict> | ||
<key>NSHumanReadableCopyright</key> | ||
<string>Copyright © 2014 Gluhkov Alexey</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'json' | ||
require 'CGI' | ||
|
||
#get search folder | ||
homeFolder = `echo ~/` | ||
homeFolder = homeFolder[0..-2] | ||
|
||
exportPath = "" | ||
|
||
containersPath = "#{homeFolder}/Library/Group Containers/" | ||
files = Dir.entries(containersPath) | ||
files.each do |f| | ||
if f.end_with?("com.evernote.Evernote") | ||
exportPath = containersPath + f + "/Evernote/evernoteExport" | ||
end | ||
end | ||
|
||
if exportPath == nil || exportPath.length == 0 | ||
item = {} | ||
item['title'] = "Can't build path to a search folder" | ||
items.push(item) | ||
return item | ||
end | ||
|
||
folderPath = exportPath | ||
searchString = ARGV[0] | ||
|
||
optionIndex = searchString.index('--') | ||
optionsString = "" | ||
|
||
if optionIndex != nil | ||
optionsString = searchString[optionIndex+2..-1] | ||
searchString = searchString[0..optionIndex-1] | ||
end | ||
|
||
$showDebug = optionsString.index('d') != nil | ||
|
||
|
||
#seach | ||
startTime = Time.now | ||
results = [] | ||
|
||
|
||
resultStrings = Dir[folderPath+'/'+'*.html'].inject(Hash.new(0)){ |result, item| result.update(item => File.read(item).scan(/#{searchString}/i).size) } | ||
resultStrings.each do |k, v| | ||
if v > 0 | ||
item = {} | ||
item[:filePath] = k | ||
item[:matches] = v | ||
results << item | ||
end | ||
end | ||
|
||
#p resultStrings | ||
|
||
#p "find \"#{folderPath}\" -name \"*.html\" -exec grep -c \"#{searchString}\" {} +" | ||
#value = `find "#{folderPath}" -name "*.html" -exec grep -c "#{searchString}" {} +` | ||
#resultStrings = value.split("\n") | ||
|
||
#return; | ||
|
||
=begin | ||
resultStrings.each do |str| | ||
values = str.split(":") | ||
matches = values[0].to_i | ||
if matches > 0 | ||
item = {} | ||
item[:filePath] = values[0] | ||
item[:matches] = matches | ||
results << item | ||
end | ||
end | ||
=end | ||
|
||
|
||
#sort by matches count | ||
results = results.sort do |dict1, dict2| | ||
numberOfMatchies1 = dict1[:matches] | ||
numberOfMatchies2 = dict2[:matches] | ||
|
||
numberOfMatchies2 - numberOfMatchies1 | ||
end | ||
|
||
finishTime = Time.now | ||
timeIntervale = finishTime - startTime | ||
|
||
#convert to response | ||
items = [] | ||
|
||
if ($showDebug) | ||
item = {} | ||
item['title'] = "scanning takes #{timeIntervale} seconds" | ||
items.push(item) | ||
end | ||
|
||
results.each do | dict | | ||
|
||
item = {} | ||
item['title'] = File.basename(dict[:filePath]) | ||
item['subtitle'] = dict[:matches].to_s + " matches" | ||
item['path'] = dict[:filePath] | ||
|
||
items.push(item) | ||
end | ||
|
||
if items.count == 0 | ||
item = {} | ||
item['title'] = "no matches" | ||
items.push(item) | ||
end | ||
|
||
puts items.to_json | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'io/console' | ||
require 'CGI' | ||
|
||
|
||
=begin | ||
str = ARGV[0] | ||
args = str.split("||") | ||
wordsString = args[0] + ", " + args[1] + ", " + args[2] | ||
selectedIndex = args[3] | ||
selectedWord = args[selectedIndex.to_i] | ||
#copy selected word | ||
IO.popen('pbcopy', 'w') { |f| f << selectedWord } | ||
#show all words | ||
wordsString = CGI::escape(wordsString) | ||
value = `open \"x-launchbar:large-type?string=#{wordsString}\"` | ||
=end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.alexeyglushkov.LaunchBar.action.IrregularVerbs</string> | ||
<key>CFBundleIconFile</key> | ||
<string></string> | ||
<key>CFBundleName</key> | ||
<string>Irregular Verb List</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>LBDebugLogEnabled</key> | ||
<true/> | ||
<key>LBTextInputTitle</key> | ||
<string>Word:</string> | ||
<key>LBScripts</key> | ||
<dict> | ||
<key>LBDefaultScript</key> | ||
<dict> | ||
<key>LBScriptName</key> | ||
<string>default.rb</string> | ||
<key>LBRunInBackground</key> | ||
<true/> | ||
<key>LBRequiresArgument</key> | ||
<true/> | ||
<key>LBAcceptedArgumentTypes</key> | ||
<array> | ||
<string>string</string> | ||
</array> | ||
<key>LBReturnsResult</key> | ||
<true/> | ||
<key>LBLiveFeedbackEnabled</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
<key>LBDescription</key> | ||
<dict> | ||
<key>LBSummary</key> | ||
<string>Show all forms of a typed irregular verbs</string> | ||
<key>LBAuthor</key> | ||
<string>Glushkov Alexey</string> | ||
<key>LBWebsite</key> | ||
<string>https://medium.com/@sonicCat</string> | ||
<key>LBTwitter</key> | ||
<string>@soniccat</string> | ||
</dict> | ||
<key>NSHumanReadableCopyright</key> | ||
<string>Copyright © 2014 Gluhkov Alexey</string> | ||
</dict> | ||
</plist> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'io/console' | ||
require 'CGI' | ||
|
||
str = ARGV[0] | ||
args = str.split("||") | ||
|
||
wordsString = args[0] + ", " + args[1] + ", " + args[2] | ||
selectedIndex = args[3] | ||
selectedWord = args[selectedIndex.to_i] | ||
|
||
#copy selected word | ||
IO.popen('pbcopy', 'w') { |f| f << selectedWord } | ||
|
||
#show all words | ||
wordsString = CGI::escape(wordsString) | ||
value = `open \"x-launchbar:large-type?string=#{wordsString}\"` |