This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension URL { | |
/* | |
Get the query parameters from the URL. | |
*/ | |
var queryParameters: [String: String]? { | |
var params = [String: String]() | |
return URLComponents(url: self, resolvingAgainstBaseURL: false)? | |
.queryItems? | |
.reduce([:], { (_, item) -> [String: String] in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
import urllib2 | |
import urlparse | |
import re | |
import string | |
import sys | |
import wget | |
import os | |
result = {"videoID": "", "name": ""} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
name=$1; | |
mkdir $name; | |
cd ./$name; | |
# Component file | |
touch $name.js | |
cat <<EOF >./$name.js | |
import React, { Component } from 'react'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Go to your React native Project -> Android | |
2. Create a file local.properties | |
3. Open the file | |
paste your Android SDK path like below | |
in Windows sdk.dir = C:/Users/USERNAME/AppData/Local/Android/sdk | |
in macOS sdk.dir = /Users/USERNAME/Library/Android/sdk | |
in linux sdk.dir = /home/USERNAME/Android/Sdk | |
Replace USERNAME with your user name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Place the file in ~/MyScript/local.properties | |
# 2. Update .rc file to include alias local-properties="~/MyScript/local.properties/local-properties" | |
# 3. Make this file executable: chmod +x local-properties | |
touch ./android/local.properties | |
cat <<EOF >./android/local.properties | |
sdk.dir=/Users/snjmhj/Library/Android/sdk | |
EOF | |
#Usage: Goto react native project folder and run `local-properties` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns random string of arbitrary length | |
* | |
* @param {number} length | |
* | |
* @returns {string} | |
*/ | |
export function getRandomStringOfLength(length = 44) { | |
return [...Array(length)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Calculate displacement of 2 GPS coordinate. | |
* From: https://en.wikipedia.org/wiki/Great-circle_distance | |
* @param {Object} point1 | |
* @param {Object} point2 | |
* @returns Number | |
*/ | |
function getDisplacementByGPS(point1, point2) { | |
const radiusOfEarth = 6378137; // Earth’s mean radius in meter | |
const dLat = rad(point2.latitude - point1.latitude); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Modify displayName in `/app.json` file | |
Modify app_name in `android/app/src/main/res/values/strings.xml` | |
then Run these commands one by one | |
``` | |
cd android | |
gradlew clean | |
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
react-native init <newproject> --version react-native@<rnVersion> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------Usage------------ | |
----------------------------- | |
<LoadingSpinner size={50} borderWidth={4} borderColor={"#000"} /> | |
----------Component---------- | |
----------------------------- | |
import './style.css'; | |
interface LoadingSpinnerProps { |
OlderNewer