Skip to content

Instantly share code, notes, and snippets.

View vitalyliber's full-sized avatar
🏠
Working from home

Vitaly Liber vitalyliber

🏠
Working from home
View GitHub Profile
import pg from "pg";
import databaseCredentials from "./databaseCredentials.mjs";
const createDatabase = async () => {
const dbConfig = databaseCredentials;
const databaseName = dbConfig.database;
delete dbConfig.database;
const htmlData = [
{
type: "span",
value: "one"
},
{
type: "div",
value: {
type: "p",
value: "two"
import React, { useCallback } from "react";
import { Text, View, TouchableOpacity, StyleSheet } from "react-native";
import useNavigationHook from "../hooks/useNavigationHook";
const FloatBtn = () => {
const navigation = useNavigationHook();
const openHire = useCallback(() => navigation.navigate("Hire"), []);
return (
<View style={styles.container}>
<TouchableOpacity onPress={openHire} style={styles.btn}>
@vitalyliber
vitalyliber / Button.js
Created December 10, 2020 21:26
Button.js
import theme from "../styles/styles";
import ActivityIndicator from "./ActivityIndicator";
export default function Button({
text,
onClick,
isLoading = false,
disabled = false,
}) {
return (
@vitalyliber
vitalyliber / unlockContent.js
Created December 10, 2020 21:23
unlockContent.js
import { store } from "../store";
import { Alert, Platform } from "react-native";
import { createJob, updateJobImage } from "../api/remote_jobs";
import * as RootNavigation from "../navigation/RootNavigation.js";
import checkFileSafely from "./checkFileSafely";
const unlockContent = async ({
setSize,
mutate,
receipt,
@vitalyliber
vitalyliber / listPage.js
Last active December 10, 2020 21:17
listPage.js
import { useState } from "react";
import Header from "../components/Header";
import Container from "../components/Container";
import Row from "../components/Row";
import Filler from "../components/Filler";
import useSWR from "swr";
import { getTasks } from "../api/tasks";
import TaskPage from "../components/TaskPage";
import Button from "../components/Button";
// LinkComponent.js
import React from "react";
import { View, Platform, TouchableOpacity } from "react-native";
let Link = null;
if (Platform.OS === "web") {
Link = require('next/link').default;
}
const LinkComponent = (props) => {
// purchaseTile.expo.js
const purchaseTile = async () => {
console.log('In-App purchases is not available')
};
export default purchaseTile;
@vitalyliber
vitalyliber / purchaseTile.js
Last active October 28, 2020 11:53
In-App purchase
// purchaseTile.js
import { getProductsAsync, purchaseItemAsync, IAPResponseCode } from "expo-in-app-purchases";
const purchaseTile = async () => {
const productId = 'post_job';
const items = Platform.select({
ios: [productId],
android: [productId],
});
import React, { useState } from "react";
import axios from "axios";
const Form = () => {
const [inputValue, setInputValue] = useState("");
return (
<div>
<input value={inputValue} onChange={e => setInputValue(e.target.value)} />
<p>{inputValue}</p>
<button