This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a bigger error exercise than the previous ones! | |
// You can do it! | |
// | |
// Edit the `read_and_validate` function so that it compiles and | |
// passes the tests... so many things could go wrong! | |
// | |
// - Reading from stdin could produce an io::Error | |
// - Parsing the input could produce a num::ParseIntError | |
// - Validating the input could produce a CreationError (defined below) | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage: node generate.js 10x300 | |
const fs = require('fs'); | |
const path = require('path'); | |
const placeholder = (rowIndex, colIndex) => Math.random().toString(36).substring((rowIndex + colIndex) % 7); | |
const tpl = (col, row) => { | |
const colArr = new Array(col).fill(); | |
const rowArr = new Array(row).fill(); | |
return ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"extends": [ | |
"tslint-react" | |
], | |
"rules": { | |
"align": [ | |
true, | |
"parameters", | |
"arguments", | |
"statements" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker rmi $(docker images -qa -f "dangling=true") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker rm -f $(docker ps -a -q | awk '{if($1!~/92033adc934d/) print}') | |
docker network rm $(docker network ls | awk '{if($2~/-network/) print $2}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
const argv = require('minimist')(process.argv.slice(2)); | |
const lodash = require('lodash'); | |
const setUrl = require('./utils/setUrl'); | |
const flattenArgs = args => { | |
let argsArr; | |
if (!args) { | |
argsArr = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const lodash = require('lodash'); | |
const toArray = require('../utils/toArray'); | |
const { CONSTANTS: C } = require('../globals'); | |
const NAME_ALIAS = '名称'; | |
function hint(options) { | |
const rules = ['Check your selector value.']; | |
if (!options.debug) { | |
rules.push('Add { debug: true } to your options to get more info.'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -i \ | |
--rm \ | |
--name node-test \ | |
-v "$PWD":/code \ | |
-w /code node:latest \ | |
/bin/bash -c "npm i --silent --progress=false --registry=https://registry.npm.taobao.org && npm run test" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function longTask(int, callback) { | |
if (int < 0) { | |
callback(new Error('less than 0')); | |
} else { | |
callback(null, 'done'); | |
} | |
} | |
// callback | |
longTask(1, (err, result) => {}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> callback here | |
added element type node <body>…</body> | |
[found with selector "div p"] | |
added element type node <div>…</div> | |
[found with selector "div p"] | |
added element type node <p></p> | |
added element type node <script></script> | |
>>> callback here | |
added element type node <a></a> |
OlderNewer