Skip to content

Instantly share code, notes, and snippets.

View HeGanjie's full-sized avatar

Bruce He HeGanjie

View GitHub Profile
@mediavrog
mediavrog / IconizedMenu.java
Last active September 17, 2022 13:17
Android Compatibility popup menu with icons (requires support library v7)
/**
* Seems like the only way to use it currently (as of 10/2018) is through reflection
* see https://resocoder.com/2018/02/02/popup-menu-with-icons-android-kotlin-tutorial-code/
**/
package com.vuzz.snapdish.ui;
import android.content.Context;
import android.support.v7.internal.view.SupportMenuInflater;
import android.support.v7.internal.view.menu.MenuBuilder;
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
@jaredhirsch
jaredhirsch / gist:4971859
Created February 17, 2013 15:19
all about ETags

ETags: a pretty sweet feature of HTTP 1.1

HTTP caching review

HTTP provides two ways for servers to control client-side caching of page components:

  • freshness may be based on a date or a token whose meaning is app-specific
  • whether or not the client needs to confirm the cached version is up-to-date with the server

This breaks down as follows:

  • Cache locally and don't check before using.
@oldrev
oldrev / RmbUpperConverter.cs
Last active December 23, 2015 12:09
中文互联网上迄今为止实现最正确、代码最漂亮且效率最高的大写人民币金额转换代码
/** 中文互联网上迄今为止实现最正确、代码最漂亮且效率最高的大写人民币金额转换代码
* 作者:李维 <oldrev@gmail.com>
* 版权所有 (c) 2013 昆明维智众源企业管理咨询有限公司。保留所有权利。
* 本代码基于 BSD License 授权。
* */
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;