Skip to content

Instantly share code, notes, and snippets.

View LLin233's full-sized avatar

Leonard L LLin233

View GitHub Profile
/**
* Build a flight schedule where we can identify a closest airport for a plane to land.
* A plane is in the air. The pilot uses this program to search for the closest airport in the area where it can land. The airport should * be able to accomodate the size of the plane. For example, if the plane size is 737, the airport must be a large one.
*/
Class Airport {
double latitude;
double longitude;
boolean isAvailable;
//getters()
//setters()
public class TrieLC {
public static void main(String[] args) {
Trie trie = new Trie();
trie.addWord("apple");
trie.addWord("apply");
trie.addWord("application");
System.out.println(trie.getWords("app"));
System.out.println(trie.search("application"));
}
}
@LLin233
LLin233 / gist:5484898ac35fb6fd54b9
Created March 8, 2016 20:37
Retrofit Endpoint
public abstract class BaseEndpoint {
protected static final String BASE_URL = "https://api.instagram.com/v1/";
protected static OkHttpClient httpClient = new OkHttpClient();
protected static HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
protected static Retrofit.Builder builder = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create());
protected final String accessToken;
protected BaseEndpoint(final String accessToken) {
/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* 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
@LLin233
LLin233 / git_toturial
Created March 21, 2016 23:53 — forked from guweigang/git_toturial
git命令大全
git init # 初始化本地git仓库(创建新仓库)
git config --global user.name "xxx" # 配置用户名
git config --global user.email "xxx@xxx.com" # 配置邮件
git config --global color.ui true # git status等命令自动着色
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive auto
git config --global --unset http.proxy # remove proxy configuration on git
git clone git+ssh://git@192.168.53.168/VT.git # clone远程仓库
@LLin233
LLin233 / retrofit-custom-error-handling.java
Created June 9, 2016 23:07 — forked from benvium/retrofit-custom-error-handling.java
Fairly simply Retrofit custom error handling example. Is set up so that you don't need to do much work in the 'failure' handler of a retrofit call to get the user-visible error message to show. Works on all endpoints. There's lots of exception handling as our server folks like to keep us on our toes by sending all kinds of random stuff..!
// on error the server sends JSON
/*
{ "error": { "data": { "message":"A thing went wrong" } } }
*/
// create model classes..
public class ErrorResponse {
Error error;
@LLin233
LLin233 / genymotionwithplay.txt
Created September 1, 2016 20:06 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
@LLin233
LLin233 / ApiModule.java
Created September 6, 2016 22:03 — forked from koesie10/ApiModule.java
Retrofit 1 error handling behaviour in Retrofit 2
// Dagger 1 example
@Module(
complete = false,
library = true
)
public final class ApiModule {
@Provides
@Singleton
Retrofit provideRetrofit(Gson gson, Application app) {
return new Retrofit.Builder()
@LLin233
LLin233 / iterm2-solarized.md
Created November 18, 2016 01:02 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font (OS X / macOS)

Solarized

I just had to set up Jenkins to use GitHub. My notes (to myself, mostly):

Detailed Instructions

For setting up Jenkins to build GitHub projects. This assumes some ability to manage Jenkins, use the command line, set up a utility LDAP account, etc. Please share or improve this Gist as needed.

Install Jenkins Plugins