Skip to content

Instantly share code, notes, and snippets.

@KTruong008
KTruong008 / app.svelte
Created November 2, 2023 14:30
Example hooking into button
<style>
</style>
<script>
import { onDestroy } from "svelte";
import { checkoutButtonSelectors } from "../constants.js";
import { shopSpecificOverrides } from "../overrides.js";
import {
areStylesheetsLoaded$,
@KTruong008
KTruong008 / .js
Created September 17, 2017 22:11
import React from 'react';
import { Field } from 'redux-form';
import Text from '../components/text';
export const FormComponent = ({ handleSubmit, onSubmit }) => {
return (
<div className="flex flex-column justify-center items-center">
<h1>My Very own Form</h1>
<form
className="w-80"
### Keybase proof
I hereby claim:
* I am ktruong008 on github.
* I am ktruong008 (https://keybase.io/ktruong008) on keybase.
* I have a public key ASBeEpy6J3FzgX4_0fd7reDtu_dvkE6rJLXqsjANCjdC1Ao
To claim this, I am signing this object:
@KTruong008
KTruong008 / date-utc.js
Created May 23, 2020 03:04
JS Date UTC methods
Date.getUTCDate()
Date.getUTCDay()
Date.getUTCHours()
Date.toUTCString()
@KTruong008
KTruong008 / date.js
Created May 23, 2020 03:03
default JS date methods
Date.getDate()
Date.getDay()
Date.getHours()
Date.toString()
@KTruong008
KTruong008 / hasura-first-look-example.ts
Created May 23, 2020 01:17
A first look at hasura example
export const promotionsFetchEpic = (
action$: ActionsObservable<PayloadAction>,
state$: StateObservable<StoreState>,
): Observable<PayloadAction> =>
action$.pipe(
filter((action) => action.type === appDataFetchSuccess.toString()),
asyncRequest(
promotionsFetchStart.toString(),
promotionsFetchSuccess.toString(),
promotionsFetchError.toString(),
// app.middleware.js
const buildScriptTagSrcUrl = (): string => {
return process.env.SCRIPT_TAG_URL || '';
};
export const initializeApp = async (ctx) => {
...
await createScriptTag(
buildScriptTagSrcUrl(),
// cross-sell.graphql.ts
export const crossSellQueryTypeDefinitions = `
crossSell(crossSellId: Int): CrossSell
productCrossSells(productId: String): [CrossSell!]
`;
export const crossSellTypeDefinitions = `
type CrossSell {
displaysProductPrice: Boolean
// shared.ts
export const graphqlRequest = async <T>(
query: string,
variables = {},
): Promise<T> => {
const headers = {
...buildContentTypeHeader('application/json'),
};
import styled, { keyframes } from 'styled-components';
const coolBoxKeyframes = keyframes`
0% {
height: 0px;
background: green;
}
100% {
height: 200px;
background: blue;