Skip to content

Instantly share code, notes, and snippets.

View ahmad2smile's full-sized avatar

Ahmad ahmad2smile

View GitHub Profile
@ahmad2smile
ahmad2smile / setupTests.ts
Created March 8, 2021 11:15
Mock Missing SVG Functions in JSDom for Jest
beforeEach(()=>{
Object.defineProperty(global.SVGSVGElement.prototype, 'createSVGMatrix', {
writable: true,
value: jest.fn().mockImplementation(() => ({
martix: jest.fn(() => [[]]),
a: 0,
b: 0,
c: 0,
d: 0,
// Self Modifying Code - Just for fun
//
// Created by Osman Azam on 3/22/14.
// Copyright (c) 2014 Osman Azam. All rights reserved.
//
// This code was tested on OSX. It will probably work in most *NIX systems.
// For windows you will need to find the win32 equivalent of mprotect and
// use a different method of putting the addTwoNumbers function into a data
// section. Also you will need to convert the inline assemblye from AT&T style