Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji hash #26

Closed
hadley opened this issue Oct 31, 2018 · 6 comments
Closed

Emoji hash #26

hadley opened this issue Oct 31, 2018 · 6 comments
Labels
feature a feature request or enhancement

Comments

@hadley
Copy link
Member

hadley commented Oct 31, 2018

To quickly compare whether or not two session infos are the same, it would be useful to generate an emoji hash (i.e. hash package names and versions, then display by indexing into emoji)

e.g. https://www.npmjs.com/package/hash-emoji

@gaborcsardi
Copy link
Member

See comment in #6. I am actually not sure if emojis are better than sg like ssh randomart:

+--[ RSA 2048]----+
|       o=.       |
|    o  o++E      |
|   + . Ooo.      |
|    + O B..      |
|     = *S.       |
|      o          |
|                 |
|                 |
|                 |
+-----------------+

@hadley
Copy link
Member Author

hadley commented Oct 31, 2018

Emojis are clearly better!!

@gaborcsardi
Copy link
Member

With emojis you'll have a lot of collisions, because their space is small.

Anyway, whatever the hash function is, I think the crucial part is figuring out what to hash, e.g. you probably don't want to has installation dates, etc.

@hadley
Copy link
Member Author

hadley commented Oct 31, 2018

I was thinking of like 5 emoji, and 2823 ^ 5 is quite large 😉

@gaborcsardi
Copy link
Member

OK, we still need to think about what to hash. Also, it probably makes sense to hash the session info and the package info separately, so that we can at least see which one is different. So maybe we can have 2 and 3 (or 1 and 4?) emojis for both.

@gaborcsardi gaborcsardi added the feature a feature request or enhancement label Sep 27, 2021
@gaborcsardi
Copy link
Member

I added this, and it is cool and useful, but it does have the usual cons wrt emojis. Font might not have them, display width could be wrong, etc. It is using 2280 hand-picked emojis now that looked good in RStudio. Some of them have very long names, that's not ideal, either, because of platforms without emoji support we show that names.

It looks like this:

❯ session_info()
─ Session info  📜  🌈  🧚   ──────────────────────────────────────────────────────────────
 setting        value
 version        R version 4.1.1 (2021-08-10)
 os             macOS Mojave 10.14.6
 system         x86_64, darwin17.0
 ui             X11
 language       (EN)
 collate        en_US.UTF-8
...

and without emojis like this:

❯ session_info()
─ Session info  ───────────────────────────────────────────────────────────────────────────
 hash: scroll, rainbow, fairy

 setting        value
 version        R version 4.1.1 (2021-08-10)
 os             macOS Mojave 10.14.6
 system         x86_64, darwin17.0
 ui             X11
 language       (EN)
 collate        en_US.UTF-8

An alternative would be to use the adjective-animals data for hashing:

❯ cli::hash_animal("foobar")$hash
[1] "unevolving degrading harrier"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants