본문 바로가기

전체 글343

[Git] Restore Command This command restores working tree files. This command is experimental. (v2.29.0) Description Restore specified paths in the working tree with some contents from a restore source. If a path is tracked but does not exist in the restore source, it will be removed to match the source. Usage Restore Specified Paths $ git restore Specify the Restore location If neither option is specified, by default.. 2020. 10. 23.
[Git] Switch Command This command helps to switch branches. This command is experimental. (v2.29.0) Description Switch to a specified branch. The working tree and the index are updated to match the branch. Usage Switch to Specified Branch $ git switch Create a New Branch and Switch to the Branch $ git switch -c $ git switch --create $ git switch -c Forced Switch to Specified Branch Proceed even if the index or the w.. 2020. 10. 23.
[Python] Templates Static Files in Flask Templates Overview Templates are files that contain static data as well as placeholders for dynamic data. A template is rendered with specific data to produce a final document. Flask uses the Jinja template library to render templates. In the application, we will use templates to render span style="color: #0593d3;">HTML which will display in the user's browser. In Flask, Jinja is configured to a.. 2020. 10. 23.
[Go] Variable Variable is storage having a value. Variable Declaration You can give a name to a variable through variable declaration. var If you assign a value to a variable, use = symbol. You can also assign multiple values to multiple variables. var count int = 3 var name string = "HoYa" var width, height float64 = 2.6, 3.2 var count int = 5 // Error: variable can't redeclare. count = 7 name = 5 // Error: .. 2020. 10. 21.
[Go] Data Types As I already mentioned in the previous posting, Go is a statically typed language. So, the type of value is important. You can get the type of value. fmt.Println(reflect.TypeOf('a')) // int32 fmt.Println(reflect.TypeOf("Hello")) // string fmt.Println(reflect.TypeOf(true)) // bool fmt.Println(reflect.TypeOf(3)) // int fmt.Println(reflect.TypeOf(3.14)) // float64 Rune Rune represents a single char.. 2020. 10. 21.
[TypeScript] Interface TypeScript's type checking focuses on the shape that values have. This is called 'duck typing' or 'structural subtyping'. In TypeScript, interfaces fill the role of naming these types and are a powerful way of defining contracts within code as well as contracts with code outside of the project. interface IToDoItem { text: string; isCompleted: boolean } function addItem(item: IToDoItem) { console.. 2020. 10. 17.
[TypeScript] Destructuring and Spread Array Destructuring let input = [1, 2]; let [first, second] = input; console.log(`${first}, ${second}`); // 1, 2 Multiple values of an array can be easily assigned as variables. function f([first, second]: [number, number]) { console.log(`${first}, ${second}`); } f([1, 2]) // 1, 2 It can be also applied in the parameters of a function. let [first, ...rest] = [1, 2, 3, 4]; console.log(first); // .. 2020. 10. 16.
[TypeScript] Variable Declaration (var, let, const) var Declarations Declaring a variable in JavaScript has always traditionally been done with the var keyword. (ES5) var num = 7; Scoping Rules It is not an error to declare the same variable multiple times with var. var num = 7; var num = 3; let Declarations let differs from var in point of semantics. let say = "Hello"; Block Scoping Unlike variables declared with var whose scopes leak out to the.. 2020. 10. 15.
[Python] pathlib module (Object-Oriented Filesystem Paths) Python version 3.4 and above basically includes this module. This module offers classes representing filesystem paths with semantics appropriate for different operating systems. This module treats the file system path as an object, not just a string. Path classes are divided between pure paths, which provide purely computational operations without I/O, and concrete paths, which inherit from pure.. 2020. 10. 13.