python-blog/2024/06 - June/postgres_pydantic at main · fbaptiste/python-blog
about_Ref - PowerShell
Describes how to create and use a reference type variable. You can use reference type variables to permit a function to change the value of a variable that is passed to it.
coolbutuseless/yyjsonr: Fast JSON package for R
Fast JSON package for R.
FreeApi.app
A free resource to learn and master API
Design Patterns in R
Build robust and maintainable software with object-oriented design patterns in R. Design patterns abstract and present in neat, well-defined components and interfaces the experience of many software designers and architects over many years of solving similar problems. These are solutions that have withstood the test of time with respect to re-usability, flexibility, and maintainability. R6P provides abstract base classes with examples for a few known design patterns. The patterns were selected by their applicability to analytic projects in R. Using these patterns in R projects have proven effective in dealing with the complexity that data-driven applications possess.
The most efficient way to manage snapshot tests in R.
Use CI and Github API
Snapshot testing gets difficult when there is more than one variant of the same result.
The reason why snapshot testing might be discouraging is due to the fact that snapshots will most likely fail due to environment settings. If one person runs the tests on a Mac and another on a Linux machine, the snapshots of rendered images will almost certainly be different. Comparing these snapshots will result in a failed test even though the code is correct.
Add CI to the mix, and you have a hot mess.
The easiest solution is to introduce variants.
Variants are versions of snapshots which were created on different environments.
In {testthat} variants are stored in separate directories. You can pass a name of the variant to the variant argument of testthat::test_snapshot. If you have a Linux, set variant = "linux", if you have a Mac, set variant = "mac".
Use snapshots generated on CI as the source of truth.
Don’t check in snapshots generated on your machine. Generate them on CI and download them to your machine instead.
Step 1: Archive snapshots on CI
Add this step to you CI testing workflow to allow downloading generated snapshots.
- name: Archive test snapshots if: always() uses: actions/upload-artifact@v3 with: name: test-snapshots path: | tests/testthat/_snaps/**/**/*
Step 2: Detect the environment to create variants
We can create a make_variant function to detect the version of the platform, as well as if we are running on CI.
This way even if we use the same OS on CI and locally, we can still differentiate between snapshots generated on CI and locally.
#' tests/testthat/setup.R is_ci <- function() { isTRUE(as.logical(Sys.getenv("CI"))) } make_variant <- function(platform = shinytest2::platform_variant()) { ci <- if (is_ci()) "ci" else NULL paste(c(ci, platform), collapse = "-") } # In tests: testthat::expect_snapshot(..., variant = make_variant())
Step 3: Ignore your local snapshots
Don’t check in snapshots generated on your machine. Add them to .gitignore instead.
Copy
tests/testthat/_snaps/linux-4.4
This way we can still generate snapshots locally to get fast feedback, but we’ll only keep a single source of truth checked in the repository.
Since you don’t track changes in local snapshots, you need to regenerate them before you start making changes to see if they change. It adds some complexity to the process, but it allows to keep the number of shared snapshots in the version control minimal.
Alternatively, you can keep local snapshots, but when doing code review, focus only on the ones generated on CI.
Step 4: Automate downloading snapshots from CI
To update snapshots generated on CI in Github, we need to:
Go to Actions.
Find our workflow run.
Download the test-snapshots artifact.
Unpack and overwrite the local snapshots.
testthat::snapshot_review() to review the changes.
Commit and push the changes.
This is a lot of steps. We can automate the most laborious ones with Github API.
The .download_ci_snaps function will:
Get the list of artifacts in the repository identified by repo and owner. It’ll search workflows generated from the branch we’re currently on. It will download the latest artifact with the provided name (in our case its “test-snapshots”) in the repository
Unzip them and overwrite the local copy of snapshots.
reactable: Column group definitions — colGroup
Use colGroup() to create column groups in a table.
A Database Model for an Online Survey. Part 4
In this final article in a four-part series, I complete the design for an online survey database to provide flexibility for multiple surveys, question re-use, multiple choice answers, ordering of questions, conditional jumps in the survey based on responses, and control over the users' access to surveys via groups of survey owners.
Database Design for Online Survey Systems
Learn how to create your database design for an online survey system using the web-based Vertabelo Data Modeler.
Chapter 16 Cookies | JavaScript for R
Invite JavaScript into your Data Science workflow.
Learn About
Grasp new topics and deepen your understanding with a conversational learning companion that adapts to your unique curiosity and learning goals. Ask big or small questions, upload material or explore curated topics. Navigate complex concepts with interactive guides. Make connections to deepen understanding with learning aids. Enhance learning with images, videos, and articles from relevant sources. Go as far as your curiosity takes you. Explore broadly or dig into the details.
Automating OpenAPI Specifications for Any API | Andrew Walsh
Blog post accompanying a talk on API discovery and automated OpenAPI specifications for any API
Entrata Dashboard
Header Best Practices for Web-Based Tools and Applications | Fuzzy Math
Headers, at their core, serve to ground users to the application. We dive into header best practices and the elements within them.
Guide to Windows Batch Scripting - /* steve jansen */
I love shell scripting – it’s the duct tape of programming to me. Low cost, high benefit. And it feels like art, where one can learn to …
Color palette generator | Canva Colors
Easily generate awesome color palettes from an image.
CSS Grid Generator
HTML5 ★ BOILERPLATE
The web’s most popular front-end template which helps you build fast, robust, and adaptable web apps or sites.
Visit API Docs
Temporal tables - SQL Server
System-versioned temporal tables bring built-in support for providing information about data stored in the table at any point in time.
Parallel and Asynchronous Programming in Shiny with future, promise, future_promise, and ExtendedTask - Rtask
The R task Force - R experts for all your needs
HTTP API - PostgreSQL wiki
Shiny App Usage Telemetry
Enables instrumentation of Shiny apps for tracking user session events such as input changes, browser type, and session duration. These events can be sent to any of the available storage backends and analyzed using the included Shiny app to gain insights about app usage and adoption.
Tutorial: Porting Liquid Oxygen to Shiny
shiny.react
How to Develop Robust and Maintainable JavaScript Code Within a Shiny Application
Take your R/Shiny apps to the next level with JavaScript. Learn best practices for typing, documentation, and integrating React with Rhino.
Rspress
Rspack based static site generator
Modern.js vs Remix · web-infra-dev/modern.js · Discussion #4872
Hi there, I have been experimenting with Modern js and so far the experience has been good. The main selling point for me really is the micro frontend tooling support over remix especially in the u...
Coze: Next-Gen AI Chatbot Developing Platform
Coze is a next-generation AI application and chatbot developing platform for everyone. Regardless of your programming experience, Coze enables you to effortlessly create various chatbots and deploy them across different social platforms and messaging apps.
AI Code Converter | AI Code Translator | AI Code Generator
Use AI To Convert Code Or Generate Code From One Language To Another. AI Code Translator. Translate Code From Any Language To Another With A Click.
Prompt Storm - A Powerful Easy to use Artificial Intelligence Prompt Engineering Chrome Software Extension for ChatGPT, Google's Gemini, and Anthropic's Claude.
Prompt Storm - A Powerful Easy to use AI Prompt Engineering Chrome Extension for ChatGPT, Google's Gemini, and Anthropic's Claude. With just a few clicks you can get the answers you're looking for, create amazing writing, marketing and social media strategies, save time and boost your productivity.