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
// This is an example of a 'curtain' page transition for nextjs app router | |
// when hijacking the <Link /> to set valio's pageTransitionState.requested = href; | |
// I start off a transition process, switching out the the page when the curtain is closed | |
// I quite like the way each pass resolves the value from mapCurtain01Props, feels tidy. | |
'use client'; | |
import { animated, easings, useSpring } from '@react-spring/web'; | |
import { ReactNode, useEffect, useRef } from 'react'; |
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
// This is an example of a simple react component on one of my sites, | |
// this component uses chart.js, typescript (generated from wagtail/django schema) | |
import { | |
CategoryScale, | |
Chart as ChartJS, | |
LineElement, | |
LinearScale, | |
PointElement, | |
Tooltip, |
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
# This is an example of a fabric texture (for 3d models) download client I created for a Python / Django site, | |
# 1. when a user requests a texture download, it creates a task using Celery, | |
# 2. this task creates a RequestTexture item in the database | |
# 3. if the textures have never been requested before - | |
# it retrieves the texture images (presigned files that expire) from an external bucket | |
# 4. once I have selected and pulled them to a temp/ folder I zip them up (with spec sheet pdf) | |
# 5. optionally (on the server, or locally if USE_AWS_S3_MEDIA is set) I push them onto our bucket | |
# 6. lastly, I send an email to the download view, which triggers an automatic download | |
@current_app.task( |
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
# This is an example of some mixins I created for a Python / Django cart, | |
# these mixins ca be applied like so - | |
# - Cart(AbstractItemCollection, DynamicsPriceValidatedMixin): | |
# - CartLineItem(AbstractLineItem, DynamicsPriceMixin): | |
# | |
# The cart required unique prices per user on selected items, these prices | |
# can update at any time, so I revalidate the items - | |
# - when hitting the payment page | |
# - when we call get_cart / get_checkout (not is_order) | |
# - a. last_price_revalidation is greater than |