DEV3 Technologies home

Free code snippets

Free code snippets, page 2

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 · NotificationsSMS and WhatsApp driver abstractionSend text messages through one Messenger facade with swappable SMS and WhatsApp drivers, selected by channel name, plus a log driver for local work.smswhatsappdrivers Tailwind CSS · ModalsSlide-over cart drawerA cart panel that slides in from the right with a backdrop, line items, quantity steppers and a live subtotal.cartdrawerslide-over Laravel · UploadsSigned temporary download URLs with a download capHand out expiring signed links for private files and stop serving them after a fixed number of downloads, without exposing storage paths.signed-urldownloadstorage Laravel · UtilitiesSignature capture and PDF stampingValidate a canvas signature sent as a data URL, then stamp it onto a chosen page of an existing PDF at a percentage position.pdfsignaturefpdi Laravel · UtilitiesShort-code generator with collision retryGenerate unambiguous random short codes and rely on the unique index to detect collisions, retrying and growing the length when a space fills up.short-codeuniqueretry WordPress · FormsSettings API options pageA complete options page using register_setting, sections and fields with sanitise callbacks and a capability gate.settings-apioptionsadmin Laravel · UtilitiesService-area geofence checkTest whether a latitude and longitude falls inside a stored polygon service area using ray casting, with a bounding-box shortcut.geofencepolygongeojson Tailwind CSS · CardsScroll-snap testimonial carouselA swipeable testimonial carousel built on native CSS scroll snapping, with optional previous and next buttons and no slider library.carouseltestimonialsscroll-snap WordPress · UtilitiesSanitised inline SVG icon helperLoad SVG icons from the theme folder, strip anything unsafe with wp_kses and a strict allow-list, and print them inline.svgiconskses Laravel · APIsSanctum tokens with abilities and rate limitsIssue scoped personal access tokens with named abilities, enforce them per route, and rate limit API calls per token instead of per IP.sanctumtokensabilities Laravel · UploadsSafe resume upload validationA form request that checks extension, size and real file signature, then stores resumes on a private disk under a random name.uploadvalidationform-request Tailwind CSS · LayoutsRoadmap status columnsA public product roadmap laid out as Planned, In progress and Shipped columns that stack on phones, using semantic sections and lists.roadmapcolumnsgrid Tailwind CSS · CardsEmbeddable review summary cardA compact ratings card with average score, star row, a distribution bar per level and a featured quote, ready to embed on any page.reviewswidgetratings Tailwind CSS · CardsRestaurant menu card sectionA two-column restaurant menu with category headings, dish names, descriptions, dotted price leaders and small dietary tags.menurestaurantlayout WordPress · APIsREST route with permission callback and schemaRegister a REST API route that validates its arguments, authorises with permission_callback and returns a shaped response.rest-apipermission-callbackvalidation Tailwind CSS · EmailResponsive welcome emailA table-based welcome email with preheader text, a two-column tips row that stacks on phones, and inline styles for every client.emailhtmlresponsive Tailwind CSS · EmailResponsive receipt emailA transactional receipt email with a meta row, line-item table, right-aligned totals and a mobile layout that stacks the header details.emailreceiptinvoice WordPress · UtilitiesRelated posts by shared taxonomy termsQuery the posts that share the most tags with the current one, fall back to its category, and cache the result in a transient.related-postswp-querytaxonomy React / Next.js · UtilitiesRegex match highlighterSplit text into plain and matched segments for any regular expression, and render the matches as highlighted marks in React.regexhighlightreact Laravel · MiddlewareReferral attribution cookieCapture a ref code from the URL into a first-party cookie with a validated value and a 30 day window, then read it when the visitor signs up.referralcookieattribution WordPress · AnimationReduced-motion aware scroll revealFade elements in as they enter the viewport with an IntersectionObserver, staggered delays and a full opt-out for reduced motion.scroll-revealintersection-observerreduced-motion Laravel · PaymentsRecurring donations with Stripe subscriptionsStart a monthly gift as a Stripe Checkout subscription with a custom amount, and record each renewal from the invoice-paid webhook branch.stripesubscriptionrecurring WordPress · UtilitiesReading time and automatic table of contentsFilter the_content to add heading anchors, a linked table of contents and a words-per-minute reading time estimate.the-contenttocreading-time React / Next.js · HooksVisibility-aware polling hookPoll an async function on an interval that pauses in hidden tabs, backs off on errors and cancels in-flight work on unmount.reactpollinghook