Skip to content

Instantly share code, notes, and snippets.

View chongiscool's full-sized avatar
🎯
Focusing

Chong Wang chongiscool

🎯
Focusing
  • Shenzhen
View GitHub Profile
@chongiscool
chongiscool / App.js
Last active August 16, 2018 14:55
Configuring the header bar: Setting the header title, setting and updating navigationOptions with setParams
import React, { Component } from 'react'
import {
StyleSheet,
View,
Text,
Platform,
TouchableOpacity, Button
} from 'react-native'
import { Ionicons, FontAwesome } from '@expo/vector-icons'
import {
@chongiscool
chongiscool / App.js
Created August 16, 2018 14:09
Passing parameters to routes, after create a stack navigator with some routes and navigate between those routes.
import React from 'react'
import {
StyleSheet,
View,
Text,
Platform,
TouchableOpacity, Button
} from 'react-native'
import { Ionicons, FontAwesome } from '@expo/vector-icons'
import {
@chongiscool
chongiscool / App.js
Created August 16, 2018 14:06
Create a stack navigator with some routes and navigate between those routes.
import React from 'react'
import {
StyleSheet,
View,
Text,
Platform,
TouchableOpacity, Button
} from 'react-native'
import { Ionicons, FontAwesome } from '@expo/vector-icons'
import {
@chongiscool
chongiscool / main.js
Created April 24, 2018 15:18
JS 'GET' & 'POST' request all process from codecademy.
// Include data for accessing Google APIs
const apiKey = 'api_key';
const projection = 'FULL';
const url = 'https://www.googleapis.com/urlshortener/v1/url';
// Some page elements
const $inputField = $('#input');
const $expandButton = $('#expand');
@chongiscool
chongiscool / main.js
Created April 24, 2018 14:44
JS 'POST' request template from codecademy.
const xhr = new XMLHttpRequest();
const url = 'https://api-to-call.com/endpoint';
// const url = 'https://www.googleapis.com/urlshortener/v1/url';
const apiKey = 'AIzaSyB_gg7APX8yD_jzBHmTGxxDkhva95Zw808';
const data = JSON.stringify({id: '200'});
xhr.responseType = 'json';
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE) {
@chongiscool
chongiscool / main.js
Created April 24, 2018 14:43
JS 'get' templete from codecademy
const xhr = new XMLHttpRequest();
const url = 'https://api-to-call.com/endpoint';
xhr.responseType = 'json';
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE) {
//console.log('xhr response', xhr.response);
console.log(xhr.response);
}
}
@chongiscool
chongiscool / main.js
Created April 24, 2018 03:46
JS 'get' request temp for expand url from google shorter url
// Include data for accessing Google APIs
const apiKey = 'js-request-api-key-from-google';
const projection = 'FULL';
const url = 'https://www.googleapis.com/urlshortener/v1/url';
// Some page elements
const $inputField = $('#input');
const $expandButton = $('#expand');
@chongiscool
chongiscool / MyRequestTemp.js
Created April 24, 2018 03:18
mark here for learning
const xhr = new XMLHttpRequest();
const url = 'https://api-to-call.com/endpoint';
xhr.responseType = 'json';
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE) {
//console.log('xhr response', xhr.response);
console.log(xhr.response);
}
}
@chongiscool
chongiscool / Contact.js
Created April 24, 2018 03:03
check out password and get contact info in ReactJS
import React from 'react';
import ReactDOM from 'react-dom';
class Contact extends React.Component {
constructor(props) {
super(props);
this.state = {
password: 'swordfish',
authorized: false
};