Skip to content

Instantly share code, notes, and snippets.

View marsinearth's full-sized avatar
🧑‍💻
lucratively coding

Hwasung Kim marsinearth

🧑‍💻
lucratively coding
  • Seoul
  • 00:46 (UTC +09:00)
View GitHub Profile
@marsinearth
marsinearth / typedAxios.ts
Last active September 18, 2020 12:00
for typed api classes using Axios
import Axios, { AxiosPromise, AxiosError, AxiosResponse, AxiosRequestConfig } from 'axios';
interface callbackOptions {
successCb?: (params?: any) => void;
failureCb?: (params?: any) => void;
spinnerCb?: (on: boolean) => void;
};
async function fetchFlow<RT>(apiClass: AxiosPromise<RT>, apiClassName: string, options?: callbackOptions) {
const { successCb, failureCb, spinnerCb } = options || {};
@marsinearth
marsinearth / react-native-bundle-commands.txt
Last active January 10, 2019 07:34
react-native bundle commands
iOS:
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
android:
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/index.android.bundle --assets-dest android/app/src/main/res/
watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro* && rm -rf $TMPDIR/haste-*
cd node_modules/react-native/scripts && ./ios-install-third-party.sh && cd ../../../
cd node_modules/react-native/third-party/glog-0.3.5/ && ../../scripts/ios-configure-glog.sh && cd ../../../../
Also - If you want to build app for iOS 12 you have to switch path to the active developer directory:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
geth \
--rpc \
--rpcapi "db,miner,net,txpool,network,eth,net,web3,personal" \
--cache=1024 \
--rpcport 8545 \
--rpcaddr "{address}" \
--rpccorsdomain "*" \
--port 8546 \
--networkid 42 \
--datadir "xxx/ethereum_data" \
@marsinearth
marsinearth / debounce_eg.js
Created July 24, 2018 11:18
debounce예제
import React, { PureComponent } from 'react'
import { TouchableOpacity, View, Text } from 'react-native'
import _debounce from 'lodash/debounce'
const DELAY = 400
class HomeButton extends PureComponent {
onDebounce = _debounce(this.onPress, DELAY)
@marsinearth
marsinearth / SFC_ref_example.js
Last active July 21, 2018 06:16
ref 새 문법 설명: SFC
import React, { createRef } from 'react'
import { View, TextInput } from 'react-native'
const textInputRef = createRef() // ref 오브젝트. 사용되고 있는 SmapleSFC 스코프의 바깥쪽에 있어서 SampleSFC가 리렌더링 되어도 영향을 받지 않고 안의 current만 해당 노드(주로 RN Component)의 레퍼런스 정보로 업데이트 됩니다. 참조: (https://reactjs.org/docs/refs-and-the-dom.html#creating-refs)
const onChangeText = text => { // 파일 스코프의 onChangeText 함수, 인자는 text 를 가지며 이것은 TextInput에 타자를 칠때 생성되는 값을 의미합니다: 참조: (https://facebook.github.io/react-native/docs/textinput#onchangetext)
const { current } = textInputRef
if (current) {
current.setNativeProps({ text })
}
@marsinearth
marsinearth / RNTextInputEventTargetHandling.js
Last active July 14, 2018 10:43
RN Textinput onChange event target controlling like React on Web!
/**
* @see https://stackoverflow.com/questions/38651770/how-can-i-get-real-elment-by-node-id-react-native
*/
import React, { PureComponent } from 'react';
import { View, TextInput } from 'react-native';
import ReactNativeComponentTree from 'react-native/Libraries/Renderer/shims/ReactNativeComponentTree';
export default class TextHandler extends PureComponent {
state = {
username: '',
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->