Skip to content

Instantly share code, notes, and snippets.

View loslch's full-sized avatar

ChangHun Lee loslch

View GitHub Profile
@loslch
loslch / get_ie_version.js
Last active December 15, 2017 00:09
[JS] Get Internet Explorer Version
(function() {
var head;
function getInternetExplorerVersion()
{
var rv = -1;
if (navigator.appName == 'Microsoft Internet Explorer')
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
@loslch
loslch / gist:c0e8fb966fffbd03753046cd5106b4d2
Last active August 15, 2016 07:42
Remove AD of Naver, Daum TV
# Block AD
# Daum
127.0.0.1 amsv1.daum.net
127.0.0.1 amsv2.daum.net
127.0.0.1 ad.yieldmanager.com
127.0.0.1 yieldmanager.com
127.0.0.1 display.ad.daum.net
127.0.0.1 smr.tvpot.daum.net
127.0.0.1 vads-api.ad.daum.net
@loslch
loslch / aws-util.sh
Last active December 15, 2017 00:08 — forked from anonymous/gist:48dada491d2d5db34856f51d0d03ac19
Useful AWS CLI Functions
function aws-start-instance()
{
aws ec2 start-instances --instance-ids="$1"
}
function aws-stop-instance()
{
aws ec2 stop-instances --instance-ids="$1"
}
@loslch
loslch / The Technical Interview Cheat Sheet.md
Created January 25, 2017 15:10 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@loslch
loslch / PhoneBook.java
Created February 11, 2017 16:36
PhoneBook.java
// PhoneBook.java
public class PhoneBook {
Map<String, List<String>> map = new HashMap<String, List<String>>();
public void load(String filename) throws IOException {
try {
BufferedReader r = Files.newBufferedReader(Paths.get(filename));
String line = null;
@loslch
loslch / list_map.java
Created February 11, 2017 16:39
list_map.java
List<String> list = map.get(values[0]);
if (list == null) {
list = new ArrayList<String>();
}
list.add(values[1]);
map.put(values[0], list);
@loslch
loslch / refector_code_java8.java
Created February 11, 2017 16:40
refector_code_java8.java
List<String> list = map.getOrDefault(values[0], new ArrayList<String>());
list.add(values[1]);
map.put(values[0], list);
@loslch
loslch / complete_phone_book.java
Created February 11, 2017 16:41
complete_phone_book.java
// PhoneBook.java
public class PhoneBook {
Map<String, List<String>> map = new HashMap<String, List<String>>();
PhoneBookStrategy pbStrategy = null;
public void load(String filename) throws IOException {
try {
BufferedReader r = Files.newBufferedReader(Paths.get(filename));
@loslch
loslch / ExecutePhoneBook.java
Created February 11, 2017 16:43
ExecutePhoneBook.java
// ExecutePhoneBook.java
public class ExecutePhoneBook {
private final static String TEST_FILE = ExecutePhoneBook.FILE_FOLDER + "test_data_medium.csv";
public static void main(String[] args) throws IOException {
PhoneBook pb = null;
for (int i = 0; i < 10000; i++) {
pb = new PhoneBook();
@loslch
loslch / IfStrategy.class
Created February 11, 2017 16:45
IfStrategy.class
// IfStrategy.class
public void putPhoneNumber(java.util.Map<java.lang.String, java.util.List<java.lang.String>>, java.lang.String[]);
descriptor: (Ljava/util/Map;[Ljava/lang/String;)V
flags: ACC_PUBLIC
Signature: #19 // (Ljava/util/Map<Ljava/lang/String;Ljava/util/List<Ljava/lang/String;>;>;[Ljava/lang/String;)V
Code:
stack=3, locals=4, args_size=3
0: aload_1
1: aload_2