Git Product home page Git Product logo

my-dev-fixes's Introduction

my-dev-fixes

My curated list of dev hacks, notes and fixes.

Task 'installRelease' not found in root project 'heyjs'. Some candidates are: 'uninstallRelease'.

You'll need to setup a keystore + configure signing for installRelease. Follow the instructions here:
https://facebook.github.io/react-native/docs/signed-apk-android.html

from https://github.com/xinthink/rnmk-demo/issues/7#issuecomment-218613454
# gradlew clean & debug run
cls && cd android && gradlew clean && cd .. && react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res &&  react-native run-android --variant=release

# reset fbsdk modifications by yarn
cd node_modules && git checkout HEAD -- react-native-fbsdk && cd ..

Git

reset to past commit

git reset --hard 2kd2dka

cleanup ignored files

git rm -r --cached .
git add .
git commit -m "Clean up ignored files"

Cannot resolve module from github link

  1. You have to build the library manually since it's not from NPM.
  2. npm run compile / npm run build or whatever - it varies

Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or you're running a packager server.

# create assets folder
mkdir android/app/src/main/assets

# build that shit
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

# run
react-native run-android

Error retrieving parent for item: No resource found that matches the given name blah blah Material.Widget.Button.Borderless.Colored

Your newly installed & linked library has sdk version conflicts with your project.

FIX IT.

Error: EPERM: operation not permitted, unlink

Android device not found

adb reverse tcp:8081 tcp:8081 && adb reverse tcp:8097 tcp:8097 && adb reverse --list

Speeding up gradle builds

Building android apps

# clean shit:
cd android
gradlew clean

# build that shit
cd ..
react-native run-android

Reactotron not connecting

# ensure config is correct
Reactotron
  .configure({
    host: 'localhost', // can be any IP address
	port: '9090' // default
    })
  // ...
  .connect()
  
# list forwarded ports:
adb reverse --list

# forward default port for Reactotron:
adb reverse tcp:9090 tcp:9090

failed to execute 'importscripts' on 'workerglobalscope'

React Native Yoganode Error

Both are code syntax errors.

Time-sync error

  1. Ensure your PC & Phone have same timezone settings
  2. On Windows -> Date & Time -> Internet Time tab -> Change Settings -> Check Synchronize -> Click Update Now
  3. On Device -> Settings -> Date & Time -> Toggle-on Auto updating -> Toggle it off
  4. Restart / re-run your app.

Windows NDIS based Internet Sharing Device Error on Tethered Devices

  • Error codes 31 & 10
  1. Restart PC
  2. Restart Tethered Device

Axios simple graphql client

const axios = require('axios');
axios.defaults.baseURL = 'http://localhost/';
axios.defaults.url = '/graphql';
axios.defaults.method = 'POST';
axios.defaults.headers.post['Content-Type'] = 'application/json';

axios
  .request({
    data: {
      query: `{
        hello
      }`
    }
  })
  .then((response)=>{
    console.log(response.data);
  })
  .catch((error)=>{
    console.log(error.response.data);
  });

Binding EventEvemitter3 to an object

npm install eventemitter3 --save

const EventEmitter = require('eventemitter3');

Class SampleClass{
  constructor () {
    const emitter = new EventEmitter();
    this.emit = emitter.emit.bind(emitter);
    this.on = emitter.on.bind(emitter);
  }
  Test () {
    this.emit('ready');
  }
}

const Instance = new SampleClass();
Instance.on('ready', ()=>{
  console.log('ready!');
});
Instance.Test();

Why GraphQL

How to GraphQL

Google Cloud

BitBucket

NodeJS


Free SSL & React Native Apps

Problem:

  • Your react-native app can't reach your http server, since https is required
  • Your https server can't be reached, because sites / endpoints using self-signed certificates are disallowed
  • Long story short, XHR / axios / Webview can't reach your server

Solution:

  1. Generate a CSR
  1. Go get a Free SSL catered by Comodo.
  • https://ssl.comodo.com/free-ssl-certificate.php
  • The certificate bundle you'll get won't be a self-signed one, a commodo support representative confirmed this with me.
  • Use your CSR, then validate your ownership
  • After couple of minutes you'll receive your cert bundle in your email, with 4 files
    • api_realtycoast_io.crt (named after the domain I used, which is api.realtycoast.io)
    • AddTrustExternalCARoot.crt
    • COMODORSAAddTrustCA.crt
    • COMODORSADomainValidationSecureServerCA.crt
  1. Do a CA/End-Entity Certificate matching
  • Go to https://decoder.link/ca_matcher
  • Paste the content of your api_realtycoast_io.crt equivalent as the END ENTITY CERTIFICATE
  • Paste the content of your COMODORSADomainValidationSecureServerCA.crt as the CA CERTIFICATE
  • Validate that shit, should be successful - if so, we proceed
  1. Configure your Express SSL configuration
  • Create a /ssl folder
  • Put all those certificate files there
  • Create a private.key file, PASTE YOUR PRIVATE KEY from STEP 1 there
  • Now we use your site's certificate, your private key, and your CA certificate
const fs = require('fs');
const http = require('http');
const https = require('https');
const express = require('express');
const bodyParser = require('body-parser');

const SSL = {
  credentials: {
    key: fs.readFileSync('ssl/private.key', 'utf8'),
    cert: fs.readFileSync('ssl/api_realtycoast_io.crt', 'utf8'),
    ca: [
      fs.readFileSync('ssl/COMODORSADomainValidationSecureServerCA.crt', 'utf8')
    ]
  }
};

const app = express();
app.use(bodyParser.json());
app.get('/', (req, res) => res.send('Hello World!'));
http.createServer(app).listen(80);
https.createServer(SSL.credentials, app).listen(443);
  • Git add, commit and push that shit
  • Run your nodejs server again
  1. Verify that shit
  • Visit your https://yoursite.com/ that should be working well
  • Visit https://www.sslshopper.com/ssl-checker.html
  • Check your server endpoint's url there, you should be seeing ALL CHECKS, AND NO X's
  1. Rebuild your react-native app, and re-run it - should be workign well now
  • Test code for webview
import { WebView, View } from 'react-native';

// in your component render(), below

return (
<View style={{flex:1}}>
	<WebView
	source={{uri: 'https://api.realtycoast.io/auth'}}
	javaScriptEnabled={true}
	domStorageEnabled={true}
	startInLoadingState={true}
	style={{ flex:1, height: 500, width: 350 }}
	/>
	</View>
);
  • Test code for axios
	// replace your baseURL and url, below
	
          <Button onPress={
            ()=>{
              const x = axios.create({
                baseURL: 'https://api.realtycoast.io/',
                timeout: 10000,
                headers: {
                  'Accept': 'application/json',
                  'Content-Type': 'application/json',
                }
              });
            x.request({
              url: '/user/123'
            })
              .then(function (response) {
                console.log(response);
              })
              .catch(function (error) {
                console.log(error);
              });
            }
          }>
            <Text>Axios Test</Text>
          </Button>

Git fast commit & push

git add -A && git commit -m "update" && git push -u origin master

my-dev-fixes's People

Contributors

xemasiv avatar

Watchers

James Cloos avatar Rajan Maharjan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.