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
.fluid-type { | |
font-size: clamp(1rem, 4cqi, 3rem); | |
} |
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
// Using a reducer allows you to control field validation etc | |
// without having a million useState(); calls and logic spanning across multiple functions. | |
import { useReducer } from "react"; | |
function EditCalendarEvent() { | |
const [event, updateEvent] = useReducer( | |
(prev, next) => { | |
const newEvent = { ...prev, ...next }; |
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
<script runat="server"> | |
// You can POST to this endpoint in order to quickly subscribe someone to a Data Extension. | |
// The request body expects a JSON object with a property labelled "de" that uses the Marketing Cloud | |
// Data Extension ID (e.g. 6ded84cc-9fbf-4ec5-83e3-06cc82fb380a) | |
// The rest of the JSON object is just key/value pairs for each field name and field value. | |
// | |
// Example: | |
// POST /subscribe | |
// {"de":"6ded84cc-9fbf-4ec5-83e3-06cc82fb380a","FirstName": "Joe","LastName":"Bloggs","Email":"[email protected]"} | |
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
// 1) Use the Cloudlflare Pages/Github integration to build everytime there is a push to the main branch. | |
// 2) In github settings for the repo, create a new webhook that only triggers on "Check runs". |
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 * as React from "react"; | |
import { render } from "react-dom"; | |
import produce from "immer"; | |
import { set, has } from "lodash"; | |
import "./styles.css"; | |
function enhancedReducer(state, updateArg) { | |
// check if the type of update argument is a callback function | |
if (updateArg.constructor === Function) { |
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 { useState, useRef, useEffect, forwardRef, useImperativeHandle } from 'react'; | |
import Button from '@material-ui/core/Button'; | |
import Dialog from '@material-ui/core/Dialog'; | |
import DialogActions from '@material-ui/core/DialogActions'; | |
import DialogContent from '@material-ui/core/DialogContent'; | |
import DialogContentText from '@material-ui/core/DialogContentText'; | |
import DialogTitle from '@material-ui/core/DialogTitle'; | |
/* | |
USAGE: |
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 { createContext, useState } from 'react'; | |
//create a context, with createContext api | |
export const userContext = createContext(); | |
const UserProvider = (props) => { | |
// this state will be shared with all components | |
const [loggedin, setLoggined] = useState(false); | |
return ( |
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 React from 'react'; | |
import Document, { Html, Head, Main, NextScript } from 'next/document'; | |
import { ServerStyleSheets } from '@material-ui/core/styles'; | |
import theme from '../styles/theme'; | |
// This makes sure that Material UI renders correctly on the server side as well | |
// See https://dev.to/felixmohr/setting-up-a-blog-with-next-js-react-material-ui-and-typescript-2m6k | |
export default class MyDocument extends Document { | |
render() { |
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
export default class Example extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
count: 0 | |
}; | |
} | |
render() { | |
return ( |
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
SELECT | |
ocr.ContactId, | |
ocr.OpportunityCloseDate, | |
ocr.OpportunityAmount, | |
LAG(ocr.OpportunityCloseDate, 1) OVER (PARTITION BY ocr.ContactId ORDER BY ocr.OpportunityCloseDate ASC) AS `Prev` | |
FROM | |
`OpportunityContactRoles` AS ocr | |
WHERE | |
ocr.OpportunityAmount > 0 | |
ORDER BY |