Skip to content

Instantly share code, notes, and snippets.

View kassadin's full-sized avatar
:octocat:
新年好

kassadin

:octocat:
新年好
View GitHub Profile
@kassadin
kassadin / AlertOnBack
Last active August 29, 2015 14:06
android 退出时弹出对话框
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("程序名称")
.setCancelable(true)
.setMessage("确定退出?")
.setPositiveButton("是的", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// System.exit(0);
@kassadin
kassadin / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kassadin
kassadin / OkHttpStack.java
Last active August 29, 2015 14:25 — forked from bryanstern/OkHttpStack.java
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@kassadin
kassadin / DateUtils.java
Last active August 29, 2015 14:26 — forked from kjsolo/DateUtils.java
Android,智能格式化中文时间
public class DateUtils {
public static String formatDateTime(Date date) {
String text;
long dateTime = date.getTime();
if (isSameDay(dateTime)) {
Calendar calendar = GregorianCalendar.getInstance();
if (inOneMinute(dateTime, calendar.getTimeInMillis())) {
return "刚刚";
} else if (inOneHour(dateTime, calendar.getTimeInMillis())) {
@kassadin
kassadin / OkHttpStack.java
Last active August 29, 2015 14:27 — forked from JakeWharton/OkHttpStack.java
A `HttpStack` implementation for Volley that uses OkHttp as its transport.
import com.android.volley.toolbox.HurlStack;
import com.squareup.okhttp.OkHttpClient;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* An {@link com.android.volley.toolbox.HttpStack HttpStack} implementation which
* uses OkHttp as its transport.
*/
package org.paulbetts.shroom.core;
import android.os.AsyncTask;
import com.squareup.okhttp.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
@kassadin
kassadin / SystemUiHelper.java
Created December 14, 2015 09:41 — forked from chrisbanes/SystemUiHelper.java
SystemUiHelper
/*
* Copyright (C) 2014 The Android Open Source Project
*
* 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
@kassadin
kassadin / sources.list
Created April 18, 2017 15:11
ubuntu 14.04 sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
@kassadin
kassadin / config
Created April 18, 2017 15:25
sdkman auto answer config
sdkman_auto_answer=true
sdkman_auto_selfupdate=false
sdkman_insecure_ssl=false
sdkman_disable_gvm_alias=false
sdkman_curl_connect_timeout=7
sdkman_curl_max_time=10
sdkman_beta_channel=false
sdkman_debug_mode=false
sdkman_colour_enable=true
@kassadin
kassadin / settings.xml
Created April 18, 2017 15:31
maven settings.xml aliyun
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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