Ramda-repl

ramda-repl

Ramda + ramda-fantasy REPL

ramda-repl extends node REPL to bring in Ramda and ramda-fantasy so that you can use all of uber cool feature of ramda!

Get it:

1
$ npm install --save ramda-repl

usage:

1
2
3
4
var ramdaRepl = require('ramda-repl');

ramdaRepl();
//=> Will start a REPL

CLI

1
$ npm install --global ramda-repl

$ ramda-repl

Will start a REPL as below with R as well as current context is extended with ramda

1
2
3
4
5
6
7
8
9
10
Welcome to Ramda REPL!

λ > typeof R
'object'

λ > typeof map
'function'

λ > typeof zipWith
'function'

GIF FTW

ramda-repl

License

MIT © Hemanth.HM

Npm-check

npm-check

Check for outdated, incorrect, and unused dependencies.

Features:

  • Interactive Update means less typing.
  • Scoped packages support for the modern npm user.
  • Works with public and private registries.
  • Won't query npm registry for packages with private: true.
  • Kindly informs you if a dependency is not being used.
  • Emoji in a command-line app, because command-line apps can be fun too.

Very much similar to npm-check-updates but far more generic and interactive!

Get it: npm install -g npm-check

Sample usage:

1
2
3
4
5
6
7
8
9
10
11
12
$ npm-check --help

  Usage: npm-check [options]

  Options:

    -h, --help         output usage information
    -V, --version      output the version number
    -u, --update       Interactive update.
    -g, --global       Look at global modules.
    -s, --skip-unused  Skip check for unused packages.
    -p, --production   Ignore devDependencies.
1
2
3
4
var npmCheck = require('npm-check');

npmCheck(options)
  .then(result);

GIF FTW!

npm-check

Thanks to @dylang for npm-check.

Speed-test

speed-test

Test your internet connection speed and ping using speedtest.net from the CLI.

This is product of sindresorhus/module-requests makes use of speedtest-net helps us to know our intenet connection speed and ping with a beautiful UI.

Get it: $ npm install --global speed-test

Usage:

1
2
3
4
$ speed-test --help

  Usage
    $ speed-test

GIF FTW:

speed-test

Url-pattern

url-pattern

easier than regex string matching for urls, domains, filepaths and other strings.

url-pattern can capture named parts of strings and conveniently returns them as objects.

Also does the reverse and generates strings given a pattern and such an object.

install: npm install url-pattern

simple match example:

1
2
3
4
5
6
7
8
9
var UrlPattern = require('url-pattern');

var pattern = new UrlPattern('/api/users/:id');

pattern.match('/api/users/10');
{id: '10'}

pattern.match('/api/products/5');
null

complex match example showing off escaping, wildcards and optional segments:

1
2
3
4
5
6
7
8
9
var pattern = new UrlPattern('(http(s)\\://)(:subdomain.):domain.:tld(/*)')

pattern.match('google.de'); // {domain: 'google', tld: 'de'}

pattern.match('https://www.google.com'); // {subdomain: 'www', domain: 'google', tld: 'com'}

pattern.match('http://mail.google.com/mail'); // {subdomain: 'mail', domain: 'google', tld: 'com', _: 'mail'}

pattern.match('google') ; // null

stringify example:

1
2
3
4
5
var pattern = new UrlPattern('/api/users(/:id)');

pattern.stringify() // '/api/users'

pattern.stringify({id: 10})  //' /api/users/10'

GIF FTW!

url-pattern

Human-to-cron

human-to-cron

Converts human readable expression to a cron string!

If you can interpert 0 */1 * * * as each minute then this module is not for you ;)

human-to-cron parsers the human readable expressions with the help of ES6 generators converts it into a cron string.

Get it: npm install --save human-to-cron

Sample usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
var humanToCron = require('human-to-cron');

humanToCron('once each minute') // => 0 */1 * * * *
humanToCron('each 2 minutes') // => * */2 * * * *
humanToCron('each second') // => */1 * * * * *
humanToCron('once each hour') // => 0 0 */1 * * *
humanToCron('once each day') // => 0 0 0 */1 * *
humanToCron('once each month') // => 0 0 0 0 */1 *
humanToCron('once each 5 months') // => 0 0 0 0 */5 *
humanToCron('midnight') // => 0 0 0 * * *
humanToCron('midnight each 2 minutes') // => 0 */2 0 * * *
humanToCron('once tuesday each 10 minutes') // => 0 */10 * 1 * *
humanToCron('friday 15:44') // => 0 44 15 4 * *
humanToCron('august friday 15:44') // => 0 44 15 4 7 *

GIF FTW!

human-to-cron

Thanks to Andrius Skerla for this cheeky module!

Lightcards

lightcard

Lightweight Chinese flashcards.

lightcards is one of those lightweight, single purpose, fun modules! This helps you to make flash cards that would help you to learn Chinese characters! By default, lightcards uses vocabulary.txt from the current working directory. If no vocabulary.txt can be found, lightcards will create it create it for you, after which it will start a minimalistic server with a cute interface to go through the list of word that was provided from a file or stdin.

Get it: npm install -g lightcards

Simple usage:

1
2
3
4
5
6
7
8
$ lightcards init && lightcards

Reading vocabulary from vocabulary.txt... OK!
Generating flashcards... OK!
Compiling scripts... OK!
Starting local web server... OK!

Start learning on http://localhost:3000

GIF FTW!

lightcards

Thanks to Oscar Söderlund for lightcards!

Curry-this

Curry-this

Curry-this makes creating curryied function simple and expresive by invoking curry with the function bind syntax ::. Apart from the expresive way of creating a curried function, the main feature are placeholders. A placeholder (_) is a Symbol which allows to curry specific arguments of a function.

