Skip to content

Instantly share code, notes, and snippets.

View ktpm489's full-sized avatar
🎯
Focusing

ktpm489

🎯
Focusing
View GitHub Profile
@ktpm489
ktpm489 / reactnative.md
Created May 29, 2018 15:29 — forked from AshRhazaly/reactnative.md
React Native Notes

Initializing React Native

Enter these commands in the terminal

  1. npm install react-native
  2. npm install react-native-cli
  3. brew install watchman
  4. Optional https://atom.io/packages/react-native-snippets

To initialize your react native project

  • react-native init AppName
@ktpm489
ktpm489 / npm-scripts.js
Created May 29, 2018 15:31 — forked from lukeandersen/npm-scripts.js
Useful React Native NPM Scripts
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"rc-start": "npm start -- --reset-cache",
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean",
"clean-start": "npm run clean && npm run rc-start",
"fresh-install": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build/ModuleCache/* && rm -rf node_modules/ && npm cache clean && npm install",
"fresh-start" : "npm run fresh-install && npm run rc-start",
"tron": "node_modules/.bin/reactotron"
}
@ktpm489
ktpm489 / rn-cli.config.js
Created May 29, 2018 15:31 — forked from PeterKow/rn-cli.config.js
react-native-typescript-transformer configuration
module.exports = {
getTransformModulePath() {
return require.resolve('react-native-typescript-transformer');
},
getSourceExts() {
return ['ts', 'tsx'];
}
}
@ktpm489
ktpm489 / npm_link_rn.md
Created May 29, 2018 15:32 — forked from GingerBear/npm_link_rn.md
npm link in react native
@ktpm489
ktpm489 / fonts.markdown
Created May 29, 2018 15:33 — forked from foxnewsnetwork/fonts.markdown
Getting Started with react-native

Fonts and other vector assets

As an ember developer accustomed to the "batteries-included" mentality of sensible defaults and convention over configuration, getting into the groove of react-native can be a little tricky - especially for seemingly should-be-simple things such as including fonts in our app.

rnpm link

In ember-cli land, installing font-awesome (or any font) was done with a simple cli command: ember install ember-cli-font-awesome. In react native, similar packages exist, but the installation instructions require a little more research on my part. Here's how it's done:

mkdir -p assets/fonts
@ktpm489
ktpm489 / .eslintrc
Created May 29, 2018 15:34 — forked from kyo504/.eslintrc
Prettier + ESLint for React Native
{
"extends": [
"plugin:flowtype/recommended",
"plugin:react/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"prettier",
"prettier/flowtype",
"prettier/react"
],
@ktpm489
ktpm489 / package.json
Created May 29, 2018 15:39 — forked from itinance/package.json
React Native: package.json: usefully tools for React Native that can be used with "npm run $name"
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start --reset-cache",
"reset": "rm -rf node_modules/ && npm cache clear && watchman watch-del-all && npm i",
"testflight": "fastlane beta",
"android-device": "adb reverse tcp:8081 tcp:8081 && react-native run-android",
"lint": "jslint **.js",
"test": "jest",
"generate-apk": "cd android && ./gradlew assembleRelease && open ./app/build/outputs/apk/",
"install-apk": "cd android && ./gradlew installRelease"
},
@ktpm489
ktpm489 / encryption.js
Created May 29, 2018 16:05 — forked from lancejpollard/encryption.js
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bytes (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', new Buffer(ENCRYPTION_KEY), iv);