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
| module.exports = function findChildren(root, items = [], opts = {}) { | |
| const { rootKey, foreignKey, withRoot } = opts | |
| const bypass = {} | |
| let children = [root] | |
| let nextItems = [] | |
| recurse() | |
| if (!withRoot) | |
| children.shift() | |
| return children |
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 isString(target) { | |
| return isType(target, 'String') | |
| } | |
| function isNumber(target) { | |
| return isType(target, 'Number') | |
| } | |
| function isDate(target) { |
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 _ = require('lodash') | |
| const faker = require('faker') | |
| console.time('make data') | |
| const seed = 20000 | |
| const authors = _.times(seed, n => ({ | |
| id: 'a' + n, | |
| name: faker.name.findName(), |
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
| export LANGUAGE="en_US.UTF-8" | |
| export LC_ALL="en_US.UTF-8" | |
| echo LANGUAGE=en_US.UTF-8 >> /etc/default/locale | |
| echo LC_ALL=en_US.UTF-8 >> /etc/default/locale | |
| apt update | |
| apt install -y mdadm xfsprogs | |
| lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT |
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
| sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 | |
| echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list | |
| wget https://nginx.org/keys/nginx_signing.key -O - | sudo apt-key add - | |
| echo "deb http://nginx.org/packages/ubuntu/ xenial nginx | |
| deb-src http://nginx.org/packages/ubuntu/ xenial nginx" | sudo tee /etc/apt/sources.list.d/nginx.list | |
| apt update | |
| apt install -y build-essential python mongodb-org nginx |
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
| import utils from '/server/utils'; | |
| /* eslint-disable prefer-arrow-callback */ | |
| import { check, Match } from 'meteor/check'; | |
| import Collections from '../../lib/collections'; | |
| import cacheManager from '../cache.js'; | |
| import {checkIssueMembership} from '../../lib/is-member.js'; | |
| import _ from 'lodash'; | |
| const { Issues, Activities, Users, IssueMembers, Groups, Tags, Documents } = Collections; |
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
| import { compose } from 'react-komposer' | |
| function RV(component, states) { | |
| const localStates = {} | |
| const localValues = {} | |
| for (let state in states) { | |
| localStates[state] = new ReactiveVar(states[state]) | |
| } |
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
| import _ from 'lodash' | |
| const test1 = [ | |
| { name: 'zhanghong', age: 32, money: 0, size: 12, }, | |
| { name: 'wanghong', age: 20, size: 6 }, | |
| { name: 'jinhong', age: 16, height: 172 }, | |
| ] | |
| const test2 = [ | |
| { name: 'zhanghong', gender: 'male', age: 14 }, |
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
| // === Arrays | |
| var [a, b] = [1, 2]; | |
| console.log(a, b); | |
| //=> 1 2 | |
| // Use from functions, only select from pattern | |
| var foo = () => [1, 2, 3]; |
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
| { | |
| "keys": ["tab"], | |
| "command": "expand_abbreviation_by_tab", | |
| // put comma-separated syntax selectors for which | |
| // you want to expandEmmet abbreviations into "operand" key | |
| // instead of SCOPE_SELECTOR. | |
| // Examples: source.js, text.html - source | |
| "context": [ | |
| { |