Skip to content

Instantly share code, notes, and snippets.

@MartinCura
MartinCura / ManyToManyReactAdminComponents.tsx
Last active April 13, 2024 20:56
react-admin (w/ hasura backend) components for many-to-many (M2M) relationship management
/**
* I couldn't find online any way of managing entities with a M2M relationship in react-admin with hasura backend,
* so here are mine.
* Example of what you can do: to the Edit view of your Movie resource, add DeletableRelatedResourceList
* to list and delete associated actors, and M2MRelatedResourceSelectInput to add new associated actors
* (with an intermediary table movie_actors).
*
* Done with react-admin@3.19.0
*/
@LatinSuD
LatinSuD / gist:b86280e571ce7fb22b0e2808a0c99ab0
Created September 9, 2021 07:22
Wiki.js search user script
// ==UserScript==
// @name Wiki.js Search
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://mydomain.com/?search=*
// @grant none
// @run-at document-idle
// ==/UserScript==
@tspvivek
tspvivek / directus_mover.sh
Last active June 27, 2023 03:09
Directus postgres DB - Script to move schema changes between different servers without replacing data
#!/bin/sh
start=`date +%s.%N`
SRC_CONNECTION_STRING="postgresql://src_username:src_password@src_host/src_dbname"
DST_CONNECTION_STRING="postgresql://dst_username:dst_password@dst_host/dst_dbname"
rm src_schema.sql
rm src_data.sql
rm dst_data.sql
@trungvose
trungvose / nx-structure-angular-nestjs.md
Last active April 1, 2024 11:23
Nx workspace structure for NestJS and Angular

Nx

https://nx.dev/

Nx is a suite of powerful, extensible dev tools to help you architect, test, and build at any scale — integrating seamlessly with modern technologies and libraries while providing a robust CLI, caching, dependency management, and more.

It has first-class support for many frontend and backend technologies, so its documentation comes in multiple flavours.

Principles

@molomby
molomby / Keystone 5 - Secure Cookies and Reverse Proxies.md
Created March 31, 2020 05:52
Background and instructions for fixing cookie issues encountered when deploying Keystone 5 apps behind a reverse proxy (like nginx)

Keystone 5: Secure Cookies and Reverse Proxies

Can't sign in, eh?

TL;DR

When...

  • Keystone sessions are being used (eg. for authentication)
  • secureCookies Keystone config is true (the default when NODE_ENV is 'production')
@tgroshon
tgroshon / react-patterns-post-draft.md
Last active March 24, 2023 23:24
Draft of "React Patterns in a Post-Hooks World"
title author
React Patterns in a Post-Hooks World
name url
Tommy Groshong

Introduction

React is an amazing library and over the last 5 years has transformed the

@kuhelbeher
kuhelbeher / readme.md
Last active December 6, 2022 16:20
Eslint airbnb config + prettier for create-react-app project

This is tutorial of onfiguring eslint, prettier for your project

Make your code great again

  1. Eslint

First of all we need to install eslint and configs as dev dependencies. You can use your own config, but I will use config from airbnb:

yarn add -D eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react
@rumansaleem
rumansaleem / clean-up-arch-linux.md
Created May 28, 2019 08:51
Instructions to clean up Arch Linux (Manjaro)

Contents

  • Clean pkg cache
  • Remove unused packages (orphans)
  • Clean cache in /home
  • remove old config files
  • Find and Remove
    • duplicates
    • empty files
    • empty directories
  • broken symlinks
@MuhsinFatih
MuhsinFatih / pythondoneright.md
Last active April 18, 2024 08:10
How to recover from messed up python installation on mac, and never have to mess with apple's shitty python confusion factory

I am assuming you are here because like me, you installed a bazillion different python interpreters on mac and the whole thing is a spagetti. Today, I finally fixed my python installation. Whatever I install for python2 or python3 using pip JUST.WORKS.. My god! finally.

What the hell?

Here is what I had messed up, which you also probably did:

  • I had too many different python interpreters
  • Too many different symlinks which I lost track of
  • almost no package I installed with pip worked without a headache
  • any attempt to fix using online resources made it worse.
@dphrag
dphrag / ErrorFocus.jsx
Created November 1, 2018 23:41
Formik Scroll To First Invalid Element W/O Refs
import React from 'react';
import { connect } from 'formik';
class ErrorFocus extends React.Component {
componentDidUpdate(prevProps) {
const { isSubmitting, isValidating, errors } = prevProps.formik;
const keys = Object.keys(errors);
if (keys.length > 0 && isSubmitting && !isValidating) {
const selector = `[id="${keys[0]}"]`;
const errorElement = document.querySelector(selector);