Skip to content

Instantly share code, notes, and snippets.

View suhaotian's full-sized avatar
🎯
Focusing

su suhaotian

🎯
Focusing
View GitHub Profile
/*
introduction: 中国最新省市区数据
发布时间:2017-03-10 10:33
usage:
- open http://www.stats.gov.cn/tjsj/tjbz/xzqhdm/201703/t20170310_1471429.html
- copy below lines code to console (F12)
data: https://gist.githubusercontent.com/suhaotian/cd31a6ca16e5298a1aae3dc7871d0660/raw/368916778e2cd8c0fa15f378879fa89dadaa96e8/china-address.json
*/
let provinces = []
[
{
"code": "110000",
"name": "北京市",
"city": [
{
"code": "110100",
"name": "市辖区",
"area": [
{
const React = require('react');
const ReactDOMServer = require('react-dom/server');
require('babel-register')({
extensions: ['.jsx']
});
hexo.extend.renderer.register('jsx', 'html', function(data, options) {
require.cache[data.path] && delete require.cache[data.path]
@suhaotian
suhaotian / delete-sourcemap.js
Last active June 20, 2017 09:17
Delete sourcemap files in create-react-app
// in package.josn, add below lines to scripts:
// "postbuild": "node ./delete-sourcemap.js"
const fs = require('fs')
function deleteMaps(dir) {
fs.readdir(dir, function(err, files) {
files.forEach((file) => {
if(/\.map$/.test(file)) {
fs.unlinkSync(dir+file)
function initWindowManager() {
ipcMain.on('create-window', function(e, arg) {
let w = new BrowserWindow(arg[0])
w.loadURL(arg[1])
w.on('closed', function () {
w = null
})
})
}
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
async function a() {
const result = await fetch('https://api.github.com')
return result
}
console.log(a())
const fetch = require('node-fetch')
const url = '' // url
let result = []
fetch(url+1).then(res => res.json()).then(res => {
const total = res.cardlistInfo.total
const arr = []
result = result.concat(res.cards)
{
"af": "Afrikaans",
"sq": "Albanian",
"ar": "Arabic",
"hy": "Armenian",
"az": "Azerbaijani",
"eu": "Basque",
"be": "Belarusian",
"bn": "Bengali",
"bs": "Bosnian",
{
"af": "Afrikaans",
"ar": "Arabic",
"bs-Latn": "Bosnian (Latin)",
"bg": "Bulgarian",
"ca": "Catalan",
"zh-CHS": "Chinese Simplified",
"zh-CHT": "Chinese Traditional",
"hr": "Croatian",
"cs": "Czech",
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
ul {
margin: 0;
padding: 0;