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
{ | |
"Redux-toolkit slice": { | |
"prefix": "reduxSlice", | |
"body": [ | |
"import { createSlice } from '@reduxjs/toolkit'", | |
"", | |
"export type InitialState = {}", | |
"", | |
"const initialState: InitialState = {}", | |
"", |
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 AWS from 'aws-sdk'; | |
import stream from 'stream' | |
import axios from 'axios'; | |
export default async (url, filename, callback) => { | |
const s3 = new AWS.S3({ params: { Bucket: process.env.STATIC_MAPS_BUCKET }}); | |
let contentType = 'application/octet-stream' | |
let promise = null | |
const uploadStream = () => { |
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
html, body { | |
background-color: #f2cd37; | |
} | |
.container { | |
width: 1000px; | |
margin: 0 auto; | |
} | |
.logo { |
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 { useEffect } from "react" | |
export function useDetectAppleDevice() { | |
const isMac = /(Mac|iPhone|iPod|iPad)/i.test(navigator.userAgent) | |
useEffect(() => { | |
if (isMac) { | |
document.documentElement.classList.add("apple-device") | |
} | |
}, [isMac]) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files"> | |
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/> | |
<dynamicTypes> | |
<add mimeType="text/*" enabled="true"/> | |
<add mimeType="message/*" enabled="true"/> | |
<add mimeType="application/javascript" enabled="true"/> | |
<add mimeType="*/*" enabled="false"/> |
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
<?php | |
function the_product_price($product){ | |
//get the sale price of the product whether it be simple, grouped or variable | |
$sale_price = '<span class="new">'.get_post_meta( get_the_ID(), '_price', true).'</span>'; | |
//get the regular price of the product, but of a simple product | |
$regular_price = get_post_meta( get_the_ID(), '_regular_price', true); | |
//oh, the product is variable to $sale_price is empty? Lets get a variation price |
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 { useEffect, useRef } from 'react' | |
function usePrevious<T>(value: T): T { | |
const ref = useRef(value) | |
useEffect(() => { | |
ref.current = value | |
}, [value]) | |
return ref.current |
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
jest | |
.useFakeTimers({ now: currentDate, advanceTimers: true }) | |
.setSystemTime(currentDate) |
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 { Children, FunctionComponent, ReactNode } from "react"; | |
export interface Props { | |
children: ReactNode; | |
reverse: boolean; | |
} | |
const ChildrenReversable: FunctionComponent<Props> = ({ children, reverse }) => { | |
const componentChildren = !reverse | |
? children |
NewerOlder