npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

slack-pokemon-emoji

v1.0.0

Published

A tool to upload all the pokemon to slack emoji.

Downloads

3

Readme

slack-pokemon-emoji

A tool to upload all the pokemon to slack emoji.

slack-pokemon-emoji

Installation

$ npm install slack-pokemon-emoji -g

Requirement

  • team Your team name.
  • cookie Slack does not have an api to upload emoji, so we have to emulate a browser environment to pass the cookie to our request. You can find the cookie from the Chrome devtools Networks tab, and it's under Header tab of any request.

cookie

Usage

$ slack-pokemon-emoji TEAM "COOKIE"
# or
$ slack-pokemon-emoji -t TEAM -c "COOKIE"
# or
$ slack-pokemon-emoji team=TEAM cookie=COOKIE

How it works?

Fetch pokemon images from http://www.pokemon.com/us/pokedex/

Do this in Chrome devtools and get all the pokemon indexs

/**
 * Quick and dirty jQuery script to extract pokemon name and image url
 */
var pokemons = $($0).find('li').toArray().map(function(li) {
  return {
    imgSrc: $($(li).find('figure')[0]).find('img')[0].src,
    name: $($(li).find('.pokemon-info')[0]).find('h5')[0].innerHTML
  }
})

Download all the images to local and resize them to 128 * 128

$ node index.js

Resize all the images and rename it to pokemonname.png

pokemons.forEach(function (pokemon) {
  var readStream = hyperquest.get(pokemon.imgSrc)
  gm(readStream)
    .resize('128', '128')
    .stream()
    .pipe(fs.createWriteStream(`./images/${pokemon.name.toLowerCase()}.png`))
})

Upload all images to slack

$ node uploader.js

Tools

  • gm A nodejs wrapper for imageMagick, used for resizing image
  • hyperquest A nodejs stream based http request utils
  • cheerio A nodejs module to parse html text on server side
  • form-data A nodejs module to build form data and upload to slack

Slack does not provide a upload emoji api, and this tool is inspired by slack-emojinator.

Some of the code here use ES6 syntax so you might need nodejs 4.. to run the code.

License

MIT