Last active
November 23, 2019 04:50
-
-
Save JoshCheek/c09867f92f2585cce162eaa1b4b35c7d to your computer and use it in GitHub Desktop.
My hydra signature scraping script
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
#!/usr/bin/env bash | |
node -e 'console.log(JSON.stringify(require("./src/composable-glsl-functions.js")))' \ | |
| ruby -r json -e ' | |
puts JSON.parse($stdin.read, symbolize_names: true) | |
.map { |name, defn| {**defn, name: name} } | |
.group_by { |defn| defn[:type] } | |
.sort | |
.each { |cat, defns| defns.sort_by! { |defn| defn[:name] } } | |
.map { |category, defns| | |
defns.zip([category]).map.with_index { |(defn,category),i| | |
cc, mc, tc, pc, dc = "\e[95m", "\e[9#{6+i%2}m", "\e[38;2;150;150;150m", "\e[34m", "\e[32m" | |
args = defn.fetch(:inputs,[]).map { |arg| | |
default = "#{tc}=#{dc}#{arg[:default]}" if arg.key? :default | |
"#{tc}#{arg[:type]} #{pc}#{arg[:name]}#{default}" | |
} | |
meth = "#{mc}#{defn[:name]}(#{args.join(mc+", ")}" | |
"#{cc}#{category.to_s.ljust 15}\e[34m#{meth}#{mc})\e[0m" | |
}*"\n" | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment