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, PropTypes } from 'react' | |
export default class Field extends Component { | |
constructor(props, context) { | |
super(props, context) | |
const { | |
name, type, value, checked | |
} = props |
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
const unit = { | |
// @todo | |
} | |
function SmartNumber(n) { | |
if (typeof n === 'number') { | |
if (n<1e3) { | |
return n | |
} else if(n<1e4) { | |
return [n/1e3, '千'] | |
} else if(n<1e6) { |
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
const markdownIt = require('markdown-it') | |
const frontMatter = require('front-matter') | |
const Prism = require('prismjs') | |
const aliases = { | |
'js': 'jsx', | |
'html': 'markup' | |
} | |
const highlight = (str, lang) => { |
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
'use strict'; | |
var React = require('react'); | |
function createAsyncHandler(getHandlerAsync, displayName) { | |
var Handler = null; | |
return React.createClass({ | |
displayName: displayName, |
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(d) { | |
d.addEventListener('touchstart', handler) | |
d.addEventListener('touchmove', handler) | |
function handler(e) { | |
e.preventDefault() | |
} | |
})(document.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
(function (doc, win) { | |
var docEl = doc.documentElement, | |
isIOS = navigator.userAgent.match(/iphone|ipod|ipad/gi), | |
dpr = isIOS? Math.min(win.devicePixelRatio, 3) : 1, | |
dpr = window.top === window.self? dpr : 1, //被iframe引用时,禁止缩放 | |
dpr = 1, // 首页引用IFRAME,强制为1 | |
scale = 1 / dpr, | |
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'; | |
docEl.dataset.dpr = win.devicePixelRatio; |
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
var result = []; | |
var phoneTypes = []; | |
var filters = ['微博', 'Android']; | |
var baseUrl = 'http://m.weibo.cn/single/rcList?format=cards&id=3877877018124939&type=comment&hot=1&page='; | |
var userUrl = 'http://weibo.com/u/' |
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
var React = require('react'); | |
var EventListener = require('react/lib/EventListener'); | |
var partition = require('linear-partitioning'); | |
var TileLayout = React.createClass({ | |
getDefaultProps: function() { | |
return { | |
gutter: 0, | |
photos: [] | |
} |
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
<style id="jsbin-css"> | |
.tabs { | |
position: relative; | |
width: 25em; | |
list-style: none; | |
padding: 0; | |
} | |
.tabs li { | |
float: left; |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
snipfile=sys.argv[1] | |
content='' | |
for line in open(snipfile).readlines(): | |
if line[0] != '#' and line[0:7] != 'snippet': | |
line='\t'+line | |
content=content+line |