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 print (path, layer) { | |
if (layer.route) { | |
layer.route.stack.forEach(print.bind(null, path.concat(split(layer.route.path)))) | |
} else if (layer.name === 'router' && layer.handle.stack) { | |
layer.handle.stack.forEach(print.bind(null, path.concat(split(layer.regexp)))) | |
} else if (layer.method) { | |
console.log('%s /%s', | |
layer.method.toUpperCase(), | |
path.concat(split(layer.regexp)).filter(Boolean).join('/')) | |
} |
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
/*eslint-disable*/ | |
var foo = { n: 1}; | |
(function(foo) { | |
console.log(foo.n); | |
foo.n = 3; | |
var foo = { n: 2 }; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script src="https://cdn.jsdelivr.net/lodash/4/lodash.min.js"></script> |
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 { jsdom } from 'jsdom'; | |
import chai from 'chai'; | |
import chaiEnzyme from 'chai-enzyme'; | |
import { shallow, mount, render } from 'enzyme'; | |
chai.use(chaiEnzyme()); | |
global.should = chai.should(); | |
global.shallow = shallow; |
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
<div> | |
<div id="preview" class="preview"> | |
<nav class="nav"> | |
<button class="close"> | |
返回 | |
</button> | |
</nav> | |
<div class="container"> | |
<button class="prev"><</button> | |
<button class="next">></button> |
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 React, { Component } from 'react'; | |
import hoistStatics from 'hoist-non-react-statics'; | |
function withStyles(style) { | |
return function wrapWithStyles(ComposedComponent) { | |
class WithStyles extends Component { | |
componentWillMount() { | |
style.use(); | |
} |
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
.gray { | |
-webkit-filter: grayscale(100%); | |
-moz-filter: grayscale(100%); | |
-ms-filter: grayscale(100%); | |
-o-filter: grayscale(100%); | |
filter: grayscale(100%); | |
filter: gray; | |
} |
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
<script type="text/javascript"> | |
$(document).ready(function(){ | |
alert($(window).height()); //浏览器时下窗口可视区域高度 | |
alert($(document).height()); //浏览器时下窗口文档的高度 | |
alert($(document.body).height());//浏览器时下窗口文档body的高度 | |
alert($(document.body).outerHeight(true));//浏览器时下窗口文档body的总高度 包括border padding margin | |
alert($(window).width()); //浏览器时下窗口可视区域宽度 | |
alert($(document).width());//浏览器时下窗口文档对于象宽度 | |
alert($(document.body).width());//浏览器时下窗口文档body的高度 |
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
hackSetTitle = (title) => { | |
document.title = title; | |
const iframe = document.createElement('iframe'); | |
iframe.src = '/favicon.ico'; | |
iframe.style.visibility = 'hidden'; | |
const listener = () => { | |
setTimeout(() => { | |
iframe.removeEventListener('load', listener); |
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 chai from 'chai'; | |
import sinon from 'sinon'; | |
import mock from 'mock-require'; | |
import moxios from 'moxios'; | |
mock('v2/models/globals/SessionState', { | |
currentUser: { | |
neoToken: '1234567890' | |
} | |
}); |