Skip to content

Instantly share code, notes, and snippets.

View baoyongzhang's full-sized avatar

星一 baoyongzhang

View GitHub Profile
@baoyongzhang
baoyongzhang / safari_reader.js
Last active July 25, 2017 02:54
safari_reader.js
/*
* Copyright (c) 2010 Apple Inc. All rights reserved.
*/
function hostnameMatchesHostKnownToContainEmbeddableMedia(e) {
const t = /^(.+\.)?(youtube\.com|vimeo\.com|dailymotion\.com|soundcloud\.com|mixcloud\.com|embedly\.com|embed\.ly)\.?$/;
return t.test(e)
}
function lazyLoadingImageURLForElement(e) {
const t = /(data:image\/)?gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==/,
n = {
public class BlurUtil {
public static Bitmap blur(Context context, Bitmap sentBitmap, int radius) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
final RenderScript rs = RenderScript.create(context);
final Allocation input = Allocation.createFromBitmap(rs, sentBitmap, Allocation.MipmapControl.MIPMAP_NONE,
Allocation.USAGE_SCRIPT);
@baoyongzhang
baoyongzhang / executor.java
Last active August 29, 2015 14:27
Java线程池异常会被吞掉,需要手动获取异常信息
mExecutor = new ScheduledThreadPoolExecutor(6) {
@Override
protected void afterExecute(Runnable r, Throwable t) {
super.afterExecute(r, t);
if (t == null && r instanceof Future<?>) {
try {
Future<?> future = (Future<?>) r;
if (future.isDone())
future.get();
} catch (CancellationException ce) {