Skip to content

Instantly share code, notes, and snippets.

// 触宝输入法快捷输入配置文件制作器
// 文件位置: /data/data/com.cootek.smartinputv5/files/v5701/shortcut.lst
const fs = require('fs')
function read() {
const data = fs.readFileSync('/tmp/shortcut.lst')
let offset = 4
const count = data.readUInt32LE()
@hjkcai
hjkcai / parallel.ts
Last active March 5, 2020 15:06
2018-3-2 面试题
// 实现一个方法 parallel(tasks, concurrency),让 tasks 并发执行(并控制并发数为 concurrency)
// 其中 tasks 为一个数组,每一个元素都是一个方法返回一个 promise
// 当所有 tasks 执行完成时,resolve 一个数组保存所有的结果
// 当任意一个 task 执行失败时,reject 这个错误
// 运行方法:
// $ tsc parallel.ts --target esnext && mocha parallel
declare const require
declare const describe
@hjkcai
hjkcai / concurrency.js
Created March 2, 2018 09:14
2018-3-2 面试题(面试结束时的版本)
// 实现一个方法 parallel(tasks, concurrency),让 tasks 并发执行(并控制并发数为 concurrency)
// 其中 tasks 为一个数组,每一个元素都是一个方法返回一个 promise
// 当所有 tasks 执行完成时,resolve 一个数组保存所有的结果
// 当任意一个 task 执行失败时,reject 这个错误
const assert = require('assert')
function task (input) {
return () => new Promise(resolve => {
setTimeout(() => resolve(input), 1000)
@hjkcai
hjkcai / comp.wpy
Last active July 16, 2017 04:15
嵌套组件中同时出现wx:for和repeat会导致repeat中循环变量失效
<template>
<view class="comp">
<slot></slot>
</view>
</template>
<script>
import wepy from 'wepy'
export default class Comp extends wepy.component {}

Summer holiday front-end development journey

This is a nice program to train your front-end web development skill by several small projects. Each project focuses on different key points. The projects will be ordered by its skill level. They will be harder and harder to finish. After each project dues, we will have an online review on your code.

Here are some basic requirements:

  • Stupid question will not be answered. Google it yourself.
  • You must push all your code to a github repository called web-learning.
  • Every commit must not contain too much changes to let me easily check how you have done these works.
  • Commit messages must be clear and detailed.

深大官微 - 技术部 - JavaScript笔试题

充满套路的一份试卷

1. 填空题

  1. Array.prototype.splice 函数会改变原数组(正确或错误)

  2. 下面代码可以输出 0 ~ 9(正确或错误)

    for (var i = 0; i < 10; i++) {

10.14 JavaScript 培训纲要

  1. 前言

    • 课后前后端分组
    • 今天讲的以概念为主,回去要自己多练
  2. 基础概念

    1. 表达式(expression)

      表达式是由一个或多个确定的常量变量运算符函数组成的, 并且可以通过编程语言解析、计算后,产生另一个值

深大官微技术部 3.0 最终考核题

下面的考核题,前端后端的是不一样的。 前端的同学任选一题前端的题,后端的同学任选一题后端的题

对于所有题目,代码结构都会作为评判的一个重要标准! 尽可能把你的打码写漂亮(不只是长的漂亮)


1. 计算两个日期的天数差

函数模板

function daySpan (date1, date2) {
  // your code
}

函数参数