Skip to content

Instantly share code, notes, and snippets.

@colin-han
colin-han / less.targets
Last active June 9, 2016 06:02
Build LESS by msbuild
<!--
Usage:
1. Download this file into your project folder, named it as "Less.targets"
2. Use notepad to open your project file (e.g. Example.csproj), and put following code to above of end element 'Project'.
<Import Project="Less.targets" />
3. Change element type of *.less file in your project file to "LessCompile".
You need to do that manual first time. After that, you can change the file's "build action" to 'LessCompile' through PropertyGrid.
4. Close notepad and reload your project in VisualStudio. Then press F6 to build your project.
You will found the css file will be generated by build process automatically.
-->
@colin-han
colin-han / Functional Programming练习题.md
Last active May 10, 2022 06:32
Functional Programming练习题

一、理解函数式编程

1. 有一个Web服务,为你提供了如下的数据结构:

难度:★

var data = [
  {
    name: "Jamestown",
    population: 2047,
    temperatures: [-34, 67, 101, 87]

},

@colin-han
colin-han / cannot_read_property_push_of_undefined.js
Last active February 22, 2017 06:40
Failed execute on MySql database
let Sequelize = require('sequelize');
let sequelize = new Sequelize('test', 'root', 'xA123456', {
host: 'localhost',
dialect: 'mysql',
});
let Product = sequelize.define('Product', {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
@colin-han
colin-han / Promise.md
Last active July 12, 2019 06:13
P2M training exam

使用Node.JS (版本>= 8)完成下题:

假设系统提供了三个函数:

  • Project.create({name: 'P1', ownerId: 1}) 函数
    在数据库中的Project表中创建一条记录。函数返回一个Promise对象。resolve方法的参数是一个Project对象:{id: 1, name: 'P1', ownerId: 1}
  • Task.create({projectId: 1, title: 'T1', assignTo: 1})函数
    在数据库中的Task表中创建一条子记录。这个记录通过projectId和Project表关联。函数返回Promise对象,resolve对象例如:{id: 1, projectId: 1, title: 'T1', assignTo: 1}
  • User.create({name: 'U1'})函数
    在数据库中的User表中创建一条记录。{id: 1, name: 'U1'}

给你一个如下的数据结构:

{
  "users": [
    {
      "id": "20c89779-aba7-4b8f-873c-b2f27e761d1f",
      "name": "colinhan",
      "displayName": "Colin Han",
      "company": "上海皮图麦信息科技有限公司",
      "department": "研发部",
@colin-han
colin-han / promise-exam.md
Last active April 1, 2019 07:48
Promise-exam