Skip to content

Instantly share code, notes, and snippets.

View brownsoo's full-sized avatar
🐢
Step by step

brownsoo brownsoo

🐢
Step by step
View GitHub Profile
@dani-mp
dani-mp / AsyncReSwift.swift
Last active November 14, 2017 08:52
Swift Playground showcasing the use of ReSwift middleware to perform asynchronous operations, in contrast of other possible approaches.
import UIKit
import PlaygroundSupport
import ReSwift
// API
protocol API {
func loadUsers(completion: @escaping (([User]) -> Void))
}
@nferruzzi
nferruzzi / ReSwift+select.swift
Last active February 28, 2018 05:56
My own ReSwift multi observer extension with support for equatable types and optionals of equatable types
// Promise like subscriber, works with Equatable types and Optionals of Equatable types
// ie:
// let observer = document.mainStore
// .select { (state) -> UIState in state.ui }
// .then { _ in called += 1 }
// or
// let observer = document.mainStore
// .select { (state) -> String? in state.ui.selection }
// .then { _ in called += 1 }
//
public class FunalyticsTracker {
private final Analytics analytics;
private DisposableObserver<FunalyticsEvent> eventsDisposable;
public FunalyticsTracker(Context context) {
analytics = Analytics.getInstance(context);
if (isInterestedInEvents()) {
subscribeToEvents();
public class SingletonClass implements Serializable {
private static volatile SingletonClass sSoleInstance;
//private constructor.
private SingletonClass(){
//Prevent form the reflection api.
if (sSoleInstance != null){
throw new RuntimeException("Use getInstance() method to get the single instance of this class.");
@perlguy99
perlguy99 / KeyboardAwareModifier.swift
Last active October 23, 2020 04:22
SwiftUI Keyboard Aware Modifier
//
// KeyboardAwareModifier.swift
// KeyboardTest
//
import SwiftUI
import Combine
struct KeyboardAwareModifier: ViewModifier {
@State private var keyboardHeight: CGFloat = 0
@romanroibu
romanroibu / RSSFeed.swift
Last active April 9, 2021 15:28 — forked from kharrison/RSSFeed.swift
Swift Decodable With Multiple Custom Dates (https://useyourloaf.com/blog/swift-codable-with-custom-dates)
import Foundation
extension DateFormatter {
static let iso8601Full: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"
formatter.calendar = Calendar(identifier: .iso8601)
formatter.timeZone = TimeZone(secondsFromGMT: 0)
formatter.locale = Locale(identifier: "en_US_POSIX")
return formatter
@benelog
benelog / AsyncTask-executor-problem.md
Last active August 27, 2021 16:15
AsyncTask 분석

변경이력

  • 2013/10/15: Dianne Hackborn의 언급에 대한 번역은 안세원님이 교정해주신 내용으로 교체합나디.

AsyncTask는 API Level 13이상 버전이 설치된 기기에서 android:targetSdkVersion가 13이상 일 때 여러 개의 AsyncTask가 동시에 실행되어도 순차적으로 호출됩니다.

기기의 버전뿐만 아니라 targetSDK 설정에도 영향을 받으므로 target SDK 설정을 변경할 때 유의해야 합니다. 그리고 가능하다면 목적별로 스레드풀을 분리하고, 스레드의 갯수가 늘어나는 것에 대비해 무작정 큰 최대값을 주는것보다는 Timeout과 RejectionPolicy로 관리를 하는 편이 바람직합니다.

@trilliwon
trilliwon / makeI18N.sh
Last active January 11, 2022 08:03
makeI18N
#!/bin/sh
echo "generating I18N.swift"
touch tempI18N.swift
echo "struct I18N {" >> tempI18N.swift
inputfile=${SRCROOT}/Pomodoro/Resources/en.lproj/Localizable.strings
while IFS= read -r line
@NikolaDespotoski
NikolaDespotoski / BottomNavigationBehavior.java
Last active December 19, 2022 06:14
Bottom Navigation behavior
/*
* BottomNavigationLayout library for Android
* Copyright (c) 2016. Nikola Despotoski (http://github.com/NikolaDespotoski).
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@pennya
pennya / info.txt
Last active August 23, 2023 05:21
SHA-1 -> Base64 String in terminal
Android Studio IDE를 통해 Release Signing Key를 생성한다.
아래 명령어를 통해 사이닝키 SHA-1 값을 Base64로 인코딩한 값을 출력하여 페이스북, 카카오 API에 해시를 등록할 수 있다.
keytool -exportcert -alias allcommunity -keystore /Users/kim/Desktop/allcommunity.jks | openssl sha1 -binary | openssl base64
만약 구글 플레이 개발자 콘솔에서 Google play app signing 기능을 활성화시키셨다면
구글 플레이에 앱이 릴리즈되기 전에 개발자의 로컬 개발 환경에서 릴리즈 키스토어의 시그너쳐가 삭제되고
구글 서버에 저장되어 있는 사이닝키의 시그너쳐로 교체됩니다. 그렇기 때문에 이 사이닝키로 생성한 키해시 또한 등록해줘야 합니다.
google play console > 해당 앱 선택 > 메뉴에서 출시관리 > 앱서명