Skip to content

Instantly share code, notes, and snippets.

@krisrice
Last active July 6, 2020 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisrice/f0481409fccec41163544766d06aac61 to your computer and use it in GitHub Desktop.
Save krisrice/f0481409fccec41163544766d06aac61 to your computer and use it in GitHub Desktop.
drop table emoji;
create table emoji ( keyword varchar2(30), emoji varchar2(200));
script
// read text content from the given URL
function readText(url) {
// Using JavaImporter to resolve classes
// from specified java packages within the
// 'with' statement below
with (new JavaImporter(java.io, java.net)) {
// more or less regular java code except for static types
var is = new URL(url).openStream();
try {
var reader = new BufferedReader(
new InputStreamReader(is));
var buf = '', line = null;
while ((line = reader.readLine()) != null) {
buf += line;
}
} finally {
reader.close();
}
return buf;
}
}
var emoji = JSON.parse(readText('https://raw.githubusercontent.com/muan/emojilib/master/emojis.json'));
var keys = Object.keys(emoji);
ctx.write( "Got :" + keys.length + " emojis \n\n" )
for (var key in emoji) {
//ctx.write(key + ">")
if ( emoji[key] && emoji[key].char ) {
//ctx.write( emoji[key].char )
var binds = {};
binds.keyword = key;
binds.emoji = emoji[key].char;
var ret = util.execute("insert into emoji(keyword,emoji) values(:keyword , :emoji)",binds);
}
//ctx.write( "\n" )
}
ctx.write( "\n\n" )
/
select * from emoji order by keyword;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment