Skip to content

Instantly share code, notes, and snippets.

View maskaravivek's full-sized avatar
💭
Active!

Vivek Kumar Maskara maskaravivek

💭
Active!
View GitHub Profile
POST https://api.github.com/repos/{user}/{repo}/git/trees
const createGithubFileBlob = async (
githubAccessToken,
repoFullName,
content,
encoding = "utf-8"
) => {
const blobResp = await fetch(
`https://api.github.com/repos/${repoFullName}/git/blobs`,
{
method: "POST",
POST https://api.github.com/repos/{user}/{repo}/git/blobs
const getShaForBaseTree = async (
githubAccessToken,
repoFullName,
branchName
) => {
const baseTreeResp = await fetch(
`https://api.github.com/repos/${repoFullName}/git/trees/${branchName}`,
{
method: "GET",
headers: {
GET https://api.github.com/repos/{user}/{repo}/git/trees/{branch}
const articleFiles = [
{
path: "/my-new-website/index.html",
content: "Hello World!",
encoding: "utf-8",
},
{
path: "/my-new-website/images/logo.png",
content: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQ",
encoding: "base64",
const createGithubFileBlob = async (githubAccessToken, repoFullName, content, encoding = "utf-8") => {
const blobResp = await fetch(`https://api.github.com/repos/${repoFullName}/git/blobs`,
{
method: 'POST',
headers: {
'Accept': 'application/vnd.github+json',
'Authorization': `Bearer ${githubAccessToken}`,
'X-GitHub-Api-Version': '2022-11-28'
},
body: JSON.stringify({
import { useRef } from "react";
import { View, Button } from "react-native";
import ViewShot from "react-native-view-shot";
import Share from "react-native-share";
import RNFS from "react-native-fs";
export default function MorgageCalculatorSummary() {
const ref = useRef();
const captureAndShareScreenshot = () => {
// add following imports at the top
import Share from "react-native-share";
import RNFS from "react-native-fs";
const captureAndShareScreenshot = () => {
if (!ref || !ref.current) {
return;
}
ref.current.capture().then((uri: any) => {
RNFS.readFile(uri, "base64").then((res) => {
import { useRef } from "react";
import { View, Button } from "react-native";
import ViewShot from "react-native-view-shot";
export default function MyCustomComponent() {
const ref = useRef();
return (
<Box>
<Button