https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from "react"; | |
import urljoin from "url-join"; | |
const useSave = <T>(method: "post" | "put") => { | |
const [isSaving, setIsSaving] = useState(false); | |
const [error, setError] = useState(""); | |
const save = async (endpoint: string, body: T) => { | |
setError(""); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCallback, useEffect, useState } from "react"; | |
const useGet = <T>(endpoint: string) => { | |
const [data, setData] = useState<T | null>(null); | |
const [isLoading, setIsLoading] = useState(false); | |
const [error, setError] = useState(""); | |
const fetchData = useCallback(async () => { | |
setError(""); | |
setIsLoading(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const s3 = require("../aws").s3; | |
/** | |
* List all objects in the specified S3 folder. | |
* @param {String} Bucket | |
* @param {String} Prefix | |
* @param {String} NextContinuationToken | |
* @param {Array} PreviousContents | |
* @returns {Promise<Array>} A promise containing an array of all objects in the folder | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { MaskedViewIOS, View } from "react-native"; | |
import LinearGradient from "react-native-linear-gradient"; | |
// ... | |
const MaskedView = Platform.OS == "ios" ? MaskedViewIOS : View; | |
render = () => { | |
return ( | |
<MaskedView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var { height, width } = Dimensions.get("window"); | |
const isIpad = Platform.OS == "ios" && height / width == 4 / 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//// | |
import Modal from "react-native-modalbox"; | |
const { width, height } = Dimensions.get("window"); | |
//// | |
renderModal = () => { | |
let marginTop = height / 2 - 20; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var scanAll = require("./scanAll"); | |
var docClient = require("../aws").docClient; | |
var co = require("co"); | |
var modifyAll = co.wrap(function*(table, action) { | |
var items = yield scanAll(table); | |
var promises = []; | |
for (var i = 0; i < items.length; i++) { | |
items[i] = action(items[i]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
/* | |
Read a text file and out put the content. | |
Example Usage: | |
var myTxt = require("./myTxt.txt"); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var docClient = require("../aws").docClient; | |
var co = require("co"); | |
var queryAll = co.wrap(function*( | |
params, | |
previousItems, | |
lastEvaluatedKey | |
) { | |
var items = previousItems || []; |
NewerOlder