Skip to content

Instantly share code, notes, and snippets.

View hongsw's full-sized avatar
πŸ•ΉοΈ
Focusing

Seungwoo hong hongsw

πŸ•ΉοΈ
Focusing
View GitHub Profile
@hongsw
hongsw / main.dart
Created October 17, 2023 10:55
gpt4v test
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
primarySwatch: Colors.blue,
@hongsw
hongsw / main.dart
Last active October 10, 2023 13:21
μ‚¬μš©μžμ˜ 이름을 μž…λ ₯λ°›μ•„ 화면에 좜λ ₯ν•˜λŠ” μ•±
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@hongsw
hongsw / main.dart
Last active October 10, 2023 12:43
μƒˆλ‘œμš΄ νŽ˜μ΄μ§€λ₯Ό λ§Œλ“€κΈ°, Widget Class
import 'package:flutter/material.dart';
// μ°Έκ³  : https://docs.flutter.dev/cookbook/navigation/navigation-basics
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@hongsw
hongsw / main.dart
Last active October 10, 2023 12:35
반볡된 μš”μ†Œλ₯Ό μƒˆλ‘œμš΄ μœ„μ ―μœΌλ‘œ λ§Œλ“€κΈ°
import 'package:flutter/material.dart';
// μ°Έμ‘° : https://api.flutter.dev/flutter/material/ListTile-class.html#material.ListTile.3
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@hongsw
hongsw / main.dart
Created September 12, 2023 16:16
FizzBuzz in Dart without IF
void main() {
for (int i = 1; i <= 100; i++) {
String output = "";
var fizz = ["", "Fizz"];
var buzz = ["", "Buzz"];
output += fizz[i % 3 == 0 ? 1 : 0];
output += buzz[i % 5 == 0 ? 1 : 0];
@hongsw
hongsw / main.dart
Last active September 12, 2023 15:57
Dart 'PPAP' SongΒ 
void main() {
// 단계 1: 🍎 + πŸ–Š = πŸŽπŸ–Š
String pen = 'πŸ–Š';
print('Pen: $pen'); // πŸ–Š
String apple = '🍎';
print('Apple: $apple'); // 🍎
String ap = apple + pen;
print('AP: $ap'); // πŸŽπŸ–Š
// 단계 2: 🍍 + πŸ–Š = πŸπŸ–Š
@hongsw
hongsw / main.dart
Last active September 12, 2023 15:54
dart string functions
void main() {
var hello = 'Hello, 🌍!';
print(hello.toUpperCase()); // Output: "HELLO, 🌍!"
hello = 'Hello, 🌍!';
print(hello.toLowerCase()); // Output: "hello, 🌍!"
hello = ' Hello, 🌍! ';
print(hello.trim()); // Output: "Hello, 🌍!"
@hongsw
hongsw / get_flutter_sample_game_template.sh
Created September 4, 2023 21:24
to get game_template only in sample repo, https://flutter.dev/games
git clone --filter=blob:none --no-checkout --depth 1 --sparse https://github.com/flutter/samples.git
cd samples
ls
git sparse-checkout add game_template
git checkout
ls
@hongsw
hongsw / main.dart
Last active May 24, 2023 04:34
guardianapis 이용 μ˜ˆμ‹œΒ 
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<void> fetchPosts() async {
final response =
await http.get(Uri.parse('https://content.guardianapis.com/search?show-fields=thumbnail&q=food%20korean&api-key=test'));
if (response.statusCode == 200) {
// API μ„œλ²„μ—μ„œ 데이터λ₯Ό μ •μƒμ μœΌλ‘œ 가져왔을 λ•Œ