Skip to content

Instantly share code, notes, and snippets.

View donchan922's full-sized avatar
🐶
I'm fine.

donchan922 donchan922

🐶
I'm fine.
View GitHub Profile
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 19, 2024 13:50
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@joshdholtz
joshdholtz / ATinySampleApp.swift
Last active March 29, 2024 23:27
Super basic SwiftUI app (70 lines of code) with paywall using RevenueCat
import SwiftUI
import RevenueCat
struct Constants {
static let apiKey = "<your_api_key>" // Will look like: appl_bunchofotherstuffhere
static let entitlementName = "<your_entitlement_name>" // I use something like "pro"
}
@main
struct ATinySampleApp: App {
@donchan922
donchan922 / ContentView.swift
Created April 4, 2020 01:26
SwiftUIでAPI呼び出しでJSONをパース&画像URLから画像を表示するサンプルコード
import SwiftUI
struct Dog: Codable, Identifiable {
public var id: String
public var status: String
enum CodingKeys: String, CodingKey {
case id = "message"
case status = "status"
}
@donchan922
donchan922 / ContentView.swift
Created April 4, 2020 11:50
SwiftUIでAPI呼び出しでJSONをパース&画像URLから画像を表示(ライブラリ使用)するサンプルコード
import SwiftUI
import SDWebImage
import SDWebImageSwiftUI
struct Dog: Codable, Identifiable {
public var id: String
public var status: String
enum CodingKeys: String, CodingKey {
case id = "message"
@donchan922
donchan922 / ContentView.swift
Created April 3, 2020 13:57
SwiftUIで画像URLから画像を表示するサンプルコード
import SwiftUI
class ImageDownloader : ObservableObject {
@Published var downloadData: Data? = nil
func downloadImage(url: String) {
guard let imageURL = URL(string: url) else { return }
DispatchQueue.global().async {
@donchan922
donchan922 / ContentView.swift
Last active April 3, 2020 12:49
SwiftUIでAPI呼び出しでJSONをパースするサンプルコード
import SwiftUI
import Combine
struct Movie: Codable, Identifiable {
public var id: Int
public var name: String
public var released: String
enum CodingKeys: String, CodingKey {
case id = "id"
@yazumoto
yazumoto / unicode_decode.rb
Created September 3, 2015 08:45
Unicodeの文字(\u1234的なもの)を変換するRubyコード
str = '\u534a\u89d2\u82f1\u6570\u5b57'
str.gsub(/\\u([\da-fA-F]{4})/) { [$1].pack('H*').unpack('n*').pack('U*') } # => 半角英数字
@MoChiwaki
MoChiwaki / MaruBatsu.java
Last active August 20, 2018 05:01
コンソール上で◯✕ゲーム
package jp.co.KaorinProject;
import java.util.Scanner;
public class MaruBatsu {
public static void main(String[] args) {
System.out.println("◯✕ Game Start!");
String trun = "◯";
String[] field = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };