Skip to content

Instantly share code, notes, and snippets.

View sankargorthi's full-sized avatar

Sankar Gorthi sankargorthi

  • Veeva Systems
  • Pleasanton, CA
View GitHub Profile
const {useCallback, useEffect, useReducer, useRef} = require('react');
let effectCapture = null;
exports.useReducerWithEmitEffect = function(reducer, initialArg, init) {
let updateCounter = useRef(0);
let wrappedReducer = useCallback(function(oldWrappedState, action) {
effectCapture = [];
try {
let newState = reducer(oldWrappedState.state, action.action);
@kingargyle
kingargyle / SelfReturningAnswer.java
Created February 1, 2017 15:15
Self Returning Answer for Mockito
public class SelfReturningAnswer implements Answer<Object> {
public Object answer(InvocationOnMock invocation) throws Throwable {
Object mock = invocation.getMock();
if( invocation.getMethod().getReturnType().isInstance( mock )){
return mock;
}
else{
return RETURNS_DEFAULTS.get().answer(invocation);
}
@coryhouse
coryhouse / package.json
Last active April 15, 2023 15:08
package.json for Building a JS Development Environment on Pluralsight
{
"name": "javascript-development-environment",
"version": "1.0.0",
"description": "JavaScript development environment Pluralsight course by Cory House",
"scripts": {
},
"author": "Cory House",
"license": "MIT",
"dependencies": {
"whatwg-fetch": "1.0.0"