Skip to content

Instantly share code, notes, and snippets.

View nilshartmann's full-sized avatar
🐿️
https://graphql.schule

Nils Hartmann nilshartmann

🐿️
https://graphql.schule
View GitHub Profile
@nilshartmann
nilshartmann / hover-link-tooltip.js
Created April 29, 2025 18:42
"Tooltip" on hover+Cmd on an Link/a-Element on a website
@nilshartmann
nilshartmann / react19-training.md
Created March 19, 2025 05:26
React Training technische Voraussetzungen

Preparations for React Training

During the workshop, we will complete exercises. To participate, you need to install some necessary tools (if you haven't already).

You can use this guide to check, if your setup works before the workshop. This ensures you have time to resolve any issues, especially if your computer has security restrictions or you lack full administrative access.

Requirements

For Your Laptop/PC

async function loadArticle(articleId) { /* ... */ }
async function loadComments(articleId) { /* ... */ }
async function Page( {articleId} ) {
// Beide Requests starten parallel
const articlePromise = loadArticle(articleId);
const commentsPromise = loadComments(articleId);
return <React.Suspense fallback={<h1>Please wait, data is loading</h1>}>
export default undefined;
type Container<T> = {
consume: (arg: T) => void;
};
// string ist super-type von "hello" 😳
// Entspricht in C# sowas hier:
// public class Event { } // => string
// public class MouseEvent : Event { } // => "hello"
type StringType = string;
@nilshartmann
nilshartmann / DeprecationInstrumentation.java
Last active September 10, 2022 06:22
Write usage of deprecated GraphQL fields to extensions field and dump on browser console (graphql-java/Spring for GraphQL, Apollo Client)
package nh.publy.backend.util;
import graphql.ExecutionResult;
import graphql.ExecutionResultImpl;
import graphql.execution.instrumentation.InstrumentationContext;
import graphql.execution.instrumentation.InstrumentationState;
import graphql.execution.instrumentation.SimpleInstrumentation;
import graphql.execution.instrumentation.parameters.InstrumentationExecutionParameters;
import graphql.execution.instrumentation.parameters.InstrumentationFieldFetchParameters;
import graphql.schema.GraphQLFieldDefinition;
abstract class BaseError {
  private final String message;
  
  public BaseError(String message) { this.message = message; }
  
  public String getMessage() { return this.message; }
}
@nilshartmann
nilshartmann / graphql-queries-stories.md
Last active March 21, 2025 18:56
GraphQL-Query-Stories
  • Try to run a query that returns the first ten stories and requests the following fields:
    • ID, title, excerpt, publication date, who wrote the story, and the first ten comments for each story
query {
  stories(first: 10) {
    nodes {
      id
      title
 excerpt
#! /bin/zsh
#xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Routing after handling an action in Redux

Note: this are simplified example, concept only, not correct syntax etc.!

Approach one: use history object in thunk action creator

// my-app-history

I recently (october 2020) evaluated MobX for a project as alternative to Redux (Redux Toolkit).

You can find my very subjective impressions below.

Redux DevTools better than MobX (for me they were more helpful when finding bugs)

Redux is more widely used than MobX

Change/Dependency tracking in MobX is powerful but not always obvious how it works (both behind the scene and in my application). If values didn't update where I expected it, finding the bug sometimes was hard