Skip to content

Instantly share code, notes, and snippets.

@gunlee01
gunlee01 / FiberTest.java
Created September 20, 2020 13:28
Project Loom, fiber(virtual thread) test generating stack trace.
package gunlee.demo.fiber;
import org.junit.jupiter.api.Test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
@hmm-umm
hmm-umm / GuardUtil.kt
Last active November 5, 2018 08:56
half like swift guard
fun guard(predicate: () -> Boolean) : GuardClass {
return GuardClass(predicate)
}
data class GuardClass(val checkFunc: () -> Boolean) {
inline infix fun `else`(elseFunc: () -> Nothing) {
if (!checkFunc()) { elseFunc() }
}
}
@prongbang
prongbang / ThumbnailActivity.kt
Last active August 28, 2020 10:37
Android RecyclerView StaggeredGridLayoutManager Example
val thumbnails = ArrayList<String>()
thumbnails.add("http://www.hotel-r.net/im/hotel/pl/hotel-simple-1.jpg")
thumbnails.add("https://media-cdn.tripadvisor.com/media/photo-s/0e/20/6a/59/simple-patagonia-hotel.jpg")
thumbnails.add("https://mir-s3-cdn-cf.behance.net/project_modules/disp/65daa813704049.5627720c3ae61.jpg")
thumbnails.add("http://www.hotel-r.net/im/hotel/lt/hotel-simple-12.jpg")
thumbnails.add("https://images.trvl-media.com/hotels/7000000/6450000/6441600/6441512/6441512_56_z.jpg")
thumbnails.add("http://interiii.com/wp-content/uploads/2013/03/Latest-Caro-Hotel-Design-by-Francesc-Rif%C3%A9-Studio-Decoration-Ideas1.jpg")
thumbnails.add("https://media-cdn.tripadvisor.com/media/photo-s/05/07/33/ba/smart-and-simple-hotel.jpg")
thumbnails.add("https://c1.hiqcdn.com/images/property/resortimg/431680_w85.jpg")
thumbnails.add("https://www.cabinn.com/sites/default/files/CabInn_Aalborg_029_0.jpg")
@lattner
lattner / TaskConcurrencyManifesto.md
Last active January 5, 2025 12:21
Swift Concurrency Manifesto

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
@peerapongsam
peerapongsam / Gson Dynamic Key Deserializer.java
Last active August 1, 2020 13:01
Gson Dynamic Key Deserializer
package me.peerapong.android_dynamicjsonkey;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
@pdegand
pdegand / GridSpacingItemDecoration.java
Created April 19, 2016 09:18
A RecyclerView.ItemDecoration that you can apply on grids to have spacing between cells without using ugly margins on the cell layout. Feel free to use either the Kotlin version or the Java version.
/* The MIT License (MIT)
Copyright (c) 2016 Pierre Degand
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

JVM GC

모든 Java Application은 JVM(Java Virtual Machine)위에서 동작한다. 이 JVM이 동작하는데 있어서, 메모리의 구조와 특히 GC는 Application의 응답시간과 성능에 밀접한 관계를 미친다.

JVM 의 메모리 구조와 GC 알고리즘 (JDK 1.4.X에 포함된 새로운 알고리즘 포함) 그리고, JVM의 메모리 튜닝을 통한 Application의 성능향상방법에 대해서 알아보도록 하자.

GC란 무엇인가?

@MichaelRocks
MichaelRocks / MathExtensions.kt
Last active January 9, 2025 06:38
Math extension functions and float-math functions for Kotlin
/*
* Copyright 2015 Michael Rozumyanskiy
*
* 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
@haje01
haje01 / TensorFlow 시작하기.md
Last active May 3, 2024 07:30
TensorFlow 시작하기

텐서플로우 시작하기

글쓴이: 김정주([email protected])

이 문서는 텐서플로우 공식 페이지 내용을 바탕으로 만들어졌습니다.


소개

텐서플로우(TensorFlow)는 기계 학습과 딥러닝을 위해 구글에서 만든 오픈소스 라이브러리입니다. 데이터 플로우 그래프(Data Flow Graph) 방식을 사용하였습니다.