View next-fs-patcher.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 fs = require('fs') | |
const path = require('path') | |
const { patchFs } = require('@aleung/fs-monkey') | |
const resolveToTmp = (pathLike) => { | |
const isCacheDir = pathLike.includes('.next/cache') | |
if (!isCacheDir) return pathLike | |
const endPath = pathLike.split('.next/cache/')[1] | |
console.log('patcher.js: resolveToTmp', endPath) |
View useReptchaEnterpise.ts
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
<!-- | |
// inside _app.tsx | |
import Script from 'next/script'; | |
// inside custom App component. | |
<Script src="https://www.google.com/recaptcha/enterprise.js?render=explicit" /> | |
--> | |
import { useEffect, useState } from 'react'; |
View Shopify GTM integration
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
// use "{{ 'analytics-head.js' | asset_url | script_tag }}" inside your liquid files. Namely `theme.liquid`. | |
var layerName = 'customDataLayer' | |
var gtmId = 'GTM-XXXXXX' | |
// ------------------------------ | |
// Load GTM in head, initialize dataLayer. | |
;(function (w, d, s, l, i) { | |
console.log('Initializing GTM ...') | |
w[l] = w[l] || [] |
View CloudCompare from source
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
# meta.yaml (use conda build ./path-to-directory-with-this-file | |
package: | |
name: cloudcompare | |
version: v2.12.4 | |
source: | |
git_url: https://github.com/CloudCompare/CloudCompare.git | |
git_rev: v2.12.4 | |
build: |
View PotreeConverter from source
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
# meta.yaml (use conda build ./path-to-directory-with-this-file | |
package: | |
name: potreeconverter | |
version: 2.1.1 | |
source: | |
git_url: https://github.com/potree/PotreeConverter.git | |
git_rev: 2.1.1 |
View generate-prisma-stack.sh
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 - generate node_modules layer, | |
# 2 - reference layer in CDK code, | |
# 3 - profit. | |
#!/bin/sh | |
set -e | |
LAMBDA_FOLDER=nodejs | |
PRISMA_CLI_BINARY_TARGETS=rhel-openssl-1.0.x |
View generate.sh
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
#!/bin/bash | |
# Author: Jan Soukup | |
echo "CHANGELOG" | |
echo ---------------------- | |
git tag | tr - \~ | sort -V --reverse | tr \~ - | while read TAG; do | |
echo | |
if [ $NEXT ]; then | |
echo [$NEXT] | |
else | |
echo "[Current]" |
View AmazingDiv.tsx
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, { PropsWithChildren, useEffect, useRef, CSSProperties } from 'react' | |
import { logger } from 'utils/logger' | |
export type CustomMouseEvent = React.MouseEvent<HTMLDivElement, MouseEvent> | |
export type CustomTouchEvent = React.TouchEvent<HTMLDivElement> | |
const MOUSE_MOVE_DELTA = 20 | |
const TOUCH_MOVE_DELTA = 30 | |
const HOLD_TRESHOLD = 500 | |
const DUPLICATE_TRESHOLD = 80 |
View useHover.ts
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, HTMLAttributes, useRef, useEffect } from 'react' | |
export interface UseHoverOptions { | |
mouseEnterDelayMS?: number | |
mouseLeaveDelayMS?: number | |
} | |
export type HoverProps = Pick<HTMLAttributes<HTMLElement>, 'onMouseEnter' | 'onMouseLeave'> | |
export const useHover = ({ mouseEnterDelayMS = 0, mouseLeaveDelayMS = 0 }: UseHoverOptions = {}): [boolean, HoverProps] => { |
View useScroll.ts
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 { MutableRefObject, useCallback, useRef } from 'react' | |
interface UseScrollToProps { | |
parentRef: MutableRefObject<HTMLDivElement> | |
} | |
// https://gist.github.com/gre/1650294 | |
const easeInOutQuint = t => { | |
return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t | |
} |
NewerOlder