Install it: npm install --save curry-this

Basic usage

1
2
3
4
5
6
7
8
9
10
11
12
13
const {curry, _} = require('curry-this')();


// Got a simple function?

const plus = (
    (a, b, c) => a + b + c
)::curry();

plus(1, 2, 3);  //» 6
plus(1)(2, 3);  //» 6
plus(1, 2)(3);  //» 6
plus(1)(2)(3);  //» 6

Placeholders

1
2
3
4
5
6
7
8
// Got a monster function?

const {open} = require('fs');
const newScript = open::curry(_, 'w', 0755, _);

newScript('do-wonders.sh', (error, file) => {
  // The `file` is ready.
});

You can try this with babel-node. Make sure that you use the --stage=0 option.

GIF FTW!

curry-this

Thanks to Christoph Hermann and tomekwi for making cury more fun!

Caniuse-cmd

caniuse-cmd

caniuse.com on CLI!

caniuse-cmd brings the power of caniuse on to the command line, it makes use of caniuse-db module which provides raw browser/feature support data for the same.

Install it:

1
npm install --global caniuse-cmd

Sample usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
nmotw> caniuse webrtc --short
WebRTC Peer-to-peer connections ✔ 55.36% ◒ 0%
  IE ✘  Edge ✘  Firefox ✘ 2+ ✔ 22+ᵖ Chrome ✘ 4+ ✔ 23+ᵖ Safari ✘  Opera ✘ 9+ ✔ 18+ᵖ

nmotw> caniuse webrtc --short -a
WebRTC Peer-to-peer connections ✔ 55.36% ◒ 0%
  IE ✘  Edge ✘  Firefox ✘ 2+ ✔ 22+ᵖ Chrome ✘ 4+ ✔ 23+ᵖ Safari ✘  Opera ✘ 9+ ✔ 18+ᵖ

nmotw> caniuse webrtc --short --abbrv
WebRTC Peer-to-peer connections ✔ 55.36% ◒ 0%
  IE ✘  Edge ✘  Firefox ✘ 2+ ✔ 22+ᵖ Chrome ✘ 4+ ✔ 23+ᵖ Safari ✘  Opera ✘ 9+ ✔ 18+ᵖ

nmotw> caniuse webrtc --short --abbrev
WebRTC Peer-to-peer connections ✔ 55.36% ◒ 0%
  IE ✘  Edge ✘  FF ✘ 2+ ✔ 22+ᵖ Chr. ✘ 4+ ✔ 23+ᵖ Saf. ✘  Op. ✘ 9+ ✔ 18+ᵖ

nmotw> caniuse webrtc --short --abbrev --browser ff
WebRTC Peer-to-peer connections ✔ 55.36% ◒ 0%


nmotw> caniuse webrtc --long
WebRTC Peer-to-peer connections ✔ 55.36% ◒ 0% [W3C Working Draft]
  Method of allowing two users to communicate directly, browser to browser using the RTCPeerConnection API.
  #JSAPI

  IE ✘
  Edge ✘
  Firefox ✘ 2+ ✔ 22+ᵖ
  Chrome ✘ 4+ ✔ 23+ᵖ
  Safari ✘
  Opera ✘ 9+ ✔ 18+ᵖ

P.S: Do cehckout the CLI flags

GIF FTW!

caniuse-cmd.gif

Thanks to Sam Gentle for bringing this to the CLI.

Combokeys

combokeys

Handles keyboard shortcuts in the browser.

combokeys is a fork of ccampbell/mousetrap with two main changes:

  • Refactored as CommonJS
  • Doesn't automatically listen on the document. Instead, it is now a constructor and the element on which to listen must be provided on instantiation.

Install it: npm install --save combokeys

Sample usage:

1
2
3
4
5
6
7
var Combokeys = require("combokeys");
var Mousetrap = new Combokeys(document.documentElement);
// Or, instantiate it for one or more specific elements:
var firstCombokeys = new Combokeys(document.getElementById("first"));

firstCombokeys.bind('4', function() { console.log('4'); });
firstCombokeys.bind("?", function() { console.log('show shortcuts!'); });

GIF FTW!

combokeys

Thanks to Shahar Or for porting mousetrap to combokeys.

Easydate

easydate

get date and/or time by pattern.

A simple date and time util that returns the date according to a pattern, easydate takes two arguments, first one being a pattern string and second one being an config object.

Pattern Options:

  • Y Full year (number - e.g. 2012)
  • y Year (number - e.g. 12)
  • M Month (number - e.g. 11)
  • d Day (number - e.g. 28)
  • h Hour (number - e.g. 02)
  • m Minute (number - e.g. 01)
  • s Second (number - e.g. 33)
  • l Millisecond (number - e.g. 001)
  • z Timezone (string - e.g. UTC, UTC+1, UTC-11)
  • x DST (string - either 'DST' or '')

Config options:

1
2
3
4
5
{
    setDate: 'Date',
    timeZone: 'utc/local',
    adjust: 'Whether or not to adjust DST'
}

Install it: npm install --save easydate

Sample usage:

1
2
3
4
5
6
7
8
9
10
var easydate = require('easydate')


easydate('d-M-y');

easydate('h:m:s.l', '2015-11-03T16:06:08.123Z') // "16:06:08.123"

easydate('z', {timeZone: 'utc'}) // => "UTC"

easydate('h:m:s z x', {setDate: '2016-08-01T00:00:00.000Z', adjust: true})

GIF FTW!

easydate

Thanks to Rory Bradford for this handy util.