Skip to content

Instantly share code, notes, and snippets.

@shlomoweb1
shlomoweb1 / typescriptreact.json
Last active March 13, 2024 11:33
A vscode custom snippest creating context with reducer
{
"TS + React Context Provider + reducer": {
"prefix": "rcp",
"body": [
"import React, { createContext, useReducer, useContext } from 'react';",
"import type { PropsWithChildren, FC } from 'react';",
"",
"// eslint-disable-next-line @typescript-eslint/no-empty-interface",
"interface $1ProviderProps extends PropsWithChildren {",
" // Provider Props goes here",
@shlomoweb1
shlomoweb1 / j5.tsx
Created November 22, 2023 12:30
verifon iframe (react)
import { useContext, useEffect, useRef } from "react";
import { DispatchOrderContext } from "./wrapper";
export const ShowJ5Form = () => {
const { state: { charge: { j5: { url } } } } = useContext(DispatchOrderContext);
const paymentDiv = useRef<HTMLDivElement>()
useEffect(()=>{
if(!url) {
if(paymentDiv && paymentDiv.current){
interface NominatimResponse {
place_id: number;
licence: string;
osm_type: string;
osm_id: number;
boundingbox: string[];
lat: string;
lon: string;
display_name: string;
class: string;
@shlomoweb1
shlomoweb1 / MainApplication.java
Last active June 22, 2023 23:37
Java Android Permission with fallback up to android Q, React Native
package com.myApp;
import android.app.Application;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
import com.facebook.react.defaults.DefaultReactNativeHost;
import com.facebook.soloader.SoLoader;
@shlomoweb1
shlomoweb1 / build.android.release.apk.sh
Last active June 18, 2023 17:52
React Native compile Android to APK
#!/bin/sh
# Get the script's directory (OS-safe)
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# Change directory to the script's directory
cd "$script_dir"
# Run 'bumpVersion.js' with node (OS-safe)
if [ "$(uname -s)" = "Linux" ] || [ "$(uname -s)" = "Darwin" ]; then
@shlomoweb1
shlomoweb1 / callback-modal.vue
Last active June 2, 2020 17:52
VueJS boostrap modal promise
<template>
<div class="position-relative" style="height: 100vh">
<div class="card mb-2 position-absolute w-100" style="bottom: 0">
<a
v-if="isIframe"
class="btn btn-block btn-success text-light"
@click="close()"
>Sample close on callback</a
>