2019.05.30

[视频] 利用 SocketIO 实时发送数据:https://www.youtube.com/watch?v=9HFwJ9hrmls

[类库] slash 一致化处理路径中的分隔符:https://github.com/sindresorhus/slash

[类库] TJ 写的命令行选项和参数解析器,支持子命令、选项校验、类型转换,帮助信息生成等等;API 非常的简单优雅:https://github.com/tj/commander.js

[工具] 用命令行,显示 MacOS 信息如,内存、CPU;和查看本机一致:https://github.com/obihann/archey-osx

[工具] DevDash 是基于 Terminal 的仪表板,支持从 Github,Google Analytics 或 Google Search Console 中提取数据显示:https://github.com/Phantas0s/devdash

配图 - DevDash 是基于 Terminal 的仪表板

示例 - slash

const path = require('path');
const slash = require('slash');

const string = path.join('foo', 'bar');
// Unix    => foo/bar
// Windows => foo\\bar

slash(string);
// Unix    => foo/bar
// Windows => foo/bar

示例 - commander

const program = require('commander');

program
  .option('-d, --debug', 'output extra debugging')
  .option('-s, --small', 'small pizza size')
  .option('-p, --pizza-type <type>', 'flavour of pizza');

program.parse(process.argv);

if (program.debug) console.log(program.opts());
console.log('pizza details:');
if (program.small) console.log('- small pizza size');
if (program.pizzaType) console.log(`- ${program.pizzaType}`);

示例 - 用命令行,显示 MacOS 信息

                 ###                  User: jhann
               ####                   Hostname: obihann
               ###                    Distro: OS X 10.10.5
       #######    #######             Kernel: Darwin
     ######################           Uptime:  6:11
    #####################             Shell: /bin/zsh
    ####################              Terminal: xterm-256color iTerm.app
    ####################              Packages: 114
    #####################             CPU: Intel Core i5-3210M CPU @ 2.50GHz
     ######################           Memory: 8 GB
      ####################            Disk: 95%
        ################              Battery: 100.00%
         ####     #####               IP Address: 24.222.18.26

今日图 - 强大的原配气场