This file contains 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
/** | |
* @author monkindey | |
* @date 2014-09-23 | |
* @reference http://stackoverflow.com/questions/22675126/ | |
* what-is-offsetheight-clientheight-scrollheight | |
*/ | |
var $id = function(id){ | |
return document.getElementById(id); | |
}; | |
var box = $id('box'); |
This file contains 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
/** | |
* @author: monkindey | |
* @date: 2014-11-15 | |
* @descripion: 用面向对象的代码来介绍自己 | |
*/ | |
! function() { | |
// HELPER | |
function extend(sup, overrides) { | |
var sub = overrides && overrides.constructor || function() { | |
sup.apply(this, arguments); |
This file contains 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
/** | |
* @author others|monkindey | |
* @date 2014-11-18 | |
* @reference http://sublime-text.readthedocs.org/en/latest/reference/build_systems.html | |
*/ | |
{ | |
// 命令执行 | |
"cmd": ["gcc", "${file}", "-o", "${file_path}/${file_base_name}"], | |
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", |
This file contains 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
/** | |
* @author monkindey | |
* @date 2014.11.24 | |
* @idea { | |
* 1. 给A数组排序(快排) | |
* 2. 从小到大顺序构造双向链表 | |
* } | |
*/ | |
#include <stdio.h> |
This file contains 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
/** | |
* @author monkindey | |
* @date 2014.11.25 | |
* @description 序列和的前n小元素 | |
*/ | |
#include <stdio.h> | |
#include <malloc.h> | |
int rows[3], columns[3]; | |
int main() { |
This file contains 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
/** | |
* @author monkindey | |
* @date 2014.11.27 | |
* @description 用树状数组实现逆序对 | |
* @idea { | |
* 数组离散化 | |
* 离散化数组进行树状数组操作 | |
* } | |
*/ | |
#include <stdio.h> |
This file contains 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
去追一个高产的人的所有repo, 你会发现很多好玩的东西。 | |
他们的解决思路总是让你意想不到, 所以分开去追吧, 然后把在开源世界学习的东西反馈到业务上。 |
This file contains 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 iconv = require('iconv-lite'); | |
const diaoEn = 'diao'; | |
const diao = '很屌'; | |
const diaoUTFBuf = Buffer.from(diao); | |
// 用utf-8编码的很屌, 然后用gbk去解码, 导致乱码了 | |
const decoded = iconv.decode(diaoUTFBuf, 'gbk'); | |
// mojibake(乱码) |
This file contains 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
app.set('view engine', 'html'); | |
app.engine('html', require('ejs').renderFile); |
This file contains 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 React, { Component, cloneElement } from 'react'; | |
import ReactDOM from 'react-dom'; | |
const injectRender = Decorated => { | |
class Inject extends Decorated { | |
render() { | |
const renderElement = super.render(); | |
const children = React.Children | |
.map(renderElement.props.children, child => { | |
if (typeof child === 'string') { |
OlderNewer