Code Monkey home page Code Monkey logo

emoji-finder's Introduction

Emoji Finder

Quickly find and copy emoji to the clipboard via the command-line

  • inspired by emoj
  • interactive UI that allows for manually composing sequences of emoji that you can copy to the clipboard
  • fuzzy, offline search supporting multiple input languages (currently English and German)
  • based on unicode-emoji-data and unicode-emoji-annotations
  • NEW: πŸ€–πŸŽ“ machine learning involved (use the experimental --dango flag)

Works best on Mac OS. Works great on Linux after installing Emoji One. Doesn't really work on Windows.

Usage

$ emoji-finder --help

  Usage
    $ emoji-finder [de|en]

  Options
    --dango Use dango (https://getdango.com/),
            internet connectivity required,
            sets input language to 'en'.

  Run without arguments to use the input language set in
  your environment (echo $LANG). Falls back to 'en' if
  not available or not supported.

Install

npm install -g emoji-finder

License

MIT

Development

Status

Travis Codecov

emoji-finder's People

Contributors

dematerializer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

emoji-finder's Issues

Can I send a PR for a fix ? :D

First of all, kudos to the super cool tool ! 😎
I have no idea how emojis work. But I was looking for some cli tool to easily copy emojis and your tool was perfect! I loved it and the --dango option is pretty cool πŸ˜‰ But the first time I used it, it gave me an error and I kept trying the same thing and got the same error. I was pretty pissed at first πŸ™ˆ then I was like "Let's debug this and send a PR may be?" and I started checking it out today even though I had no idea I was looking for. But I thought I will just give it a try. The error occurred when I typed the search query cool and it gave me an error like this :

redux-saga error: uncaught
at currentQueryChanged
 at takeLatest(ADD_CHARACTER,REMOVE_CHARACTER,SUBMIT, searchDango)
 at searchDango
 TypeError: Cannot read property 'output' of undefined
    at /Users/karuppiah/.npm/_npx/75041/lib/node_modules/emoji-finder/lib/sagas.js:161:27
    at Array.map (<anonymous>)
    at searchDango$ (/Users/karuppiah/.npm/_npx/75041/lib/node_modules/emoji-finder/lib/sagas.js:152:31)
    at tryCatch (/Users/karuppiah/.npm/_npx/75041/lib/node_modules/emoji-finder/node_modules/regenerator-runtime/runtime.js:64:40)
    at Generator.invoke [as _invoke] (/Users/karuppiah/.npm/_npx/75041/lib/node_modules/emoji-finder/node_modules/regenerator-runtime/runtime.js:355:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/karuppiah/.npm/_npx/75041/lib/node_modules/emoji-finder/node_modules/regenerator-runtime/runtime.js:116:21)
    at next (/Users/karuppiah/.npm/_npx/75041/lib/node_modules/emoji-finder/node_modules/redux-saga/lib/internal/proc.js:306:27)

I even recorded the error with asciinema https://asciinema.org/a/196964

After some digging and debugging and some searching, I finally found that the error is occurring when dango sends a response with emojis with variation selector in it https://www.fileformat.info/info/unicode/char/fe0f/index.htm . I didn't know much, I was just experimenting with what punycode did with encoding codepoints and saw the difference between these two

> console.log(punycode.ucs2.encode([0x270C]))
✌
undefined
> console.log(punycode.ucs2.encode([0x270C, 0xFE0F]))
✌️ 
undefined

The above doesn't show any difference in markdown, but in my terminal the first one doesn't have colors, and second one has it. I found this as one of the responses from dango for cool was this and that's why I got the above error. I understood that there was some undefined value from the error and looked for it, and after lots of checking, I understood that the bug was due to this line :

https://github.com/dematerializer/emoji-finder/blob/master/src/sagas.js#L64

where the seqHex created using the dango emoji is compared with the annotation sequence alone, but looks like it has to be compared with annotation's variation presentation too, like the annotation.presentation.variation.text, annotation.presentation.variation.emoji, and may be the annotation.presentation.default too? but looks like this is the same as the sequence. not sure thoughπŸ™ˆ

I modified a few lines and tried this :

const isAnnotationEqualToHexCode = (ann, seqHex) => {
	const { sequence, presentation = {} } = ann;
	const { default: defaultPresentation = '', variation = {} } = presentation;
	const { text = '', emoji = '' } = variation;

	return (
		sequence === seqHex ||
		defaultPresentation === seqHex ||
		text === seqHex ||
		emoji === seqHex
	);
};
...
...
const annotation = annotations.find(ann =>
				isAnnotationEqualToHexCode(ann, seqHex),
			) || {
				output: '',
				tts: '',
				keywords: [''],
			};

I also put a default value just in case it can't find any matching annotation. Let me know if this looks good, I can send a PR πŸ˜„ I also recorded how the output looks after the above changes :

https://asciinema.org/a/196968

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.