Skip to content

Instantly share code, notes, and snippets.

View Manoj85's full-sized avatar
🎯
Focusing

Manoj Talagadadeevi Manoj85

🎯
Focusing
View GitHub Profile
@astoilkov
astoilkov / readme.md
Last active March 13, 2024 10:19
Async Operations with useReducer Hook

Async Operations with useReducer Hook

9 March, 2019

We were discussing with @erusev what we can do with async operation when using useReducer() in our application. Our app is simple and we don't want to use a state management library. All our requirements are satisfied with using one root useReducer(). The problem we are facing and don't know how to solve is async operations.

In a discussion with Dan Abramov he recommends Solution 3 but points out that things are fresh with hooks and there could be better ways of handling the problem.

Problem

// UPDATE: don't use this. when it re-partitions the list when time moves forward, it does not correctly keep hashes
// Use a real merkle tree instead: https://gist.github.com/jlongster/f431b6d75ef29c1a2ed000715aef9c8c
import Timestamp from './timestamp';
// This is a compact data structure that keeps track of a list of
// hashes (representing messages) over a range of time in order to
// figure out what has changed between clients, kinda like a Merkle
// tree. It creates "buckets" that represent different time ranges,
// and divides time into smaller buckets the more recent they are. The
@ericclemmons
ericclemmons / example.md
Last active July 17, 2024 06:50
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
import React from 'react';
import 'jscolor';
let uniqueIdCounter = 0;
class CustomColorPicker extends React.Component {
constructor(){
super();
this.uniqueId = `customColorPickerId${++uniqueIdCounter}`
}
@btroncone
btroncone / ngrxintro.md
Last active June 26, 2024 08:27
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@ezekielchentnik
ezekielchentnik / redux-diagram.png
Last active January 11, 2019 01:57
Diagram of how redux works
redux-diagram.png
@Whelton
Whelton / LinkedInBulkAccept.js
Last active April 16, 2018 02:57
LinkedIn Bulk Accept Invitations Magical Hacky Script
/*
* LinkedIn Bulk Accept Invitations Super Magical Hacky Script
*
* Just past this as a whole into the JavaScrip console on Chrome (or browser of choice)
*
*/
// function simulating the clicks on checkbox and 'accept' button
var catsFromSpace = function(){
console.log("Doing the bulk invite dance"); // Log it, log it real good
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing
@iainconnor
iainconnor / Android Studio .gitignore
Created January 24, 2014 20:20
A .gitignore for use in Android Studio
# Built application files
/*/build/
# Crashlytics configuations
com_crashlytics_export_strings.xml
# Local configuration file (sdk path, etc)
local.properties
# Gradle generated files