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 / gist:fb68c34a461d922cd86c
Created July 1, 2015 08:37
Using babel browser.js to compile ES6 and JSX code
<!DOCTYPE html>
<html>
<head>
<script src="./react-0.13.3.min.js"></script>
<script src="./browser.min.js"></script>
</head>
<body>
<div id="mount"></div>
</body>
@nilshartmann
nilshartmann / add_bb.sh
Last active August 29, 2015 14:26
Bash function that creates a private BitBucket Repository for your current local Git repository
# Creates a private BitBucket repository with one call from bash
# --------------------------------------------------------------------------------
#
# Uses the BitBucket REST API to create a new private, non-forkable repository
# for the local Git repository your currently staying in.
# The content of your local repository gets pushed after the repository is created.
#
# Prequisites:
# - you must have curl installed
# - your local repo must not have a remote already connect to a bitbucket repo
@nilshartmann
nilshartmann / main.jsx
Created February 28, 2017 10:52
Access React Component using 'ref'
import React from 'react';
import ReactDOM from 'react-dom';
class Input extends React.Component {
constructor() {
super();
this.state = {
greeting: ''
}
}
@nilshartmann
nilshartmann / getEventTarget.js
Last active December 31, 2022 16:56
React and Web Component ()
function getEventTarget(nativeEvent) {
var target = nativeEvent.target || nativeEvent.srcElement || window;
// If encapsulated in a Web Component
// use the Event path
if(nativeEvent.path && nativeEvent.path[0]) {
return nativeEvent.path[0];
}
// Normalize SVG <use> element events #4963
class Hello {
async greet() {
return new Promise(res => {
setTimeout(() => res("Hallo Welt"), 1000);
});
}
}
const hello = new Hello();
(async () => {

Libraries and Tools for React

If you're developing an application based on React it can be helpful if you don't need to develop all the basic UI components yourself. Here you can find a list with various components, component libraries and complete design systems developed with and for React.

As the list got longer and longer I thought it would be better to have a "real" site for it.

👉 Please find the (new) list here: https://react-libs.nilshartmann.net/

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ApolloClient } from "apollo-client";
import { HttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";
import { ApolloProvider, withApollo } from "react-apollo";
const apolloClient = new ApolloClient({
@nilshartmann
nilshartmann / README.md
Created April 30, 2018 16:14
Transform Apollo GraphQL Query Types

Currently when using apollo-codegen to generate TypeScript types for query definitions (ts-modern target), the generated types are called as the query name. So if you have a GetUserQuery your basetype is called GetUserQuery.
But in fact the type does not desribe the actual query, but the outcome, the result of the query, so it would be better if the type would have been named like UserQueryResult.

There is an issue in apollo-codegen where this issue is discussed: apollographql/apollo-tooling#315

But as there is currently no progress I wrote a little codemod (using jscodeshift) that renames the types after they have been generated. You can find the transform.js script below.

Color Scheme Generators

Web

@nilshartmann
nilshartmann / graphql-links.md
Created November 12, 2019 08:13
GraphQL Links