Skip to content

Instantly share code, notes, and snippets.

import { jsx } from "slate-hyperscript";
export const deserialize = el => {
const TEXT_TAGS = {
CODE: () => ({ code: true }),
DEL: () => ({ strikethrough: true }),
EM: () => ({ italic: true }),
I: () => ({ italic: true }),
S: () => ({ strikethrough: true }),
STRONG: () => ({ bold: true }),
import escapeHtml from "escape-html";
import { Text } from "slate";
export const serialize = node => {
let nodeText = escapeHtml(node.text);
if (Text.isText(node)) {
if (node["bold"]) {
nodeText = `<strong>` + nodeText + `</strong>`;
}
@abhishekbhardwaj
abhishekbhardwaj / custom_game_engines_small_study.md
Created April 25, 2020 01:50 — forked from raysan5/custom_game_engines_small_study.md
A small state-of-the-art study on custom engines

CUSTOM GAME ENGINES: A Small Study

a_plague_tale

A couple of weeks ago I played (and finished) A Plague Tale, a game by Asobo Studio. I was really captivated by the game, not only by the beautiful graphics but also by the story and the locations in the game. I decided to investigate a bit about the game tech and I was surprised to see it was developed with a custom engine by a relatively small studio. I know there are some companies using custom engines but it's very difficult to find a detailed market study with that kind of information curated and updated. So this article.

Nowadays lots of companies choose engines like Unreal or Unity for their games (or that's what lot of people think) becaus

@abhishekbhardwaj
abhishekbhardwaj / useStateIfMounted.ts
Last active February 15, 2021 14:36
useStateIfMounted: Use this instead of useState with Inertia.js if running into "Can't perform a React state update on an unmounted component". The error happens because the server-side redirect doesn't give your component enough time to clean up.
import { useEffect, useRef, useState } from "react";
export default function useStateIfMounted<T>(
initialState: T
): [T, (newState: T) => void] {
const isMounted = useRef(true);
const [state, setState] = useState(initialState);
useEffect(() => {
return () => {