Skip to content

Instantly share code, notes, and snippets.

View kingori's full-sized avatar

Sewon Ann kingori

View GitHub Profile
@kingori
kingori / Helloworld.scala
Created April 30, 2012 11:41
Scala Helloworld
object Hello extends Application {
println("hello")
}
@kingori
kingori / MainActivity.java
Created June 12, 2012 16:41
ActionBar Tab with Fragment
package com.proto.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@kingori
kingori / And_charset_comparisonActivity.java
Created June 14, 2012 02:36
android Charset.availableCharsets() crash test
package kr.pe.kingori.exp.charset;
import java.nio.charset.Charset;
import java.util.concurrent.atomic.AtomicInteger;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
@kingori
kingori / SampleEndlessLoader.java
Created June 18, 2012 16:04
android AsyncTaskLoader sample
public static class SampleEndlessLoader extends AsyncTaskLoader<List<String>> {
EventManager evManager;
int itemCount = 0;
boolean isLoading = false;
public SampleEndlessLoader(Context context, EventManager evManager) {
super(context);
Log.d(LOG_TAG, "EndlessLvFrag.SampleLoader.SampleLoader:");
this.evManager = evManager;
@kingori
kingori / gist:3207764
Created July 30, 2012 15:22
linkified spannable generator
public static Spannable getLinkifiedSpannable(String text) {
Spannable spannable = new SpannableStringBuilder(text); //create spannable for linkify
Linkify.addLinks(spannable, Linkify.ALL); // make URLspan
URLSpan[] spans = spannable.getSpans(0, spannable.length(), URLSpan.class); //get url spans
for (URLSpan span : spans) { //iterate on url spans
int spanStart = spannable.getSpanStart(span); //save postion of current url span
int spanEnd = spannable.getSpanEnd(span);
if (spanStart < 0 || spanEnd < 0)
@kingori
kingori / FullScreenImageViewTouch.java
Created September 9, 2012 13:56
https://github.com/TheDimasig/ImageViewZoom 의 full screen 버전: 최소 축소해도 화면을 꽉 채우도록
public class FullScreenImageViewTouch extends ImageViewTouch {
public FullScreenImageViewTouch(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void setImageDrawable(Drawable drawable) {
Point p = getScreenSize(getContext());
int bitmapWidth = drawable.getIntrinsicWidth();
int bitmapHeight = drawable.getIntrinsicHeight();
@kingori
kingori / Euler1.scala
Last active December 16, 2015 07:09
프로젝트 오일러 1번 풀이
class Euler1 {
/**
* 1 부터 maxVal 미만의 수 중 3 또는 5의 배수의 합
* @param maxVal
* @return
*/
def getMultipleOf3Or5(maxVal: Int) = {
(0 /: (1 until maxVal).filter((arg: Int) => (arg % 3 == 0 || arg % 5 == 0)))(_ + _)
}
@kingori
kingori / Euler2.scala
Created April 16, 2013 16:30
프로젝트 오일러 2번 풀이
class Euler2 {
/**
* max 이하의 짝수 피보나치 수열 합
* @param op1
* @param op2
* @param max
* @param sum
* @return
*/
@kingori
kingori / Euler3.scala
Created April 21, 2013 04:57
project euler 3번
class Euler3 {
/**
* prime 여부
* @param num
* @return
*/
def isPrimeLong(num: Long): Boolean = {
var index = 2L
while (index < num) {
@kingori
kingori / Euler4.scala
Last active December 16, 2015 11:38
euler 4번 풀이
class Euler4 {
def findMaxPalindrome():Int = {
for (i <- (1 to 9).reverse; j <- (0 to 9).reverse; k <- (0 to 9).reverse) {
val num = 100001 * i + 10010 * j + 1100 * k
for (k <- (100 to Math.sqrt(num).toInt).reverse if num % k == 0 && num / k < 1000) {
return num
}
}
return 0
}