This file contains hidden or 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
| #include <iostream> | |
| #define ISSUE | |
| int main(){ | |
| #ifdef ISSUE | |
| std::ios_base::sync_with_stdio(true); | |
| #else | |
| std::ios_base::sync_with_stdio(false); | |
| #endif |
This file contains hidden or 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
| /*************************************************** | |
| Exercise 1.4 | |
| Rewrite the following program using optimal C coding style. | |
| Pay attention to: | |
| - white spaces and indentation | |
| - short-cut boolean expressions in if or loop statements | |
| - use the conditional operator | |
| - code redundancy | |
| - proper use of the relational expression in a return statement | |
| - use of the comma operator in a loop |
This file contains hidden or 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
| /*************************************************** | |
| Exercise 1.3 | |
| Rewrite the following program using optimal C coding style. | |
| Pay attention to: | |
| - white spaces and indentation | |
| - short-cut boolean expressions in if or loop statements | |
| - use the conditional operator | |
| - code redundancy | |
| - proper use of the relational expression in a return statement | |
| - use of the comma operator in a loop |
This file contains hidden or 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
| func (s *Serv) Init() error | |
| func (s *Serv) Init(config MyConfig) | |
| func (s *Serv) Init(config MyConfig) error | |
| func (s *Serv) Init() |
This file contains hidden or 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
| func TestSavePic(t testing.Testing) { | |
| pic := &PicService { | |
| S3Service: setupDevS3Service(), | |
| bucket: "test", | |
| } | |
| pic.SavePic([]byte{1,3,2,3}) | |
| asserts.Equal(t, true, pic.S3Service.Exists("test")) | |
| } |
This file contains hidden or 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
| type PicServiceConfig struct { | |
| BucketName string `yaml:"bucket_name"` | |
| } | |
| type PicService struct { | |
| S3Service *S3Service `dim:"on"` // ์ฌ๊ธฐ๋ก ์๋น์ค ์ธ์คํด์ค๊ฐ ์ฃผ์ ๋ฉ๋๋ค. | |
| bucket string | |
| } | |
| func (p *PicService) Init(conf dim.ServiceConfig) error { |
This file contains hidden or 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
| type DimService interface { | |
| Init(conf ServiceConfig) error // ์ด๊ธฐํ ํจ์์ ๋๋ค. dim.Initํจ์์์ ์ด๊ฑธ ์คํํฉ๋๋ค. | |
| DefaultConfig() ServiceConfig // ์ด๊ธฐ ์๋น์ค yaml ์ค์ ๊ตฌ์กฐ์ฒด๋ฅผ ๋ฐํํฉ๋๋ค. | |
| ConfigName() string // ์๋น์ค yaml ์ค์ ํ์ผ์ ์ด๋ฆ์ ๋๋ค. | |
| } |
This file contains hidden or 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
| type PicService struct { | |
| S3Service *S3Service `dim:"on"` // ์ฌ๊ธฐ๋ก ์๋น์ค ์ธ์คํด์ค๊ฐ ์ฃผ์ ๋ฉ๋๋ค. | |
| bucket string | |
| } | |
| // ์๋น์ค ๋ฉ์๋ | |
| func (p *PicService) SavePic(buf []byte) { | |
| p.S3Service.Store(p.bucket, buf) | |
| } |
This file contains hidden or 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
| fetch("http://localhost:5353/10", { | |
| method: "POST", | |
| headers: { | |
| "Content-Type": "application/json" | |
| }, | |
| body: JSON.stringify({"game": {"hello":"hi"}}) | |
| }); | |
| fetch("http://localhost:5353/10").then(x => x.json()).then(x => { |
This file contains hidden or 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
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Net; | |
| using System.Net.Sockets; | |
| using Game.Events; | |
| using Models; | |
| using Newtonsoft.Json; | |
| using UnityEngine; | |
| namespace Network |