Skip to content

Instantly share code, notes, and snippets.

View kevin-lee's full-sized avatar
🏠
Working from home

Kevin Lee kevin-lee

🏠
Working from home
View GitHub Profile
@kevin-lee
kevin-lee / OverridingAndHidingTest.java
Last active March 24, 2017 03:07
Example code of overriding and hiding methods. Check out my comments on http://goo.gl/wZL96
class SuperClass
{
public static void runStatic(String code)
{
System.out.println(code + ": I am the runStatic method in SuperClass.");
}
public static void runStatic2(String code)
{
System.out.println(code + ": I am the runStatic2 method in SuperClass.");
@kevin-lee
kevin-lee / gitpullall
Last active January 12, 2017 17:08
Git pull from multiple remote git repositories
Copyright 2015 Lee, Seong Hyun (Kevin)
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
let primes :: [Integer]
primes = sieve [2..]
where sieve :: [Integer] -> [Integer]
sieve (x : xs) = x : sieve [n | n <- xs, n `mod` x /= 0]
-- It works even without parameter types specified yet it is always good to have the type information
-- as it tells the users of the function how to use it.
-- It can also help you implement the function.
-- primes without parameter types (Uncomment it if you want to try).
@kevin-lee
kevin-lee / WordCount.scala
Last active January 15, 2016 12:16
Word Count Code Examples
/**
* @author Kevin Lee
* @since 2016-01-15
*/
object WordCount extends App {
def wordCount(lines: String): Map[String, Array[Int]] =
lines.split('\n')
.map(_.trim)
.map(_.split("[\\s]+"))
.zipWithIndex
@kevin-lee
kevin-lee / WebConfiguration.java
Last active December 22, 2015 16:09
A solution or at least a workaround to the problem described at https://github.com/webjars/jquery/pull/8 for Spring framework users. To use this, you shouldn't use <mvc:resources> or ResourceHandler. It works for both name-version.number.extension and name.extension. e.g.) /webjars/jquery/1.10.2/jquery-1.10.2.min.map, /webjars/jquery/1.10.2/jque…
/**
* Copyright 2013 Lee, Seong Hyun (Kevin)
*
* 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
@kevin-lee
kevin-lee / mvn-dep-tree.sh
Last active December 11, 2015 05:48
Simple script to get a maven dependency tree without using maven's options which are hard to remember.
#!/bin/bash
##########################################################
## Simple script to get maven dependency tree ##
## @author Lee, SeongHyun (Kevin) ##
## @veraion 0.0.1 (2013-01-17) ##
## ##
## To change the option 'include' and 'output', change ##
## the values of INCLUDE_NAME and OUTPUT_NAME ##
## respectively. ##
## e.g.) to change 'include' to 'inc' and 'output' to ##
@kevin-lee
kevin-lee / LookAndSaySequenceExample.java
Created September 8, 2012 18:48
Look-and-say sequence examples written in Java (by Kevin) / Please visit http://goo.gl/X94gN for more details.
package com.lckymn.kevin.example;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Visit http://goo.gl/X94gN for more details.
*
* @author Lee, SeongHyun (Kevin) / <a href="http://blog.lckymn.com">Kevin&apos;s Blog</a>
@kevin-lee
kevin-lee / TakeLinks.md
Last active September 7, 2015 05:13
Take all the names and URLs from HTML
@kevin-lee
kevin-lee / Wide GitHub Issues, Wiki and Pull Requests.md
Last active September 4, 2015 04:28
Stylish: Wide GitHub Wiki, Issues and Pull Requests

Wide GitHub Wiki, Issues and Pull Requests

This is a modified version of GitHub Wide. I didn't write it entirely but modified a bit.

Chrome

Change Applies to to URLs matching the regexp and put the following pattern.

https://github.com/[^/]+/[^/]+/(((wiki|issues)([?/][^/]*)*)|(pull/[0-9]+(([\/])((?!files).)*)?))
@kevin-lee
kevin-lee / SomeMapExample.java
Last active August 29, 2015 14:25
Some Java 8 example code
package cc.kevinlee.examples;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import static cc.kevinlee.examples.KeyValPair.*;
/**