Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🏎

Mayank Jethva mayank23

💭
🏎
View GitHub Profile
@mayank23
mayank23 / README.md
Last active Feb 3, 2021
Jest Mock Any Property on Window Utility - with automatic cleanup
View README.md

Jest Mock Any Property on Window Utility - with automatic cleanup.

@mayank23
mayank23 / bundle.js
Last active Jan 6, 2020
Basic Css Loader
View bundle.js
(function(modules) {
function require(id) {
const [fn, mapping] = modules[id];
function localRequire(name) {
return require(mapping[name]);
}
const module = { exports : {} };
@mayank23
mayank23 / NewLines.jsx
Last active Nov 2, 2018
React New Lines ("\n") Example - babel / react / css (white space pre-wrap)
View NewLines.jsx
import React from 'react';
import { render } from 'react-dom';
import Hello from './Hello';
const styles = {
fontFamily: 'sans-serif',
textAlign: 'center',
};
const App = () => {
@mayank23
mayank23 / ActionTypeMatching.js
Last active Jun 30, 2020
Jest user defined asymmetric matchers
View ActionTypeMatching.js
import * as actionTypes from './action-types.js';
class ActionTypeMatching extends AsymmetricMatcher {
constructor(expected){
this.$$typeof = Symbol.for('jest.asymmetricMatcher');
this.expected = expected;
}
asymmetricMatch(other) {