Skip to content

Instantly share code, notes, and snippets.

function migrateObject(obj) {
const clipPath = obj?.clipPath;
if (clipPath && clipPath.type === 'group' && clipPath.eraser === true) {
clipPath.type = 'eraser';
delete clipPath.eraser;
const rect = clipPath.objects.shift();
obj.clipPath = rect.clipPath;
obj.eraser = clipPath;
}
@ShaMan123
ShaMan123 / setupProxy.js
Last active July 24, 2021 07:11
react firebase dev proxy
/**
* Add this file in your app at `src/setupProxy.js`
* It will proxy outbound requests from your app (while in dev mode) to your firebase functions emulator.
*
* Make sure you've changed the consts!
* After that simply start the react dev server and the firebase functions emulator.
*
* Patches the behavior of `firebase.functions().useEmulator` for `onRequest` http functions.
* https://create-react-app.dev/docs/proxying-api-requests-in-development/#configuring-the-proxy-manually
*
@ShaMan123
ShaMan123 / kakuru.cpp
Last active March 11, 2021 09:15
Sudoku Solver (Kakuru needs work on CreateUnit with int creator)
#include <stdio.h>#include<stdlib.h>#include<math.h>#define NUM 9#define DIM NUM
typedef struct
{
int comb[NUM], val;
} comb;
typedef struct
{
int CO[2][2], val, type, len, indx;
comb *solution;
comb temp;
@ShaMan123
ShaMan123 / HorizontalToVerticalComponent.tsx
Last active October 22, 2019 06:09
Some utilities that render a horizontal component vertically, specifically a <Slider />
'use strict';
import React, { PropsWithChildren, useMemo } from 'react';
import { I18nManager, StyleSheet, View } from 'react-native';
/**
* You might want to change this value
* */
const verticalContainerHackSize = 50;
export enum Direction {
@ShaMan123
ShaMan123 / babel.config.js
Created March 5, 2019 09:25
config files for RN>0.57.4, including typescript (rn-cli.config.js, tsconfig.json)
module.exports = function (api) {
api.cache(true)
return {
//decoratorsBeforeExport
"presets": ["module:metro-react-native-babel-preset"],
"plugins": [
["module-resolver", {
"root": ["./src"],
"extensions": [".js", ".ts", ".tsx", ".ios.js", ".android.js"]
}],
@ShaMan123
ShaMan123 / auth.js
Last active February 17, 2018 17:18
FirebaseUI User verification/logic as part of auth flow
/*
//js file handling FirebaseUI
//TO-DO: FirebaseUI init code.......
documentation: https://github.com/firebase/firebaseui-web#available-callbacks
Flow of Data:
-- Pass params from signInSuccess callback (auth.js)
-- to cloud function getUserClaims (cloudFunctions.js)