Skip to content

Instantly share code, notes, and snippets.

Ji Hoon Kim pennya

Block or report user

Report or block pennya

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pennya
pennya / PassingCars.java
Last active Apr 17, 2019
[Codility-Prefix Sums(접두사 합계?)] - PassingCars
View PassingCars.java
/*
A non-empty array A consisting of N integers is given. The consecutive elements of array A represent consecutive cars on a road.
Array A contains only 0s and/or 1s:
0 represents a car traveling east,
1 represents a car traveling west.
The goal is to count passing cars. We say that a pair of cars (P, Q), where 0 ≤ P < Q < N, is passing when P is traveling to the east and Q is traveling to the west.
For example, consider array A such that:
@pennya
pennya / MaxCounters.java
Last active Apr 17, 2019
[Codility-Counting Elements] - MaxCounters
View MaxCounters.java
// N을 넘을때마다 max를 찾아서 일괄 적용후 진행하는 방식은 O(n^2) 만큼의 시간소요
// N을 넘을때마다 임시로 저장된 값으로 max를 설정해 적용하고 나중에 max 적용안된 부분을 일괄적으로 적용하는 방법 O(N+M)
class Solution {
public int[] solution(int N, int[] A) {
// write your code in Java SE 8
int answer[] = new int[N];
int max = 0, temp = 0;
@pennya
pennya / readme.txt
Last active Apr 14, 2019
flutter 설치
View readme.txt
1. 설치
https://flutter.dev/docs/get-started/install/macos
위 경로로 들어가서 mac 버전 flutter를 다운로드 받는다
home에 develepment 폴더(자유) 만들고 압축해제하면 flutter 폴더가 생긴다
export PATH="$PATH:`pwd`/flutter/bin"
터미널로 위 명령어를 실행하여 flutter를 환경변수에 세팅해야 하지만 이렇게하면 터미널을 껏다가 킬때마다 실행해야한다.
.bash_profile ( home에 숨겨져있음) 에서 값을 수정해야 한다.
@pennya
pennya / readme.xml
Last active Mar 24, 2019
ProgressBar Style 쉽게 변경하는 방법
View readme.xml
style.xml 파일에서
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
@pennya
pennya / info.txt
Last active Mar 24, 2019
SHA-1 -> Base64 String in terminal
View info.txt
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 > 해당 앱 선택 > 메뉴에서 출시관리 > 앱서명
@pennya
pennya / SwipeDismissBaseActivity.java
Created Mar 20, 2019
밀어서 액티비티 종료
View SwipeDismissBaseActivity.java
public abstract class SwipeDismissBaseActivity extends AppCompatActivity {
private static final int SWIPE_MIN_DISTANCE = 120;
private static final int SWIPE_MAX_OFF_PATH = 250;
private static final int SWIPE_THRESHOLD_VELOCITY = 200;
private GestureDetector gestureDetector;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
gestureDetector = new GestureDetector(new SwipeDetector());
@pennya
pennya / gist:9ec556e4c3addeaaddc4113b5ffe0796
Created Mar 7, 2019
Rendering Problems NOTE: One or more layouts are missing the layout_width or layout_height attributes. These are required in most layouts
View gist:9ec556e4c3addeaaddc4113b5ffe0796
The issue is resolved by these changes:
Close Android Studio
Go to C:\Users\UserName.android and rename the build-cache folder to buildcache.bak
Go to C:\Users\UserName.AndroidStudio3.2\system and rename these folders
(1) caches to caches.bak
(2) compiler to compiler.bak
(3) compile-server to compile-server.bak
(4) conversion to conversion.bak
@pennya
pennya / DonutView.java
Created Feb 19, 2019
How to draw custom donut progress programmatically in Android !
View DonutView.java
public class DonutView extends View {
Context context;
int value = 0;
int size;
int strokeSize;
int textSize;
int width;
int height;
@pennya
pennya / build.gradle
Created Jan 14, 2019
Kotlin에서 Glide 추가할 때
View build.gradle
apply plugin: 'kotlin-kapt'
....
dependencies {
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}
@pennya
pennya / DuziPermission.kt
Created Dec 11, 2018
안드로이드 런타임 퍼미션
View DuziPermission.kt
class DuziPermission(private val context: Context) {
private lateinit var listener: PermissionListener
private lateinit var permissions: Array<String>
private lateinit var rationaleTitle: CharSequence
private lateinit var rationaleMessage: CharSequence
private lateinit var denyTitle: CharSequence
private lateinit var denyMessage: CharSequence
private var requestedOrientation: Int = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED // 시스템이 화면 모드를 정함
You can’t perform that action at this time.