DEV3 Technologies home

Free code snippets

Free code snippets, page 4

Small, self-contained patterns from real DEV3 products, each explained, with a live preview where it makes sense. Copy them into your project; commercial use is fine.
200
snippets
7
stacks

All snippets

Laravel · PaymentsPlan-change prorationPure integer maths for mid-cycle upgrades and downgrades: credit unused days of the old plan, charge remaining days of the new one.billingprorationsubscriptions Laravel · PaymentsOne PaymentGateway interface for Stripe, PayPal and RazorpayA small contract plus a Laravel Manager that resolves the active payment gateway from config, so controllers never know which provider runs.paymentsmanagerinterface Laravel · EmailOne-click unsubscribe with List-Unsubscribe headerAdd RFC 8058 List-Unsubscribe headers to outgoing mail and a signed endpoint that handles the one-click POST from mailbox providers.emailunsubscribeheaders Tailwind CSS · Dashboard widgetsOnboarding checklist with progress barA small getting-started card with checkbox steps, a live progress bar, an accessible progressbar role and a completion message.onboardingchecklistprogress Tailwind CSS · Layouts404 page with searchA friendly not-found page with a large status code, a search form that falls back to a plain GET request and helpful links.404error-pagesearch WordPress · APIsNonce and capability checked AJAX endpointA WordPress admin AJAX action that verifies a nonce, checks a capability, sanitises input and answers with JSON.ajaxnoncecapability React / Next.js · APIsSSRF-safe fetch for NodeFetch user-supplied URLs from a server route while blocking private addresses, pinning DNS, limiting redirects, time and size.ssrfsecuritynode Laravel · DatabaseNearest-rider assignmentFind the closest available courier with a bounding-box prefilter and a haversine distance, then claim them atomically for a delivery.geodispatchhaversine Tailwind CSS · FormsMulti-step form wizardA progressive form split into steps with native validation per step, a progress strip, back and next controls and a review screen.wizardmulti-stepvalidation Laravel · DatabaseMonthly usage metering with automatic resetCount usage per team and metric in one row per month, consuming units with a single conditional update so a limit can never be overshot.meteringquotausage React / Next.js · ChartsMind map auto layoutPosition a tree of ideas automatically with a subtree-height layout and render it as curved SVG connectors in React.mind-maptree-layoutsvg Tailwind CSS · Feedback and empty statesMaintenance pageA scheduled-maintenance notice with a status badge, expected return time, a progress bar and a link to a status page.maintenancedowntimestatus WordPress · Feedback and empty statesLive blog with polling auto-refreshA REST endpoint returns entries newer than a timestamp and a small script polls it, pausing while the tab is hidden.live-blogrest-apipolling Tailwind CSS · LayoutsLink-in-bio profile layoutA single-column mobile-first link page with avatar, bio, social icon row and a stack of large tappable link buttons.link-in-bioprofilemobile React / Next.js · UtilitiesLCS text diff with a React rendererCompute a line-by-line diff using the longest common subsequence and render additions and deletions in a React view.difflcstext WordPress · UtilitiesLazy-loading YouTube facadeShow a thumbnail and play button instead of an iframe, and swap in the real embed only when the visitor clicks.youtubelazy-loadingperformance React / Next.js · UtilitiesGenerate an invoice PDF in the browserBuild and download a paginated invoice PDF client-side with jsPDF, using a lazy import and manual table layout.pdfjspdfinvoice Laravel · FormsJSON form schema to validation rulesTurn a stored list of field definitions into Laravel validation rules and attribute names, so user-built forms are validated server side.validationform-builderjson Tailwind CSS · Feedback and empty statesIncident update timelineA vertical incident timeline with colour-coded status dots and timestamps, newest update first, built from a semantic ordered list.timelineincidentstatus Laravel · WebhooksIdempotent signed webhook receiverAccept webhooks with an HMAC signature and a timestamp window, and process each event id exactly once using a unique-key insert.webhookhmacidempotency Tailwind CSS · LayoutsIcon feature gridA responsive grid of feature cards, each with an inline SVG icon tile, a heading and a short description.featuresgridicons WordPress · FormsBooking bar form with date validationA date and guests booking bar shortcode with a nonce, server-side validation and a redirect to a results page.bookingformadmin-post Laravel · MiddlewareHoneypot and time-trap middlewareBlock simple form bots with a hidden field and an encrypted render timestamp, rejecting submissions that are filled in too fast.spamhoneypotmiddleware Tailwind CSS · Hero sectionsHero with email capture and trust rowA centered hero section with a headline, an inline signup form, a privacy note and a row of customer logos beneath.herosignuplanding