Skip to content

Instantly share code, notes, and snippets.

View fuchao2012's full-sized avatar
🎯
Focusing

zheng fuchao2012

🎯
Focusing
View GitHub Profile
@fuchao2012
fuchao2012 / arrow-function.js
Last active February 23, 2017 03:17
arrow-function #tags ES6, javascript
let DataService = {
hostUrl: 'https://abc.com/',
search(query){
return fetch(`$(this.hostUrl)}/search?query=${query}`)
.then(res=>res.json())
.then(rows=>fetch(`${this.hostUrl}/detail?id=${rows.id}`))
.then(res=>res.json())
}
}
@fuchao2012
fuchao2012 / let.js
Created February 22, 2017 06:17
IIFT-let
//error-version
//html
button{$}*4
.output
//js
var buttons = document.querySelectorAll('button')
var output = document.querySelctor('.output')
@fuchao2012
fuchao2012 / module-demo.js
Created February 22, 2017 05:59
ES6-Original-Module-Demo
import fs from 'fs'
import readline from 'readline'
import path from 'path'
const noop = () => false
let Module = {
readLineInFile(filename, cb = noop, done = noop){
let rl = readline.createInterface({
input: fs.createReadStream(path.resolve(__dirname, './big_file.txt'))
@fuchao2012
fuchao2012 / arrayof.js
Created February 21, 2017 08:16
Array.of()
Object.defineProperty(Array, 'of', {
value: ()=> [].slice.call(arguments)
})
@fuchao2012
fuchao2012 / toArray.js
Created February 21, 2017 08:10
Array.from
((global)=>{
Object.defineProperty(Array, 'from', {
value:obj=>[].slice.call(obj)
})
})(this)
@fuchao2012
fuchao2012 / isInteger.js
Created February 21, 2017 07:51
IsInteger
(function(global){
const MIN_SAFE_INTEGER = Math.MIN_SAFE_INTEGER
const MAX_SAFE_INTEGER = Math.MAX_SAFE_INTEGER
let floor = Math.floor, isFinite = global.isFinite
Object.defineProperty(Number, 'isInteger', {
value: (value)=>(typeof value === 'number' && isFinite(value) && value >= MIN_SAFE_INTEGER && value <= MAX_SAFE_INTEGER && floor(value) === value),
configurable: true,
enumerable: true,
writable: true
})
@fuchao2012
fuchao2012 / test.md
Last active February 10, 2017 05:38
lepton test for gist #rumors

#hello

markdown it ?

mkdir fuck && $_
@fuchao2012
fuchao2012 / index.html
Created October 9, 2016 12:04
tongji.baidu.com
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?a3b0492c9a3bc500fe00dee6faaafd59";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
@fuchao2012
fuchao2012 / dabblet.css
Last active August 26, 2016 10:32
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
.container{
background:green;
}
.red{
margin:0 auto;
margin-top:20vh;
width:30vw;
.chevron-left {
position: relative;
height: $banner-height;
width: 100%;
}
.chevron-left:before {
content: '';
position: absolute;