Created
July 25, 2018 10:07
-
-
Save millerdrew/c75265f5ba097781017719b5011eea09 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#For Japanese Studies | |
#Get Japanese definition from jisho.org. Uses a ruby script, jishourl, to build the url and | |
#make sure it's encoded properly. After that curl pulls down the data and pipes it into | |
#nokogiri for parsing. | |
function jdef() { | |
curl -s "$(jishourl $1)" | nokogiri -e 'puts $_.at_css("span.meaning-meaning").text' | |
} | |
#Adds a new word and definition to the Firebase Realtime Database via a cloud function | |
alias nw='function _nw() { | |
def=$(jdef $1); | |
echo $1; | |
echo $def; | |
curl -G "https://us-central1-japanese-vocab-2d5af.cloudfunctions.net/addVocab" --data-urlencode "word=$1" --data-urlencode "meaning=$def" | |
}; | |
_nw' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment