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

gekoq

v1.7.0

Published

Thin wrapper for pushing to Geckoboard's custom widgets

Downloads

226

Readme

gekoq

A thin wrapper for pushing to Geckoboard's custom widgets using Node.js. Requires Node >=4.0.0

gekoq comes from the Malay word for gecko, said to be imitative of its sound.

See Change Log below.

Install & Usage

$ npm install gekoq

The default exported value is a Function that accepts the Geckoboard API key. This then returns a Function that accepts an Object with the properties key and data and when evaluated pushes to the widget. This returns a Promise.

E.g.

const gekoq = require('gekoq');

const push = gekoq('a094dabc561c521f81782627f1c2by73');

push({
  key: '147539-72d8b6cf-8766-4ead-bd1e-b671e8a5ab86',
  data: { item: [{ value: 1200 }] }
})
.then(response => console.log(response));

A good strategy is to store keys as environment variables. In the terminal (or add to your .{bash,zsh}rc):

$ export GECKOBOARD_API_KEY=a094dabc561c521f81782627f1c2by73

then

const push = gekoq(process.env.GECKOBOARD_API_KEY);

Use Promises to push an array of widgets

const dashboard = [
  {
    key: '119097-1c74815e-8658-48a0-80f3-cdb79a07754c',
    data: { item: [ { value: 100 } ] }
  },
  {
    key: '145647-f084514b-27dc-4552-a267-e6e3cc069baf',
    data: { item: [ { value: 200 } ] }
  }
]

Promise.all(dashboard.map(push)).then(...);

Change Log

1.6.0

Fixed the 'Content-Length' header which used previously the value returned from String.prototype.length. This causes problems when a character has two code points. Now using Buffer.byteLength.

1.5.x

Node 5 build. The default export now returns a Function which expects the Geckoboard API key and returns a Function that expects an Object with the properties key and data. The returned Function is thenable (i.e. it returns a Promise).

1.0.x

Introduced the breaking change whereby gekoq.push now accepts an Object with the required properties key and data (where previously it expected id instead of key). This was done to match the name that Geckoboard refers to this property in the widget configuration.