Skip to content

Instantly share code, notes, and snippets.

View TuenTuenna's full-sized avatar
😍
Happy coding 👏

개발하는 정대리 TuenTuenna

😍
Happy coding 👏
View GitHub Profile
@free2bcreative
free2bcreative / RightModalDrawer.kt
Created January 11, 2023 17:59
Jetpack Compose RightModalDrawer (right-to-left)
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Button
import androidx.compose.material.DrawerDefaults
import androidx.compose.material.DrawerState
import androidx.compose.material.DrawerValue
import androidx.compose.material.MaterialTheme
import androidx.compose.material.ModalDrawer
@Jeandcc
Jeandcc / getInstagramUsersThatDontFollowBack.js
Last active April 6, 2024 07:07
Open Instagram on your browser; Login to instagram; Open your browser's console (CTRL + SHIFT + J); Paste the code below; Update the username in the first line; RUN IT (Hit enter)
const username = "USER_NAME_HERE";
/**
* Initialized like this so typescript can infer the type
*/
let followers = [{ username: "", full_name: "" }];
let followings = [{ username: "", full_name: "" }];
let dontFollowMeBack = [{ username: "", full_name: "" }];
let iDontFollowBack = [{ username: "", full_name: "" }];
// https://sarunw.com/posts/swiftui-circular-progress-bar/
//
// CircularProgressView.swift
// SwiftUI30WWDC2021
//
// Created by Mateo on 5/6/22.
//
@wilg
wilg / parallel_map.swift
Last active February 9, 2024 20:21 — forked from DougGregor/parallel_map.swift
Swift async/await implementation of a parallel map
import Foundation
// https://gist.github.com/DougGregor/92a2e4f6e11f6d733fb5065e9d1c880f
extension Collection {
func parallelMap<T>(
parallelism requestedParallelism: Int? = nil,
_ transform: @escaping (Element) async throws -> T
) async rethrows -> [T] {
let defaultParallelism = 2
let parallelism = requestedParallelism ?? defaultParallelism
@ollieatkinson
ollieatkinson / Publishers+RetryDelay.swift
Last active November 5, 2022 18:39
Add a delay in-between each Combine retry, offering a timing function and default implementations for none, constant seconds and exponential backoff
import Combine
import Foundation
extension Publisher {
public func retry<S: Scheduler>(
_ max: Int = Int.max,
delay: Publishers.RetryDelay<Self, S>.TimingFunction,
scheduler: S
) -> Publishers.RetryDelay<Self, S> {
@LeeKahSeng
LeeKahSeng / KeychainHelper.swift
Last active April 25, 2024 13:40
Swift simple keychain helper class for iOS and macOs
// MIT License
//
// Copyright (c) 2023 Lee Kah Seng
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@rommansabbir
rommansabbir / UsagesOfSealedClass.kt
Created December 9, 2020 18:37
How to use Kotlin's Sealed Class in Android Development for better & clean code
sealed class AppFailure {
/**
* Global Failure classes
* These failures will be used across all over the app including Data Layer, Domain Layer, Framework Layer
*/
class GeneralFailure(var message: String, var errorCode: Int? = null) : AppFailure()
class UnauthorizedFailure(var message: String = "Unauthorized", errorCode: Int? = null) : AppFailure()
class LoginFailure(var message: String = "Unable to login", errorCode: Int? = null) : AppFailure()
class ServerFailure(var message: String = "Unable to connect to the server side", errorCode: Int? = null) : AppFailure()
class NoInternetFailure(var message: String = "Device is not connected to the internet", errorCode: Int? = null) : AppFailure()
/*
Here's our goal:
let localDataStore = UserDataStore()
let remoteDataStore = UserApi()
let dataStore = CacheBackedDataStore(localDataStore, remoteDataStore)
dataStore.fetch(userID) { result in
// handle result
}
@sudkumar
sudkumar / channels.tsx
Last active April 12, 2024 07:50
Web-Sockets in ReactJS with PusherJs and Laravel Echo with public and private channels
import React, { useEffect, useState, useMemo } from "react"
import Echo from "laravel-echo"
import Pusher from "pusher-js"
/**
* Pusher configuration
*/
const pusherConfig = {
key: '<your_pusher_key_here>',
cluster: '<pusher_cluster>',
@mjm
mjm / LinkedText.swift
Created May 21, 2020 03:56
Tappable links in SwiftUI Text view
import SwiftUI
private let linkDetector = try! NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue)
struct LinkColoredText: View {
enum Component {
case text(String)
case link(String, URL)
}