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, {Component} from 'react'; | |
import { | |
View, | |
StyleSheet, | |
TouchableOpacity, | |
} from 'react-native'; | |
import { | |
dispRate, isAndroid, | |
} from '../config'; |
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
// 코라이나의 예전 API가 다음과 같은 객체의 배열을 리턴한다. | |
// 즉, 날짜별로 데이터를 정리해준 것이다 | |
[ | |
{ | |
"forecast_date": "2020-07-16", | |
"temp": 21, | |
"temp_min": 19, | |
"temp_max": 24, | |
"humidity": 85, | |
"sky": 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
// 어떤 프로그램은 상황에 따라 serverless로 실행해야 하다가도 다시 EC2에서 실행해야 할 수도 있다. | |
// 그런데, EC2에서 실행될 때에는 로그를 별도의 파일에 기록해야 하는 반면, AWS Lambda의 경우는 CloudWatch 에서 확인하면 된다. | |
// EC2 에서 실행되는 경우에는 log4js 를 통해 로그를 기록하는 것이 좋고, | |
// AWS Lambda 에서는 기본적으로 console.log 로 출력하는 것이 좋다. | |
// 2 가지 경우에 대해 유연하게 대처하기 위해서는 AWS Lambda 일 때에도 log4js 를 사용하되 | |
// 아래와 같이 appenders 의 type 을 'console' 로 지정하면, console.log로 출력한 것과 동일해진다 | |
import log4js from 'log4js'; | |
log4js.configure({ | |
appenders: { 'out': { type: 'console', layout: { type: 'messagePassThrough' } } }, |
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 newString = _.replace(givenString, /\(|\)|\s|,/g, '') | |
const newString2 = givenString.replace(/\(|\)|\s|,/g, '') |
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
// caused error when running with iOS Simulator | |
// because iOS Simulator does not provide locale and timezone | |
import ExpoLocalization from './ExpoLocalization'; | |
// Web, Android, and some iOS values use `-`. This will convert the iOS values that use `_` | |
// https://github.com/expo/expo/blob/21ae94bae2e8369992050c433a00699d425b35bd/packages/expo/src/Localization.ts#L112-L114 | |
const parseLocale = (locale) => locale.replace('_', '-'); <-- Original | |
const parseLocale = (locale) => {if (!locale) return null; return locale.replace('_', '-')}; <-- Modified |
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 parse from 'csv-parse/lib/sync'; | |
import fs from 'fs' | |
const csv = fs.readFileSync('src/countries.csv') | |
const records = parse(csv.toString('utf-8'), { | |
columns: true, | |
skip_empty_lines: true | |
}) | |
fs.writeFileSync('src/countrycode.js', JSON.stringify(records, null, 2)) |
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
// Original data from https://countrycode.org/ | |
// I translated the table to csv, and then converted csv to JSON by using csv-parse. | |
[ | |
{ | |
"name": "Afghanistan", | |
"telCode": "93", | |
"population": "29,121,286", | |
"area": "647,500", | |
"gdp": "20.65 Billion", |
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
// MY_META DynamoDB table has a primary key "name" and a attribute "value" | |
// Added a record with "lastUsedSid" as name, and a Number as value. | |
export function getNextValidSid (callback) { | |
const params = { | |
TableName: MY_META, | |
Key: { | |
'name': 'lastUsedSid', | |
}, | |
UpdateExpression: 'set #v = #v + :val', |
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
// Reference: https://en.wikipedia.org/wiki/Prefectures_of_Japan#By_English_name | |
[ | |
{ | |
name: 'Hokkaido', | |
jpName: '北海道', | |
id: '01', | |
prefs: [ // prefs means Prefectures | |
{ | |
name: 'Hokkaido', |
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
{ | |
"presets": [ | |
[ | |
"@babel/preset-env", | |
{ | |
"targets": { | |
"node": "10" | |
} | |
} | |
] |
NewerOlder