# Snippet

Published articles for Snippet.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## The weekly snippet-server: open-sourced

DevFeed: [The weekly snippet-server: open-sourced](<https://devfeed.tech/articles/the-weekly-snippet-server-open-sourced-27407.md>)

Original publisher: [Read original article](<http://engineering.khanacademy.org/posts/snippet-server.htm>)

Author: Khan Academy

Published: 2016-02-01T23:00:00Z

Content type: article

Language: en

Sources: [Khan Academy](<https://devfeed.tech/sources/khan-academy.md>)

Topics: [Snippet](<https://devfeed.tech/topics/snippet.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [email](<https://devfeed.tech/topics/email.md>), [Markdown](<https://devfeed.tech/topics/markdown.md>)

Tags: [configuration](<https://devfeed.tech/tags/configuration.md>), [email](<https://devfeed.tech/tags/email.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [infrastructure](<https://devfeed.tech/tags/infrastructure.md>), [markdown](<https://devfeed.tech/tags/markdown.md>), [news](<https://devfeed.tech/tags/news.md>), [open](<https://devfeed.tech/tags/open.md>), [snippet](<https://devfeed.tech/tags/snippet.md>)

### AI overview

Craig Silverstein describes Khan Academy's open-sourced weekly snippet server, a simple tool for sharing brief weekly work updates. It uses a textbox with optional Markdown formatting and makes snippets visible according to email-domain and server configuration.

### Source excerpt

By Craig Silverstein When I joined Khan Academy, my first project was to write a version of the ... Read more

## Warp any DOM element with this bookmarklet

DevFeed: [Warp any DOM element with this bookmarklet](<https://devfeed.tech/articles/warp-any-dom-element-with-this-bookmarklet-28096.md>)

Original publisher: [Read original article](<https://jlongster.com/warp-any-dom-element-with-this-bookmarklet>)

Author: James Long

Published: 2025-11-19T12:00:00Z

Content type: tutorial

Language: en

Sources: [James Long](<https://devfeed.tech/sources/james-long.md>)

Topics: [Warp](<https://devfeed.tech/topics/warp.md>), [Document Object Model (DOM)](<https://devfeed.tech/topics/dom.md>), [Snippet](<https://devfeed.tech/topics/snippet.md>)

Tags: [js](<https://devfeed.tech/tags/js.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [warp](<https://devfeed.tech/tags/warp.md>)

### AI overview

This article presents a JavaScript bookmarklet for interactively selecting a DOM element and applying a visual warp effect to it. The code includes element highlighting, selection, draggable control points, and cleanup behavior.

### Source excerpt

I've been working on a design and found a cool effect that would make a great bookmarklet. A bookmarklet is a JS snippet that you can drag to your bookmarks bar and run on any page. Press ESC to cancel`;const closeBtn=document.createElement('button');closeBtn.textContent='✕ Close';closeBtn.style.cssText=`padding: 6px 12px;background: #ef4444;color: white;border: none;border-radius: 4px;cursor: pointer;font-weight: 500;font-size: 12px;margin-left: auto;`;closeBtn.onclick=cleanup;instructions.appendChild(instructionText);instructions.appendChild(closeBtn);document.body.appendChild(instructions);document.addEventListener('mousemove',onSelectorMove);document.addEventListener('click',onSelectorClick);document.addEventListener('keydown',(e)=>{if(e.key==='Escape')cleanup();});window.__bezierCleanup=()=>{instructions.remove();cleanup();};}function onSelectorMove(e){if(!selectorActive)return;const target=document.elementFromPoint(e.clientX,e.clientY);if(!target||target===highlightBox)return;const rect=target.getBoundingClientRect();highlightBox.style.display='block';highlightBox.style.left=rect.left+'px';highlightBox.style.top=rect.top+'px';highlightBox.style.width=rect.width+'px';highlightBox.style.height=rect.height+'px';}function onSelectorClick(e){if(!selectorActive)return;e.preventDefault();e.stopPropagation();const target=document.elementFromPoint(e.clientX,e.clientY);if(!target)return;selectorActive=false;highlightBox.style.display='none';document.removeEventListener('mousemove',onSelectorMove);document.removeEventListener('click',onSelectorClick);selectElement(target);}function selectElement(element){selectedElement=element;const rect=element.getBoundingClientRect();const scrollX=window.pageXOffset||document.documentElement.scrollLeft;const scrollY=window.pageYOffset||document.documentElement.scrollTop;transformedContainer=document.createElement('div');transformedContainer.style.cssText=`position: absolute;left: ${rect.left+scrollX}px;top: ${rect.top+scrollY}px;width

## Using second-pass sorting prompts to improve LLM responses

DevFeed: [Using second-pass sorting prompts to improve LLM responses](<https://devfeed.tech/articles/sorting-prompts-llms-are-not-wrong-you-just-caught-them-mid-thought-25333.md>)

Original publisher: [Read original article](<https://kau.sh/blog/sorting-prompt/>)

Author: Kaushik Gopal

Published: 2025-10-10T16:19:26Z

Content type: article

Language: en

Sources: [Kaushik Gopal's Site](<https://devfeed.tech/sources/kaushik-gopal-s-site.md>)

Topics: [Large Language Model](<https://devfeed.tech/topics/llm.md>), [Prompt Engineering](<https://devfeed.tech/topics/prompt-engineering.md>), [Snippet](<https://devfeed.tech/topics/snippet.md>)

Tags: [llm](<https://devfeed.tech/tags/llm.md>), [llms](<https://devfeed.tech/tags/llms.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [sorting](<https://devfeed.tech/tags/sorting.md>)

### AI overview

The article argues that apparently wrong LLM responses may be an initial pass at describing competing beliefs. It recommends using neutral second-pass "sorting statements" to compare evidence and improve results.

### Source excerpt

Good sensemaking processes iterate. We develop initial theories, note some alternative ones. We then take those theories that we've seen and stack up the evidence for one against the other (or others). Even while doing that we keep an eye out for other possible explanations to test. When new explanations stop appearing and we feel that the evidence pattern increasingly favors one idea significantly over another we call it a day. LLMs are no different. What often is deemed a "wrong" response is often4 merely a first pass at describing the beliefs out there. And the solution is the same: iterate the process. ... What I've found specifically is that pushing it to do a second pass without putting a thumb on the scale almost always leads to a better result. To do this I use what I call "sorting statements" that try to do a variety of things Mike Caulfield is someone who cares about the veracity of information. The entire post is fascinating and has painted LLM search results in a new way for me. I now have a Raycast Snippet aiprompt; which expands to this: What is the evidence for and against the claim/guidance just stated? Already I'm seeing much better results.

## Here and Now: Reusing Code at Feedzai with JupyterLab Snippets

DevFeed: [Here and Now: Reusing Code at Feedzai with JupyterLab Snippets](<https://devfeed.tech/articles/here-and-now-reusing-code-at-feedzai-with-jupyterlab-snippets-26298.md>)

Original publisher: [Read original article](<https://medium.com/feedzaitech/here-and-now-reusing-code-at-feedzai-with-jupyterlab-snippets-ff3b8d880e50?source=rss----e11168e7fe6b---4>)

Author: João Palmeiro

Published: 2025-03-17T13:11:26Z

Content type: article

Language: en

Sources: [Feedzai](<https://devfeed.tech/sources/feedzai.md>)

Topics: [jupyterlab](<https://devfeed.tech/topics/jupyterlab.md>), [Data Science](<https://devfeed.tech/topics/data-science.md>), [Code](<https://devfeed.tech/topics/code.md>), [Data analysis](<https://devfeed.tech/topics/data-analysis.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [data-analysis](<https://devfeed.tech/tags/data-analysis.md>), [data-science](<https://devfeed.tech/tags/data-science.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [jupyter](<https://devfeed.tech/tags/jupyter.md>), [jupyterlab](<https://devfeed.tech/tags/jupyterlab.md>), [python](<https://devfeed.tech/tags/python.md>), [repositories](<https://devfeed.tech/tags/repositories.md>), [snippet](<https://devfeed.tech/tags/snippet.md>)

### AI overview

Feedzai developed JupyterLab Snippets to help data scientists reuse code from the many notebooks created for daily work. The article describes research using notebook repository statistics and user interviews, and reports that duplicating notebooks, maintaining reference collections of snippets, and sharing notebooks or snippets are common practices.

### Source excerpt

Data scientists use different Jupyter notebooks every day -- ranging from disposable ones for quick tasks to those shareable with clients. Over time, more and more notebooks accumulate, making it increasingly difficult to reuse them in whole or in part. To mitigate this problem and make the most relevant pieces of code quickly accessible to every data scientist, we developed JupyterLab Snippets at Feedzai -- our take on leveraging code snippets directly on JupyterLab. JupyterLab is a computational notebook platform that enables us to carry on data science work (and beyond) via notebooks. These notebooks, where code, text, and images come together, allow us to complete all kinds of tasks, keeping each input close to each output. At Feedzai, data scientists have access to different JupyterLab environments packed with custom notebooks and Python packages. Here they go from analyzing data to training models, from preparing reports to debugging the system -- a "lab of all trades", we could say. Given the importance of JupyterLab and notebooks in the daily work of our data scientists, we started a research project that culminated in JupyterLab Snippets. First, we collected statistics from internal notebook repositories across teams and conducted user interviews with junior and senior data scientists. We needed to know more about how data scientists actually use JupyterLab and notebooks, and what their ideas are for a better platform. A sneak peek of JupyterLab Snippets. From the very start, every data scientist can import snippets immediately or start their collection by creating one from scratch. After compiling the insights, several aspects became clear: JupyterLab and notebooks are heavily used for all sorts of data science and ad-hoc tasks (typically one per notebook). There is no single type of task (e.g., exploratory data analysis) that is more commonly addressed with notebooks than others. While file structures may look similar at first glance (each environment has at

## Extracting structured data from PDFs using Gemini 2.0 and Genkit

DevFeed: [Extracting structured data from PDFs using Gemini 2.0 and Genkit](<https://devfeed.tech/articles/extracting-structured-data-from-pdfs-using-gemini-2-0-and-genkit-16580.md>)

Original publisher: [Read original article](<https://firebase.blog/posts/2025/02/gemini-genkit-pdf-structured-data>)

Author: Peter Friese

Published: 2025-02-20T09:41:00Z

Content type: tutorial

Language: en

Sources: [Firebase Blog](<https://devfeed.tech/sources/firebase-blog.md>)

Topics: [Genkit](<https://devfeed.tech/topics/genkit.md>), [Structured-data](<https://devfeed.tech/topics/structured-data.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [Node.js](<https://devfeed.tech/topics/node-js.md>), [multimodal](<https://devfeed.tech/topics/multimodal.md>), [SDKs](<https://devfeed.tech/topics/sdks.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [firebase](<https://devfeed.tech/tags/firebase.md>), [gemini](<https://devfeed.tech/tags/gemini.md>), [genkit](<https://devfeed.tech/tags/genkit.md>), [guide](<https://devfeed.tech/tags/guide.md>), [multimodal](<https://devfeed.tech/tags/multimodal.md>), [node-js](<https://devfeed.tech/tags/node-js.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [structured-output](<https://devfeed.tech/tags/structured-output.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

### AI overview

A step-by-step tutorial showing Node.js developers how to use Gemini 2.0 and Genkit to extract structured invoice data from PDF files. It covers multimodal PDF analysis, OCR, and schema-constrained output with Zod.

### Source excerpt

Extract structured data from PDFs using Gemini 2.0's vision and Genkit. Step-by-step guide with code examples for Node.js developers.

## Styled checkboxes for Obsidian tasks without plugins or a custom theme

DevFeed: [Styled checkboxes for Obsidian tasks without plugins or a custom theme](<https://devfeed.tech/articles/styled-checkboxes-for-obsidian-tasks-without-plugins-or-a-custom-theme-25299.md>)

Original publisher: [Read original article](<https://kau.sh/blog/obsidian-icon-checkboxes-without-theme-plugins/>)

Author: Kaushik Gopal

Published: 2025-02-10T08:00:00Z

Content type: tutorial

Language: en

Sources: [Kaushik Gopal's Site](<https://devfeed.tech/sources/kaushik-gopal-s-site.md>)

Topics: [Obsidian](<https://devfeed.tech/topics/obsidian-md.md>), [CSS](<https://devfeed.tech/topics/css.md>), [Snippet](<https://devfeed.tech/topics/snippet.md>)

Tags: [css](<https://devfeed.tech/tags/css.md>), [snippet](<https://devfeed.tech/tags/snippet.md>)

### AI overview

A concise guide to styling Obsidian task checkboxes with custom CSS, adding visual states such as canceled, rescheduled, and in-progress without relying on plugins or a custom theme.

### Source excerpt

I use Obsidian for tracking my weekly tasks.1 One thing I like to do, is mark tasks as "canceled", "rescheduled", "in progress", etc. in case I move them between weeks. These tasks should visually stand out from the rest. Custom themes like Obsidian Minimal provide this as an option. There's also plugins that do this. But I like to keep my Obsidian setup lean and only wanted this feature without other cruft. CSS to the rescue again! The linked forum post had the starting css snippet I needed. I customized further to include some more options that the Minimal theme includes. You can find my custom css snippet here. that's another post in itself. ↩︎

## How to enable custom fonts in Obsidian Mobile

DevFeed: [How to enable custom fonts in Obsidian Mobile](<https://devfeed.tech/articles/how-to-enable-custom-fonts-in-obsidian-mobile-25240.md>)

Original publisher: [Read original article](<https://kau.sh/blog/custom-fonts-obsidian-mobile/>)

Author: Kaushik Gopal

Published: 2025-02-05T08:00:00Z

Content type: tutorial

Language: en

Sources: [Kaushik Gopal's Site](<https://devfeed.tech/sources/kaushik-gopal-s-site.md>)

Topics: [Obsidian](<https://devfeed.tech/topics/obsidian-md.md>), [CSS](<https://devfeed.tech/topics/css.md>), [Font](<https://devfeed.tech/topics/font.md>), [Electron](<https://devfeed.tech/topics/electron.md>)

Tags: [css](<https://devfeed.tech/tags/css.md>), [fonts](<https://devfeed.tech/tags/fonts.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [snippet](<https://devfeed.tech/tags/snippet.md>)

### AI overview

A tutorial showing how to enable custom fonts in Obsidian Mobile by converting a font file to base64, embedding it in a CSS snippet, and entering the custom font name in Obsidian's appearance settings. The author reports that the method works on mobile and can also be configured on desktop and synced.

### Source excerpt

One of the challenges with note taking apps on mobile is the limited font selection. While desktops let you install custom fonts system-wide, mobile platforms are much more restrictive. However, there's an elegant solution for Obsidian given it's an electron app. Obsidian allows you to inject a CSS snippet to tweak the appearnace of the app. CSS allows you to embed base64 encoded fonts directly in them for styling text 💡. I figured let's try this and see if it works on mobile. Works like a charm! Here's how to do it: 1. convert your font1 file to base64 and store in the clipboard ### # do this on a terminal app base64 -i <path_to_font_file> | pbcopy 2. Create a new CSS snippet in Obsidian (Settings > Appearance > CSS snippets) and add your font declaration: ### @font-face { font-family: custom-font-name; font-weight: 350 900; src: url(data:application/octet-stream;base64,<paste_base64_string_here>); } Remember to enable the snippet after creating it. Also font files can get large when converted to base64. So you're not going to be able to type out that encoded string. 3. Activate custom font in Obsidian ### Under Settings > Appearance > (Text|Monospace) Font, enter "custom-font-name". It won't show up in the dropdown but if you type the name exactly, you'll see a checkmark after a second and your new font is enabled. I typically do the above on my desktop and sync settings to my mobile. But nothing stops you from doing it directly on your mobile (if you don't have sync enabled). I now have my favorite reading font applied across my notes on mobile and my favorite monospace one applied to all the code in them! Obsidian on Android with custom fonts I encoded a variable font for convenience so i didn't have to declare italicized, bolded, etc. versions of the font. ↩︎

## Floating in Space - Animations with Compose and Canvas

DevFeed: [Floating in Space - Animations with Compose and Canvas](<https://devfeed.tech/articles/floating-in-space-animations-with-compose-and-canvas-38492.md>)

Original publisher: [Read original article](<https://eevis.codes/blog/2024-10-06/floating-in-space-animations-with-compose-and-canvas/>)

Author: Eevis Panula

Published: 2025-06-11T04:12:06.370000Z

Content type: tutorial

Language: en

Sources: [Eevis Blog](<https://devfeed.tech/sources/eevis-blog.md>)

Topics: [Compose](<https://devfeed.tech/topics/compose.md>), [Canvas](<https://devfeed.tech/topics/canvas.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [animations](<https://devfeed.tech/tags/animations.md>), [canvas](<https://devfeed.tech/tags/canvas.md>), [code](<https://devfeed.tech/tags/code.md>), [compose](<https://devfeed.tech/tags/compose.md>), [snippet](<https://devfeed.tech/tags/snippet.md>)

### AI overview

A tutorial showing how to animate a space illustration built with Jetpack Compose and Canvas. It explains how to animate star sizes with repeating float multipliers at different rates and how to rotate a moon around a planet.

### Source excerpt

In my previous blog post, Paint the Stars -- Drawing with Compose and Canvas, I shared how I wanted to be better with Canvas and Compose and created an illustration with planets and stars. This blog post shares how to animate those elements. In the end, the result will look like this: Full code is available in this snippet. Animations Stars Let's start with the stars. In the previous blog post, we defined the Star data class like this: data class Star( val size: Float, val topLeft: Offset, val color: Color, ) From these values, we want to animate the size of the stars. We'll do it by defining a multiplier that we will use with the star sizes to create the effect of the stars twinkling. We do this with infiniteTransition and animateFloat: val infiniteTransition = rememberInfiniteTransition(label = "infinite") val starSizeMultiplierOne by infiniteTransition .animateFloat( initialValue = 1f, targetValue = 1.5f, animationSpec = infiniteRepeatable( animation = tween( durationMillis = 3000, easing = animationEasing, ), repeatMode = RepeatMode.Reverse, ), label = "starSizeMultiplierOne", ) For the starSizeMultiplierOne, we give the initial value of 1, meaning that as it will act as a multiplier, the size would be 1 * size. The target value is 1.5, and as the repeat mode is Reverse, the float will animate between the size multiplied by 1 and 1.5. This transition creates a growing and shrinking effect. As we want the stars to look realistic and not animate at the same speed, we need to define two animated multipliers. Let's define another one: val starSizeMultiplierTwo by infiniteTransition .animateFloat( initialValue = 0.7f, targetValue = 1.7f, animationSpec = infiniteRepeatable( animation = tween( durationMillis = 2300, easing = animationEasing, ), repeatMode = RepeatMode.Reverse, ), label = "starSizeMultiplierTwo", ) This one has a bit shorter animation duration, and the initial and target values are different, so the twinkling happens at a different rate from the first mu

## The Mintlify MDX VSCode extension

DevFeed: [The Mintlify MDX VSCode extension](<https://devfeed.tech/articles/the-mintlify-mdx-vscode-extension-31065.md>)

Original publisher: [Read original article](<https://www.mintlify.com/blog/mdx-vscode-extension>)

Author: Hahnbee Lee

Published: 2024-03-26T00:00:00Z

Content type: release

Language: en

Sources: [Mintlify Blog](<https://devfeed.tech/sources/mintlify-blog.md>)

Topics: [VS Code Extension](<https://devfeed.tech/topics/vscode-extension.md>), [MDX](<https://devfeed.tech/topics/mdx.md>), [Documentation](<https://devfeed.tech/topics/documentation.md>), [Snippet](<https://devfeed.tech/topics/snippet.md>)

Tags: [announcements](<https://devfeed.tech/tags/announcements.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [extension](<https://devfeed.tech/tags/extension.md>), [mdx](<https://devfeed.tech/tags/mdx.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [vscode](<https://devfeed.tech/tags/vscode.md>)

### AI overview

Mintlify introduces an MDX VSCode extension that provides IntelliSense and snippets for its documentation components, including Cards, Steps, Tabs, and callouts. The extension is available on the Visual Studio Marketplace.

### Source excerpt

Today, we're thrilled to introduce the Mintlify MDX VSCode extension.

## Optimizing Jetpack Compose with a Fast Cube Root Approximation

DevFeed: [Optimizing Jetpack Compose with a Fast Cube Root Approximation](<https://devfeed.tech/articles/going-old-school-25598.md>)

Original publisher: [Read original article](<https://www.romainguy.dev/posts/2024/going-old-school/>)

Author: Romain Guy

Published: 2024-01-25T00:00:00Z

Content type: tutorial

Language: en

Sources: [Posts on Romain Guy](<https://devfeed.tech/sources/posts-on-romain-guy.md>)

Topics: [Compose](<https://devfeed.tech/topics/compose.md>), [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Optimization](<https://devfeed.tech/topics/optimization.md>), [Algorithm](<https://devfeed.tech/topics/algorithm.md>), [implementation](<https://devfeed.tech/topics/implementation.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [android](<https://devfeed.tech/tags/android.md>), [compose](<https://devfeed.tech/tags/compose.md>), [developer](<https://devfeed.tech/tags/developer.md>), [graphics](<https://devfeed.tech/tags/graphics.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [math](<https://devfeed.tech/tags/math.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [performance](<https://devfeed.tech/tags/performance.md>), [snippet](<https://devfeed.tech/tags/snippet.md>)

### AI overview

The article explains how a fast cube root approximation can optimize Jetpack Compose. It applies a float-bit estimation and two Newton-Raphson refinement steps, improving color interpolation by 8% and 2D cubic-easing animations by 17%.

### Source excerpt

While looking for optimization opportunities in various parts of Jetpack Compose, I recently discovered that calling the cube root function was taking a non-neligible amount of times in two areas of the Toolkit: when evaluating cubic Bézier easing curves and when interpolating colors through the OkLab color space. Working on graphics projects taught me that approximations can often be powerful optimization tools, so I decided to come up with an approximation of cbrt()1:

## Launch Week II Day 2: Snippets V2

DevFeed: [Launch Week II Day 2: Snippets V2](<https://devfeed.tech/articles/launch-week-ii-day-2-snippets-v2-31048.md>)

Original publisher: [Read original article](<https://www.mintlify.com/blog/launch-week-2-day-2>)

Author: Joshua Kim

Published: 2024-01-09T00:00:00Z

Content type: release

Language: en

Sources: [Mintlify Blog](<https://devfeed.tech/sources/mintlify-blog.md>)

Topics: [MDX](<https://devfeed.tech/topics/mdx.md>), [Documentation](<https://devfeed.tech/topics/documentation.md>), [Snippet](<https://devfeed.tech/topics/snippet.md>)

Tags: [announcements](<https://devfeed.tech/tags/announcements.md>), [article](<https://devfeed.tech/tags/article.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [launch-week](<https://devfeed.tech/tags/launch-week.md>), [mdx](<https://devfeed.tech/tags/mdx.md>), [snippet](<https://devfeed.tech/tags/snippet.md>)

### AI overview

Mintlify introduces Snippets V2, a rebuild that supports reusable components and variables through MDX imports. The feature is intended to improve flexibility, performance, documentation versioning, and content reuse.

### Source excerpt

Day 2 of Launch Week II brings Snippets V2 🚀.

## Add Python to your GraphQL API with GraphOS and Strawberry GraphQL

DevFeed: [Add Python to your GraphQL API with GraphOS and Strawberry GraphQL](<https://devfeed.tech/articles/add-python-to-your-graphql-api-with-graphos-and-strawberry-graphql-23125.md>)

Original publisher: [Read original article](<https://www.apollographql.com/blog/add-python-to-your-graphql-api-with-graphos-and-strawberry-graphql>)

Author: Patrick Arminio

Published: 2022-12-13T09:04:00Z

Content type: tutorial

Language: en

Sources: [Apollo Blog](<https://devfeed.tech/sources/apollo-blog.md>)

Topics: [GraphQL](<https://devfeed.tech/topics/graphql.md>), [Python](<https://devfeed.tech/topics/python.md>), [API](<https://devfeed.tech/topics/api.md>), [Framework](<https://devfeed.tech/topics/framework.md>), [Library](<https://devfeed.tech/topics/library.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [apollo](<https://devfeed.tech/tags/apollo.md>), [apollo-federation](<https://devfeed.tech/tags/apollo-federation.md>), [backend](<https://devfeed.tech/tags/backend.md>), [code](<https://devfeed.tech/tags/code.md>), [framework](<https://devfeed.tech/tags/framework.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [libraries](<https://devfeed.tech/tags/libraries.md>), [post](<https://devfeed.tech/tags/post.md>), [python](<https://devfeed.tech/tags/python.md>), [schema](<https://devfeed.tech/tags/schema.md>), [sdl](<https://devfeed.tech/tags/sdl.md>), [server](<https://devfeed.tech/tags/server.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [types](<https://devfeed.tech/tags/types.md>), [writing](<https://devfeed.tech/tags/writing.md>)

### AI overview

This tutorial explains how to build a Python subgraph for a GraphQL supergraph using the Strawberry GraphQL library. It introduces Strawberry's code-first approach, Python type annotations, and how it compares with schema-first GraphQL development.

### Source excerpt

A supergraph helps you share responsibility for your organization's data across multiple backend services (these are known as subgraphs). Different teams can work on different subgraphs in parallel, and better yet, each subgraph can use an entirely different language and framework! There are loads of subgraph-compatible libraries to choose from. In this post, we'll look at how to create a subgraph in Python using the Strawberry GraphQL library.

## How SwiftUI's .animation Modifier Applies Animations in the View Tree

DevFeed: [How SwiftUI's .animation Modifier Applies Animations in the View Tree](<https://devfeed.tech/articles/when-animation-animates-more-or-less-than-it-s-supposed-to-21709.md>)

Original publisher: [Read original article](<https://oleb.net/2022/animation-modifier-position/>)

Author: Ole Begemann

Published: 2022-11-10T21:48:45Z

Content type: tutorial

Language: en

Sources: [Ole Begemann](<https://devfeed.tech/sources/ole-begemann.md>)

Topics: [SwiftUI](<https://devfeed.tech/topics/swiftui.md>), [iOS](<https://devfeed.tech/topics/ios.md>), [macOS](<https://devfeed.tech/topics/macos.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [animation](<https://devfeed.tech/tags/animation.md>), [ios](<https://devfeed.tech/tags/ios.md>), [macos](<https://devfeed.tech/tags/macos.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [swiftui](<https://devfeed.tech/tags/swiftui.md>)

### AI overview

This article examines how SwiftUI's .animation modifier behaves within the view tree. It explains that sibling subtrees can use different animations, nested modifiers can override outer animations, and the modifier generally affects subviews with some exceptions.

### Source excerpt

On the positioning of the .animation modifier in the view tree, or: "Rendering" vs. "non-rendering" view modifiers The documentation for SwiftUI's animation modifier says: Applies the given animation to this view when the specified value changes. This sounds unambiguous to me: it sets the animation for "this view", i.e. the part of the view tree that .animation is being applied to. This should give us complete control over which modifiers we want to animate, right? Unfortunately, it's not that simple: it's easy to run into situations where a view change inside an animated subtree doesn't get animated, or vice versa. Unsurprising examples Let me give you some examples, starting with those that do work as documented. I tested all examples on iOS 16.1 and macOS 13.0. 1. Sibling views can have different animations Independent subtrees of the view tree can be animated independently. In this example we have three sibling views, two of which are animated with different durations, and one that isn't animated at all: struct Example1: View { var flag: Bool var body: some View { HStack(spacing: 40) { Rectangle() .frame(width: 80, height: 80) .foregroundColor(.green) .scaleEffect(flag ? 1 : 1.5) .animation(.easeOut(duration: 0.5), value: flag) Rectangle() .frame(width: 80, height: 80) .foregroundColor(flag ? .yellow : .red) .rotationEffect(flag ? .zero : .degrees(45)) .animation(.easeOut(duration: 2.0), value: flag) Rectangle() .frame(width: 80, height: 80) .foregroundColor(flag ? .pink : .mint) } } } The two animation modifiers each apply to their own subtree. They don't interfere with each other and have no effect on the rest of the view hierarchy: Download video 2. Nested animation modifiers When two animation modifiers are nested in a single view tree such that one is an indirect parent of the other, the inner modifier can override the outer animation for its subviews. The outer animation applies to view modifiers that are placed between the two animation modifiers. In this

## Obsidian: My second brain

DevFeed: [Obsidian: My second brain](<https://devfeed.tech/articles/obsidian-my-second-brain-28367.md>)

Original publisher: [Read original article](<https://siddroid.com/post/dev/obsidian-your-second-brain/>)

Author: Siddhesh Patil

Published: 2022-08-15T23:50:55Z

Content type: article

Language: en

Sources: [Sid Patil - Android Engineer and Kotlin Advocate](<https://devfeed.tech/sources/sid-patil-android-engineer-and-kotlin-advocate.md>)

Topics: [Obsidian](<https://devfeed.tech/topics/obsidian-md.md>), [Markdown](<https://devfeed.tech/topics/markdown.md>), [code productivity](<https://devfeed.tech/topics/code-productivity.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development-tools](<https://devfeed.tech/tags/android-development-tools.md>), [best-markdown-tools](<https://devfeed.tech/tags/best-markdown-tools.md>), [best-tools-for-android-developers](<https://devfeed.tech/tags/best-tools-for-android-developers.md>), [boost-developer-productivity](<https://devfeed.tech/tags/boost-developer-productivity.md>), [code](<https://devfeed.tech/tags/code.md>), [developer-productivity](<https://devfeed.tech/tags/developer-productivity.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [markdown](<https://devfeed.tech/tags/markdown.md>), [markdown-editors](<https://devfeed.tech/tags/markdown-editors.md>), [markdown-note-taking-tools](<https://devfeed.tech/tags/markdown-note-taking-tools.md>), [notes](<https://devfeed.tech/tags/notes.md>), [obsidian](<https://devfeed.tech/tags/obsidian.md>), [obsidian-for-markdown](<https://devfeed.tech/tags/obsidian-for-markdown.md>), [obsidian-md](<https://devfeed.tech/tags/obsidian-md.md>), [productivity](<https://devfeed.tech/tags/productivity.md>), [snippet](<https://devfeed.tech/tags/snippet.md>)

### AI overview

The article explains how a developer uses Obsidian, a Markdown-based note-taking tool, to manage thoughts, TODOs, web links, and code snippets. It highlights Markdown's simplicity, local file organization, backlinking, and the potential to turn notes into website pages.

### Source excerpt

Tired of moving between note-taking tools? Keep losing code snippets, TODOs and ideas? Meet Obsidian, a Markdown note taking tool to boost your developer productivity.

## State of CSS 2022

DevFeed: [State of CSS 2022](<https://devfeed.tech/articles/state-of-css-2022-20769.md>)

Original publisher: [Read original article](<https://erikrunyon.com/2022/05/state-of-css-2022/>)

Author: Erik Runyon

Published: 2022-05-17T00:00:00Z

Content type: article

Language: en

Sources: [Erik Runyon](<https://devfeed.tech/sources/erik-runyon.md>)

Topics: [CSS](<https://devfeed.tech/topics/css.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>), [Google](<https://devfeed.tech/topics/google.md>)

Tags: [css](<https://devfeed.tech/tags/css.md>), [google](<https://devfeed.tech/tags/google.md>), [google-i-o](<https://devfeed.tech/tags/google-i-o.md>), [overview](<https://devfeed.tech/tags/overview.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [technical](<https://devfeed.tech/tags/technical.md>), [web](<https://devfeed.tech/tags/web.md>), [web-development](<https://devfeed.tech/tags/web-development.md>)

### AI overview

An overview of current and upcoming CSS features, presented by Adam Argyle at Google I/O 2022.

### Source excerpt

A great overview of all the latest and upcoming CSS features. Presented by Adam Argyle at Google I/O '22.

## Why Web Performance Results Need Context Beyond Simple Numbers

DevFeed: [Why Web Performance Results Need Context Beyond Simple Numbers](<https://devfeed.tech/articles/my-challenge-to-the-web-performance-community-20767.md>)

Original publisher: [Read original article](<https://erikrunyon.com/2021/10/my-challenge-to-the-web-performance-community/>)

Author: Erik Runyon

Published: 2021-10-06T00:00:00Z

Content type: opinion

Language: en

Sources: [Erik Runyon](<https://devfeed.tech/sources/erik-runyon.md>)

Topics: [Web](<https://devfeed.tech/topics/web.md>), [Latency](<https://devfeed.tech/topics/latency.md>)

Tags: [debug](<https://devfeed.tech/tags/debug.md>), [performance](<https://devfeed.tech/tags/performance.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [synthetic](<https://devfeed.tech/tags/synthetic.md>), [test](<https://devfeed.tech/tags/test.md>), [tools](<https://devfeed.tech/tags/tools.md>), [web-development](<https://devfeed.tech/tags/web-development.md>), [web-performance](<https://devfeed.tech/tags/web-performance.md>)

### AI overview

The article argues that web performance results need context and that synthetic or lab-based tools should be understood as controlled tools for testing, debugging, diagnosis, optimization, prediction, and regression detection rather than precise measures of real-world site performance.

### Source excerpt

Philip Walton on the difficulties the webperf community faces when discussing web performance. Simple numbers don't cut it. We need to provide context when discussing performance results. What concerns me about this practice is that it glosses over a lot of important nuance, and it perpetuates the idea that synthetic or lab-based tools (like Lighthouse, WebPageTest, and many others) are genuine and precise assessments of a site's actual, real-world performance--rather than what they are: tools to test, debug, diagnose, optimize, and predict performance or detect regressions under a set of controlled conditions. I'm definitely guilty of the simplicity he discusses. Thanks for the challenge Philip.

## Welcome you are visitor number 12345

DevFeed: [Welcome you are visitor number 12345](<https://devfeed.tech/articles/welcome-you-are-visitor-number-12345-32085.md>)

Original publisher: [Read original article](<https://www.maiatoday.net/p/welcome-you-are-visitor-number-12345/>)

Published: 2021-07-12T19:44:03Z

Content type: tutorial

Language: en

Sources: [maiatoday](<https://devfeed.tech/sources/maiatoday.md>)

Topics: [ui](<https://devfeed.tech/topics/ui.md>), [Code](<https://devfeed.tech/topics/code.md>), [navigation](<https://devfeed.tech/topics/navigation.md>)

Tags: [90s-website](<https://devfeed.tech/tags/90s-website.md>), [animate](<https://devfeed.tech/tags/animate.md>), [code](<https://devfeed.tech/tags/code.md>), [components](<https://devfeed.tech/tags/components.md>), [compose](<https://devfeed.tech/tags/compose.md>), [coroutine](<https://devfeed.tech/tags/coroutine.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [state](<https://devfeed.tech/tags/state.md>), [stateflow](<https://devfeed.tech/tags/stateflow.md>), [stateless](<https://devfeed.tech/tags/stateless.md>), [ui](<https://devfeed.tech/tags/ui.md>), [viewmodel](<https://devfeed.tech/tags/viewmodel.md>), [visitor-counter](<https://devfeed.tech/tags/visitor-counter.md>)

### AI overview

A tutorial on building an animated visitor counter in a classic 1990s website style. It explains how to animate each digit independently, manage the counter and counting direction in a view model, keep composable UI components stateless and reusable, and connect the screen through navigation and Hilt.

### Source excerpt

Another step forward in recreating the icon 90s website look is the hit counter, visitor counter or web counter in classic squemorphic odometer style. I was inspired by a recent episode of Code with Italians where they animated a time field. I wanted to change the counter component to animate each number individually to get that odometer look. Before doing this though there was a question of state. I wanted to make a counter that would auto increment in a coroutine. It had to change direction up or down if you tapped it. To do this I decided to store the state and the counting direction in a view model. This allowed me to keep the components as stateless as possible. The components are re-usable because the logic that makes the numbers go up or down is held outside of the composable functions. The recommendation from Google is when you use a view model to hold state, keep it close to the root screen. I made a screen for my visitor counter and added it to my navigation code. Since I already had Hilt enabled in the project it was pretty easy to get hold of the viewmodel. The code snippet in the Navigation looks like this: NavHost(navController, startDestination = "overview") { //... other routes go here composable(route = "counter") { val viewModel: CounterViewModel = hiltViewModel() //<--- get the viewmodel from Hilt val count by viewModel.counter.collectAsState() //<--- the viewmodel exposes the counter as a StateFlow CounterScreen( count = count, onClick = { viewModel.onClick() } // <--- the viewmodel provides a method for when the element is clicked ) } } The CounterScreen is stateless and gets the value of the counter and the event handler as parameters. The CounterScreen has a Counter composable. The role of the Counter composable is to create a row of individual odometer numbers from the passed values. Also it should intercept a click and call the click handler. @Composable fun Counter( onClick: () -> Unit, count: Int, width: Int ) { val displayWidth = maxOf(3,

## Higher ed's slow page speed epidemic

DevFeed: [Higher ed's slow page speed epidemic](<https://devfeed.tech/articles/higher-ed-s-slow-page-speed-epidemic-20765.md>)

Original publisher: [Read original article](<https://erikrunyon.com/2021/03/higher-eds-slow-page-speed-epidemic/>)

Author: Erik Runyon

Published: 2021-03-04T00:00:00Z

Content type: opinion

Language: en

Sources: [Erik Runyon](<https://devfeed.tech/sources/erik-runyon.md>)

Topics: [Website](<https://devfeed.tech/topics/website.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>), [Code](<https://devfeed.tech/topics/code.md>), [Frameworks](<https://devfeed.tech/topics/frameworks.md>), [Image](<https://devfeed.tech/topics/image.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [css](<https://devfeed.tech/tags/css.md>), [deferred](<https://devfeed.tech/tags/deferred.md>), [efficiency](<https://devfeed.tech/tags/efficiency.md>), [frameworks](<https://devfeed.tech/tags/frameworks.md>), [images](<https://devfeed.tech/tags/images.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [speed](<https://devfeed.tech/tags/speed.md>), [web-development](<https://devfeed.tech/tags/web-development.md>)

### AI overview

The article discusses slow page performance on higher-education homepages and argues that agencies should help prevent it. It recommends optimizing code, reconsidering frameworks, sizing and deferring images, and using CSS and JavaScript efficiently.

### Source excerpt

Joel Goodman of Bravery Media on the current state of HigherEd homepages. Regardless, it's an agency's responsibility to do as much as possible to make that website a success when it goes live. Do no harm. Slow websites only do harm. Code needs to be optimized, frameworks need to be ditched, images need to be properly sized and deferred, CSS and JavaScript need to be used with efficiency in mind. Indeed

## How we keep our code examples fresh

DevFeed: [How we keep our code examples fresh](<https://devfeed.tech/articles/how-we-keep-our-code-examples-fresh-35983.md>)

Original publisher: [Read original article](<https://temporal.io/blog/snipsync-overview>)

Author: Cully Wakelin

Published: 2021-02-26T04:00:00Z

Content type: tutorial

Language: en

Sources: [Temporal Blog](<https://devfeed.tech/sources/temporal-blog.md>)

Topics: [Code](<https://devfeed.tech/topics/code.md>), [Documentation](<https://devfeed.tech/topics/documentation.md>), [Tool](<https://devfeed.tech/topics/tool.md>), [Snippet](<https://devfeed.tech/topics/snippet.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [tool](<https://devfeed.tech/tags/tool.md>), [tutorials](<https://devfeed.tech/tags/tutorials.md>)

### AI overview

The article introduces Snipsync, a tool that merges source-code snippets into documentation. It explains that snippets must fit the surrounding documentation and that comments, variables, and function calls may require adjustment, while the approach can reduce the effort of keeping code examples up to date.

### Source excerpt

In a previous post, about the making of our SDK tutorials, I talked a bit about a tool called Snipsync. In essence it merges source code snippets directly into our documentation, and we have been steadily converting our code examples to use it.

## Taming Deep Recursion

DevFeed: [Taming Deep Recursion](<https://devfeed.tech/articles/taming-deep-recursion-25071.md>)

Original publisher: [Read original article](<https://databasearchitects.blogspot.com/2020/11/taming-deep-recursion.html>)

Author: Thomas Neumann (noreply@blogger.com)

Published: 2020-11-22T16:50:00Z

Content type: tutorial

Language: en

Sources: [Database Architects](<https://devfeed.tech/sources/database-architects.md>)

Topics: [Data structures](<https://devfeed.tech/topics/data-structures.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Parser](<https://devfeed.tech/topics/parser.md>), [Code](<https://devfeed.tech/topics/code.md>), [Exception](<https://devfeed.tech/topics/exception.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [crash](<https://devfeed.tech/tags/crash.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [exception](<https://devfeed.tech/tags/exception.md>), [recursion](<https://devfeed.tech/tags/recursion.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [sql](<https://devfeed.tech/tags/sql.md>)

### AI overview

The article examines stack overflows caused by recursive traversal of very deep SQL expression and algebra trees. It discusses stack-usage checks, explicit-stack iteration, and compiler-supported split stacks as ways to handle unusually deep inputs while preserving simpler recursive code.

### Source excerpt

When operating on hierarchical data structures, it is often convenient to formulate that using pairwise recursive functions. For example, our semantic analysis walks that parse tree recursively and transforms it into an expression tree. This corresponding code looks roughly like this: unique_ptr<Expression> analyzeExpression(AST* astNode) { switch (astNode->getType()) { case AST::BinaryExpression: return analyzeBinaryExpression(astNode->as<BinaryExpAST>()); case AST::CaseExpression: return analyzeCaseExpression(astNode->as<CaseExpAST>()); ... } } unique_ptr<Expression> analyzeBinaryExpression(BinaryExpAST* astNode) { auto left = analyzeExpression(astNode->left); auto right = analyzeExpression(astNode->right); auto type = inferBinaryType(astNode->getOp(), left, right); return make_unique<BinaryExpression>(astNode->getOp(), move(left), move(right), type); } It recursively walks the tree, collects input expressions, infers types, and constructs new expressions. This works beautifully until you encounter a (generated) query with 300,000 expressions, which we did. At that point our program crashed due to stack overflow. Oops. Our first mitigation was using __builtin_frame_address(0) at the beginning of analyzeExpression to detect excessive stack usage, and to throw an exception if that happens. This prevented the crash, but is not very satisfying. First, it means we refuse a perfectly valid SQL query "just" because it uses 300,000 terms in one expression. And second, we cannot be sure that this is enough. There are several places in the code that recursively walk the algebra tree, and it is hard to predict their stack usage. Even worse, the depth of the tree can change due to optimizations. For example, when a query has 100,000 entries in the from clause, the initial tree is extremely wide but flat. Later, after we have stopped checking for stack overflows, the optimizer might transform that into a tree with 100,000 levels, again leading to stack overflow. Basically, all

## Create impeccable MIME email from markdown

DevFeed: [Create impeccable MIME email from markdown](<https://devfeed.tech/articles/create-impeccable-mime-email-from-markdown-21488.md>)

Original publisher: [Read original article](<https://begriffs.com/posts/2020-07-16-generating-mime-email.html>)

Published: 2020-07-16T00:00:00Z

Content type: article

Language: en

Sources: [Joe Nelson](<https://devfeed.tech/sources/joe-nelson.md>)

Topics: [Markdown](<https://devfeed.tech/topics/markdown.md>), [Code](<https://devfeed.tech/topics/code.md>), [Parsing](<https://devfeed.tech/topics/parsing.md>), [Library](<https://devfeed.tech/topics/library.md>), [HTML](<https://devfeed.tech/topics/html.md>), [Streams](<https://devfeed.tech/topics/streams.md>), [GitHub](<https://devfeed.tech/topics/github.md>)

Tags: [build](<https://devfeed.tech/tags/build.md>), [code](<https://devfeed.tech/tags/code.md>), [dependency](<https://devfeed.tech/tags/dependency.md>), [display](<https://devfeed.tech/tags/display.md>), [external](<https://devfeed.tech/tags/external.md>), [flow](<https://devfeed.tech/tags/flow.md>), [generate](<https://devfeed.tech/tags/generate.md>), [github](<https://devfeed.tech/tags/github.md>), [html](<https://devfeed.tech/tags/html.md>), [iso](<https://devfeed.tech/tags/iso.md>), [library](<https://devfeed.tech/tags/library.md>), [links](<https://devfeed.tech/tags/links.md>), [markdown](<https://devfeed.tech/tags/markdown.md>), [parsing](<https://devfeed.tech/tags/parsing.md>), [portable](<https://devfeed.tech/tags/portable.md>), [render](<https://devfeed.tech/tags/render.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [structure](<https://devfeed.tech/tags/structure.md>), [terminal](<https://devfeed.tech/tags/terminal.md>), [web](<https://devfeed.tech/tags/web.md>)

### AI overview

This article presents mimedown, a portable C99 utility that converts Markdown read from standard input into multipart MIME email written to standard output. It supports HTML and text alternatives, code snippets as inline attachments, external-link references, format=flowed text wrapping, and conservative ISO HTML output.

### Source excerpt

2020-07-16 I want to create emails that look their best in all mail clients, whether graphical or text based. Ideally I'd write a message in a simple format like Markdown, and generate the final email from the input file. Additionally, I'd like to be able to include fenced code snippets in the message, and make them available as attachments. I created a utility called mimedown that reads markdown through stdin and prints multipart MIME to stdout. Let's see it in action.

## Interacting between C libraries and Go using Unsafe

DevFeed: [Interacting between C libraries and Go using Unsafe](<https://devfeed.tech/articles/interacting-between-c-libraries-and-go-using-unsafe-39615.md>)

Original publisher: [Read original article](<https://www.gauravsarma.com/posts/2020-06-11_Interacting-between-C-libraries-and-Go-using-Unsafe-cb8b460d4f0c>)

Published: 2020-06-11T00:00:00Z

Content type: tutorial

Language: en

Sources: [Gaurav Sarma's Blog](<https://devfeed.tech/sources/gaurav-sarma-s-blog.md>)

Topics: [C](<https://devfeed.tech/topics/c.md>), [Go Language](<https://devfeed.tech/topics/go-language.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [go](<https://devfeed.tech/tags/go.md>), [memory-management](<https://devfeed.tech/tags/memory-management.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [system-programming](<https://devfeed.tech/tags/system-programming.md>)

### AI overview

This tutorial explains how to reuse C library data structures and methods from Go using the unsafe package. It discusses differences between C and Go memory management, converting C strings and pointers, and casting C data into corresponding Go structures.

### Source excerpt

Suppose we have a C lib where we have defined various data structures and methods. Due to some reason or constraint, there needs to be a Golang process which has to reuse the structures mentioned in the C lib...

## assertLastValue for RxJava TestObservers

DevFeed: [assertLastValue for RxJava TestObservers](<https://devfeed.tech/articles/assertlastvalue-for-rxjava-testobservers-25323.md>)

Original publisher: [Read original article](<https://kau.sh/blog/rxjava-test-observer-assert-last-value/>)

Author: Kaushik Gopal

Published: 2019-08-18T07:00:00Z

Content type: tutorial

Language: en

Sources: [Kaushik Gopal's Site](<https://devfeed.tech/sources/kaushik-gopal-s-site.md>)

Topics: [RxJava](<https://devfeed.tech/topics/rxjava.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [test](<https://devfeed.tech/topics/test.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [test](<https://devfeed.tech/tags/test.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

This tutorial explains how RxJava TestObserver assertions can test emitted stream values, focusing on checking the final value rather than relying on a precise intermediate index. It discusses a checklist example where the final button state is the important result and notes that index-based tests can become brittle when intermediate states change.

### Source excerpt

The TestObserver is an RxJava staple for testing. It allows you to assert values in a stream, in the specific order they were emitted. Here's a quick code snippet from the movies-usf repository 1: @Test fun onSearchingForMovieBladeRunner_shouldSeeSearchResult() { viewModel = MSMainVm(mockApp, mockMovieRepo) val viewStateTester = viewModel.viewState.test() viewModel.processInput(SearchMovieEvent("blade runner 2049")) viewStateTester.assertValueAt(1) { assertThat(it.searchedMovieTitle).isEqualTo("Searching Movie...") true } viewStateTester.assertValueAt(2) { assertThat(it.searchedMovieTitle).isEqualTo("Blade Runner 2049") // ... true } } If you look at the source for the base TestObserver, there are a bunch of these useful methods: assertValue(Predicate valuePredicate): Asserts that this TestObserver/TestSubscriber received exactly one onNext value for which the provided predicate returns true. assertValue(T value): Assert that this TestObserver/TestSubscriber received exactly one onNext value which is equal to the given value with respect to Objects.equals. assertValueAt(int index, Predicate valuePredicate): Asserts that this TestObserver/TestSubscriber received an onNext value at the given index for the provided predicate returns true. assertValueAt(int index, T value) Asserts that this TestObserver/TestSubscriber received an onNext value at the given index which is equal to the given value with respect to null-safe Object.equals. assertValues(T... values) Assert that the TestObserver/TestSubscriber received only the specified values in the specified order. assertValuesOnly(T... values) Assert that the TestObserver/TestSubscriber received only the specified values in the specified order without terminating. While all these operators are useful, most of them require you to know the precise index of the value you're testing. Typically though when i'm testing a feature built with a USF architecture, I really only care about the last value emitted in my test case. When work

## Three web development bookmarklets

DevFeed: [Three web development bookmarklets](<https://devfeed.tech/articles/three-web-development-bookmarklets-37364.md>)

Original publisher: [Read original article](<https://muffinman.io/blog/three-web-development-bookmarklets/>)

Author: Stanko

Published: 2019-08-17T00:00:00Z

Content type: tutorial

Language: en

Sources: [Stanko Tadić](<https://devfeed.tech/sources/stanko-tadic.md>)

Topics: [Development](<https://devfeed.tech/topics/development.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>), [Snippet](<https://devfeed.tech/topics/snippet.md>), [dev-tools](<https://devfeed.tech/topics/dev-tools.md>), [browser](<https://devfeed.tech/topics/browser.md>), [Code](<https://devfeed.tech/topics/code.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [console](<https://devfeed.tech/topics/console.md>)

Tags: [browser](<https://devfeed.tech/tags/browser.md>), [code](<https://devfeed.tech/tags/code.md>), [console](<https://devfeed.tech/tags/console.md>), [developer-tools](<https://devfeed.tech/tags/developer-tools.md>), [development](<https://devfeed.tech/tags/development.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [web-development](<https://devfeed.tech/tags/web-development.md>)

### AI overview

A developer shares three browser bookmarklets for web development: identifying elements that cause horizontal scrolling, making page text editable, and toggling between right-to-left and left-to-right layout directions.

### Source excerpt

Today I want to share three bookmarklets I love to use in development. You can add them to your browser, by creating a new bookmark and entering bookmarklet code instead of URL. Clicking on a bookmarkletI usually keep them in the bookmarks bar to make them easier to find. , will run the code snippet on the page you are currently on. For each bookmarklet I added a button to try it on this page. Find elements causing horizontal scroll # I found this one long time ago, and I have been copy-pasting it to every new machine since. It is super practical and it will highlight and log all elements that are causing pesky horizontal page scroll. javascript:void(function () { var documentWidth = document.documentElement.offsetWidth; var treeWalker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT); while (treeWalker.nextNode()) { var rect = treeWalker.currentNode.getBoundingClientRect(); if (rect.right > documentWidth || rect.left < 0) { treeWalker.currentNode.style.setProperty('outline', '1px dotted red', 'important'); console.log(treeWalker.currentNode); } }; }()); One line version: javascript:void(function () { var documentWidth = document.documentElement.offsetWidth; var treeWalker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT); while (treeWalker.nextNode()) { var rect = treeWalker.currentNode.getBoundingClientRect(); if (rect.right > documentWidth || rect.left < 0) { treeWalker.currentNode.style.setProperty('outline', '1px dotted red', 'important'); console.log(treeWalker.currentNode); } }; }()); Horizontal scroll detection Please note that my site has overflow-x: hidden on the content area. Make page editable # This will set contenteditable to true, allowing you to edit any text on the page. You can do the same thing using developer tools, but this one is just a little bit faster (and easier for non-developers). javascript:void(function () { document.body.contentEditable = 'true'; document.designMode = 'on'; }()); One line version: ja

[Next page](<https://devfeed.tech/tags/snippet.md?cursor=WyIyMDE5LTA4LTE3VDAwOjAwOjAwKzAwOjAwIiwgImExY2VkY2M2LTU5MGQtNDg0Yy04ZWQyLWRjY2FhYjM4YTA0YyJd>)