Skip to content

Instantly share code, notes, and snippets.

@brunokiafuka
brunokiafuka / Welcome.js
Last active February 28, 2019 11:36
Welcome Component
import React, { Component } from 'react'
import { Text, View } from 'react-native'
import styles from './style'
const Welcome = (props) => {
return (
<View>
<Text>Hi, {props.name}</Text>
</View>
)
@brunokiafuka
brunokiafuka / snippets-javascript.json
Created February 8, 2019 10:31
Javascript snippets
{
"Document Ready": {
"prefix": "docr",
"description": "Create document is ready",
"body": [
"$(document).ready(function () {",
"\t$1",
"})"
]
},
@brunokiafuka
brunokiafuka / heroku-react
Created March 29, 2019 15:06
deploy create-react-app buildpack
heroku create <AppName> --buildpack https://github.com/mars/create-react-app-buildpack.git
@brunokiafuka
brunokiafuka / Basic_Sum.c
Last active May 24, 2019 17:46
C Basic programs
//Basic sum
#include <stdio.h>
int
main ()
{
/* variable definition: */
int num1, num2;
export const facebookLogin = async () => {
try {
const { type, token } = await Facebook.logInWithReadPermissionsAsync('<YOUR APP ID>', {
permissions: ['public_profile', 'email', 'user_birthday'],
behavior: 'native',
});
if (type === 'success') {
// Get the user's name using Facebook's Graph API
const credential = firebase.auth.FacebookAuthProvider.credential(token)
@brunokiafuka
brunokiafuka / reduce.js
Created May 29, 2020 20:38
reduce json obj arr
const array1 = [{num: 1}, {num: 1}, {num: 1}, {num: 1}];
console.log(array1.reduce((count, item) => {
return count += item.num;
},0))
@brunokiafuka
brunokiafuka / isPasswordStrong.js
Created May 24, 2021 17:53
Check Password Strength.
const strongPassword = new RegExp(
'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})'
);
const mediumPassword = new RegExp(
'^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})'
);
export const isPasswordStrong = (value = ''): boolean => {
if (strongPassword.test(value)) {

Project root:

yarn add -D --save-exact eslint-config-airbnb eslint-config-airbnb-typescript eslint-config-prettier eslint-config-react-app eslint-import-resolver-typescript eslint-webpack-plugin eslint-plugin-flowtype eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks babel-eslint eslint-plugin-jest @typescript-eslint/parser @typescript-eslint/eslint-plugin prettier prettier-eslint prettier-eslint-cli eslint-plugin-prettier

$ vim .eslintrc

{
  "plugins": ["prettier", "@typescript-eslint"],
@brunokiafuka
brunokiafuka / nvm-and-node-with-apple-m1-chip.md
Created September 10, 2021 14:52 — forked from mcalthrop/nvm-and-node-with-apple-m1-chip.md
Using Node with Apple's new M1 chip

Using NVM and node with Apple's new M1 chip

20 January 2021

Rationale

At the time of writing, there are no pre-compiled NodeJS binaries for versions prior to 15.x for Apple's new M1 chip (arm64 architecture).

Additional issues encountered:

How to disable page caching with create-react-app

If you currently not using a service worker resulting in old production caches being used and users not getting new versions of the app.

src/index.js

Use:

import { unregister as unregisterServiceWorker } from './registerServiceWorker'