ppi,每英寸像素数量。
根据像素和屏幕尺寸计算 ppi。
/*
categories: | |
- category: tech | |
feeds: | |
- http://rachelbythebay.com/w/atom.xml | |
- http://feeds.feedburner.com/ruanyifeng | |
- http://blog.samaltman.com/posts.atom | |
- https://dave.cheney.net/feed/atom |
const dotenv = require('dotenv') | |
const path = require('path') | |
const fs = require('fs') | |
function load() { | |
if (process.env.stack) { | |
return dotenv.config({ path: path.join(__dirname, `.env.${process.env.stack}`) }) | |
} | |
return dotenv.config() | |
} |
// saved at root of repo, or global | |
registry = https://registry.npm.taobao.org | |
sass_binary_site = https://npm.taobao.org/mirrors/node-sass/ | |
electron_mirror = https://npm.taobao.org/mirrors/electron/ |
function repeatChar(char, times) { | |
if (typeof String.prototype.repeat === 'function') { | |
return char.repeat(times) | |
} | |
let count = 0 | |
const array = [] | |
while (count < times) { | |
count += 1 | |
array.push(char) | |
} |
const debounce = (func, delay) => { | |
let inDebounce | |
return function() { | |
const context = this | |
const args = arguments | |
clearTimeout(inDebounce) | |
inDebounce = setTimeout(() => func.apply(context, args), delay) | |
} | |
} |
/* | |
* | |
* Demo: https://repl.it/@wangpin34/array-utils | |
*/ | |
/* | |
* Filter elements which pass the test function | |
*/ | |
func filter(in interface{}, testFunc func(interface{}) bool) *[]interface{} { | |
b, _ := json.Marshal(in) |
.env.dev | |
.env.qa | |
.env.stg | |
.env.prod |
function handleKeydown(e) { | |
if (e.shiftKey) { | |
if (e.which !== 9) { | |
e.preventDefault() | |
} | |
} | |
if (e.which > 57) { | |
e.preventDefault() | |
} | |
if (e.which === 32) { |
app.js
import React, { Component } from 'react';
import './app.scss';
const Bracket = ({b}) => <span className="bracket"> {b} </span>;
const ListWrapper = ({children}) => <section>{children}</section>;
const MapWrapper = ({children}) => <section>{children}</section>;
const NodeKey = ({k}) => (<label>{'"' + k + '"'}:</label>);