View pancakeswap-tokenprice.js
This file contains 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 Web3 from 'web3'; | |
import { Fetcher, ChainId, Token } from '@pancakeswap/sdk'; | |
import { JsonRpcProvider } from '@ethersproject/providers'; | |
import { BNB_ADDRESS, MAINNET_URL } from '../constants'; | |
const provider = new JsonRpcProvider('https://bsc-dataseed1.binance.org/'); | |
class Web3Service { | |
constructor() { | |
this.web3 = new Web3(MAINNET_URL); |
View rollup.config.js
This file contains 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 vue from "rollup-plugin-vue"; | |
import typescript from "rollup-plugin-typescript2"; | |
import commonjs from "rollup-plugin-commonjs"; | |
import { nodeResolve } from "@rollup/plugin-node-resolve"; | |
import postcss from "rollup-plugin-postcss"; | |
import vueGbsModule from "./prefix.plugin"; | |
import postcssImport from "postcss-import"; | |
import tailwind from "tailwindcss"; | |
import purgecss from "@fullhuman/postcss-purgecss"; | |
import prefixer from "postcss-prefixer"; |
View data.controller.js
This file contains 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
await consumer.update({ | |
phone_id: consumer.phones?.[0]?.id, | |
email_id: consumer.emails?.[0]?.id, | |
full_name_id: consumer.names?.[0]?.id, | |
g_address_id: consumer.addresses?.[0]?.id, | |
}); |
View react-apollo-cache-example-4.js
This file contains 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 TaskDetails = ({ id }) => { | |
const [updateTask] = useMutation(UPDATE_TASK); | |
const { data = {} } = useQuery(GET_TASK, { variables: { id } }); | |
const { task = { comments: [] } }: { task: ITask } = data; | |
const onUpdate = (key) => (value) => { | |
const task = { [key]: value }; | |
updateTask({ | |
variables: { task, id }, | |
update: (proxy, { data = {} }) => { |
View react-apollo-cache-example-3.js
This file contains 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 onUpdate = (key) => (value) => { | |
const task = { [key]: value }; | |
updateTask({ | |
variables: { task, id }, | |
update: (proxy, { data = {} }) => { | |
// update cache with local values | |
proxy.writeData({ id: `Task:${id}`, data: task }); | |
// or update cache with the values coming from the server, | |
// for example if you need to reflect the updated timestamp |
View react-apollo-cache-example-1.js
This file contains 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 TaskDetails = ({ id }) => { | |
const [updateTask] = useMutation(UPDATE_TASK); | |
const { data = {} } = useQuery(GET_TASK, { variables: { id } }); | |
const { task = { comments: [] } }: { task: ITask } = data; | |
const onUpdate = (key) => (value) => { | |
updateTask({ variables: { task: { [key]: value }, id } }); | |
}; | |
return ( | |
<div> | |
<Typography.Text strong editable={{ onChange: onUpdate('name') }}> |
View react-apollo-cache-example-2.js
This file contains 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 [updateTask] = useMutation(UPDATE_TASK, { | |
refetchQueries: ['getTask', 'getTasks'], | |
}); |
View LocationIcon.vue
This file contains 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
<template> | |
<svg | |
xmlns="http://www.w3.org/2000/svg" | |
xmlns:xlink="http://www.w3.org/1999/xlink" | |
width="28" | |
height="28" | |
viewBox="0 0 28 28" | |
> | |
<defs> | |
<circle id="my-location-a" cx="330" cy="366" r="8" /> |
View icon-url-generator.js
This file contains 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 Vue from 'vue' | |
import LocationIcon from './LocationIcon' | |
// create a constructor from a Vue component | |
const LocationIconConstructor = Vue.extend(LocationIcon) | |
export const getColoredIconUrl = (fillColor, strokeColor) => { | |
// create a Vue element with required props | |
const iconComponent = new LocationIconConstructor({ propsData: { fillColor, strokeColor } }) | |
// mount the component shadow DOM |
NewerOlder