Skip to content

Instantly share code, notes, and snippets.


Ashish Rawat eashish93

View GitHub Profile
BrianHung / Editor.tsx
Created Apr 29, 2022
ProseMirror and Granular Updates with React useSyncExternalStore
View Editor.tsx
import React, { createContext, useContext, useState, useRef } from "react"
import { EditorView, EditorProps } from "prosemirror-view"
import { useSyncExternalStore } from "use-sync-external-store/shim"
import { useSyncExternalStoreWithSelector } from "use-sync-external-store/with-selector"
import { memo, useEffect } from "react"
import { useEditorContext } from "./hooks/useEditor"
nadavrot /
Last active Aug 14, 2022
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).


Matrix multiplication is a mathematical operation that defines the product of

hilkeheremans / howto
Last active Dec 8, 2020
Fonts in React Native for Android vs iOS
View howto
Tested for React Native 0.41+
- Place the fonts in the assets and make sure they are bundled along
- On iOS, fontFamily in Text match the Font Family name as described in Font Book (macOS). Font weights can be specified exactly.
On Android, there are two ways of using fonts:
paolorotolo /
Last active Jun 17, 2018
Class to easily backup/restore data from Realm.
import android.Manifest;
import android.os.Environment;
import android.util.Log;
import android.widget.Toast;
paulirish /
Last active Aug 7, 2022
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$" "$extension_id%26uc" 
unzip -d "$extension_id-source" "$"

Thx to crxviewer for the magic download URL.

CMCDragonkai /
Last active Aug 13, 2022
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

View on-jsx.markdown

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

LeCoupa /
Last active Aug 13, 2022
Bash CheatSheet for UNIX Systems --> UPDATED VERSION -->
# Name: Bash CheatSheet for Mac OSX
# A little overlook of the Bash basics
# Usage:
# Author: J. Le Coupanec
# Date: 2014/11/04
mikaelbr / destructuring.js
Last active Jul 15, 2022
Complete collection of JavaScript destructuring. Runnable demos and slides about the same topic:
View destructuring.js
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
denji /
Last active Aug 15, 2022
NGINX tuning for best performance

Moved to git repository:

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.