Skip to content

Instantly share code, notes, and snippets.

View Yougigun's full-sized avatar
🤔
Thinking of ...

Gary Yougigun

🤔
Thinking of ...
  • Remote/Taiwan
View GitHub Profile
@Yougigun
Yougigun / create_dictionary.py
Last active July 11, 2020 00:56
create dictionary
# Create Dictionary
## 1. dict(key=value,...)
family_age_a = dict(Dad=55, Mom=54, Bro=23)
## 2. {key:value,...}
family_age_b = {'Dad': 55, 'Mom': 54, 'Bro': 23}
## 3. dict([(key,value),...])
family_age_c= dict([('Dad', 55), ('Mom', 54), ('Bro', 23)])
## 4. dict({key:value,...})
family_age_d = dict({'Dad': 55, 'Mom': 54, 'Bro': 23})
# creat branch
git branch <branch name>
# delete a branch (not merge yet)
git branch -d <brannch name>
# delete a branch( no matter)
git branch -D <branch name>
# swithc to the branch
git checkout <branch nane>
# create the branch and swithc to the one
git checkout -b <branch name>
let completed = true;
let learnJS = new Promise(function (resolve, reject) {
if (completed) {
resolve("I have completed learning JS.");
} else {
reject("I haven't completed learning JS yet.");
}
});
@Yougigun
Yougigun / withErrorHandler.js
Created July 29, 2020 13:40
Handle Request and Response Error
import React, {useEffect,useState}from 'react';
import Modal from '../../components/UI/Modal/Modal'
import Aux from '../Auxiliary/Auxiliary'
const withErrorHandler = (WrappedComponent,axios) => {
return (props)=>{
const [state, setstate] = useState({error:null})
@Yougigun
Yougigun / vscode_setting_for_activate_python_env.json
Created August 14, 2020 12:58
Auto Activate env specific python in terminal of vscode
{
"python.pythonPath": "C:\\Anaconda3\\envs\\kedro-practice\\python.exe",
"python.terminal.activateEnvironment": true,
"python.condaPath":"C:\\Anaconda3\\Scripts\\conda.exe"
}
@Yougigun
Yougigun / vscode_setting_for_activate_python_env.json
Created August 14, 2020 12:58
Auto Activate env specific python in terminal of vscode
{
"python.pythonPath": "C:\\Anaconda3\\envs\\kedro-practice\\python.exe",
"python.terminal.activateEnvironment": true,
"python.condaPath":"C:\\Anaconda3\\Scripts\\conda.exe"
}
package main
import (
"context"
"fmt"
"runtime"
"time"
)
func main() {
import React from 'react'
const ChineseChessTable = ({Size,CarPos}) => {
let tableTD =[]
let table = []
let tdOfCar = []
for (let y = 0;y<=Size.y;y++){
tableTD.push(<td></td>)
}
for (let y = 0;y<=Size.y;y++){
import React,{useState} from 'react'
import classes from './Promotion.module.css'
import ChineseChessTable from './ChineseChessTable/ChineseChessTable'
const ChineseChess = () => {
const [carPosition, setCarPosition] = useState({x:0,y:0})
const [carInputX, setCarInputX] = useState(0)
const [carInputY, setCarInputY] = useState(0)
visited = set()
def depth_first_search(graph,node):
if (node in visited): return
visited.add(node)
print(node)
for adjacent_node in graph[node]:
depth_first_search(graph,adjacent_node)
graph = dict()
graph["1"] = ["2","3"]