Skip to content

Instantly share code, notes, and snippets.

View david-mart's full-sized avatar
🍭

David Mart david-mart

🍭
View GitHub Profile
{
"summary": "Test Event",
"location": "5250 Lankershim Blvd, #700, North Hollywood, CA 91601",
"description": "Test event at SADA HQ.",
"start": {
"dateTime": "2024-01-20T09:00:00-07:00",
"timeZone": "America/Los_Angeles"
},
"end": {
"dateTime": "2024-01-20T17:00:00-07:00",
@david-mart
david-mart / yq.md
Last active September 11, 2023 07:04

YQ Recipies

Unnest dot-separated keys object

yq -p=json -o=json -i=0 junk/model.jsonl | 
yq -p=json -o=json -i=0 '(
    .output_text 
  | from_json 
  | . as $x 
 | keys 
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";
@david-mart
david-mart / pancakeswap-tokenprice.js
Created June 12, 2021 02:00
PancakeSwap Token Price
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);
const includeTags = (ids) => `exists (
select *
from jobtag jt
where jt.job_id = job.id
and shop_tag_id in (${ids})
group by job_id
having count(*) >= ${ids.length}
)`;
const excludeTags = (ids) => `not exists(
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,
});
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 = {} }) => {
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
const [updateTask] = useMutation(UPDATE_TASK, {
refetchQueries: ['getTask', 'getTasks'],
});
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') }}>