Skip to content

Instantly share code, notes, and snippets.

View wheelo's full-sized avatar
🏀
Bustling

Erik Peng wheelo

🏀
Bustling
View GitHub Profile
@justblender
justblender / useAppSelector.ts
Last active March 24, 2022 10:20
Custom Redux.useSelector() hook for React Native apps
import { useEffect, useReducer, useRef } from 'react';
import { useNavigation } from '@react-navigation/native';
import { useSelector } from 'react-redux';
const undefinedRef = Symbol();
const refEquality = (a: Object, b: Object) => a === b;
export function useAppSelector<Selected = unknown>(
@gaearon
gaearon / MyResponsiveComponent.js
Created November 1, 2018 10:05
Examples from "Making Sense of React Hooks"
function MyResponsiveComponent() {
const width = useWindowWidth(); // Our custom Hook
return (
<p>Window width is {width}</p>
);
}
@wheelo
wheelo / nginx.conf
Created January 13, 2017 15:23 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

I did some poking around CodeMirror and how it works, particularly with it's current code folding implementation. My goal was to see if there was a way to only have part of the string in memory, render those parts, and still have line numbers be correct. My goal was to have the editor display something like this:

1 
2 
3  function() {
27 }
28
@acdlite
acdlite / app.js
Last active January 20, 2023 08:23
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@nsimmons
nsimmons / ReactNative-Deep-Dive.md
Last active October 9, 2023 07:48
ReactNative Deep Dive
@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing