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 ApolloClient from 'apollo-boost'; | |
const client = new ApolloClient({ | |
uri: '<your graphql endpoint>', | |
// Apollo Boost allows you to specify a custom error link for your client | |
onError: ({ graphQLErrors, networkError, operation, forward }) => { | |
if (graphQLErrors) { | |
for (let err of graphQLErrors) { | |
// handle errors differently based on its error code | |
switch (err.extensions.code) { |
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 CsvReader = require('./csv-reader'); | |
// reusing what we've done before. | |
const exisMath = { | |
sum (...args) { | |
return args.reduce((acc, i) => { | |
return parseFloat(acc) + parseFloat(i) | |
}, 0) | |
}, | |
} |
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
// Child component | |
// ======================================================================= | |
import React, { useState } from 'react'; | |
function componentToJson(component) { | |
let jsonTree = {}; | |
if (typeof component === 'string') { | |
return { type: 'text', value: component }; | |
} else { | |
jsonTree.type = component.type; |
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
{ | |
field: "fieldname", | |
width: 130, | |
editable: true, | |
renderEditCell: (params) => renderCell({ ...params, onPaste }), | |
} |
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
其实我主要是想说,我送给了你一个钥匙,希望可以打开你内心的一扇门,你笑着说,那就看看是不是可以打开。 | |
我不敢说我完全了解你,你很不简单,是一个很有深度的女人,我还没有足够的机去了解你,但我相信我对你是用心去体会的,所以我对于我自己的想法,还是有一点自信。 | |
其实有一瞬间我突然发现,男人一冲动,就会成为一个小孩儿一样。 | |
你听说过内心小孩的说法吗?每个人心里都有一个内心小孩,而和你在一起,我看到了你坚强成熟的外壳下,其实同样是有一个纯真的内心小孩。 | |
和你相处真的好开心,每次和你见面之后,我都会有一种失落感,就像磕完药的感觉。首先说我没磕过药啊,但我觉得大概嗑药之后会有这种感觉。 |
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 API_BASE_URL = 'https://api.example.com/deviceOnlineStatus' | |
const API_BEARER_TOKEN = `eyJ0eXAiOiJKadsCJhbGciOiJIy45wNiJ9.eyJpc3MiOiJ5ZWx...` | |
interface DeviceStatus { | |
[deviceId: number]: boolean; | |
} | |
const fetchDeviceStatus = async (deviceId: number, retries: number = 3): Promise<boolean> => { | |
/** | |
* Alloe retries in case of network issues. |
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
sudo networksetup -setairportpower en0 off; sudo networksetup -setairportpower en0 on; sudo spoof randomize en0 |