Skip to content

Instantly share code, notes, and snippets.

View inferjay's full-sized avatar
🏠
Working from home

脉脉不得语 inferjay

🏠
Working from home
View GitHub Profile
package com.zackehh.example;
import com.zackehh.example.MinimalBrowser;
import android.content.Context;
import android.content.Intent;
import android.text.Layout;
import android.text.Spannable;
import android.text.method.MovementMethod;
import android.text.style.URLSpan;
LayoutInflater inflater = getLayoutInflater();
View view = inflater.inflate(R.layout.cust_toast_layout, (ViewGroup) findViewById(R.id.relativeLayout1));
Toast toast = new Toast(this);
toast.setView(view);
toast.show();
on run
-- Read the current value of AppleShowAllFiles
set plistValue to do shell script "defaults read com.apple.finder AppleShowAllFiles"
set plistCommand to "defaults write com.apple.finder AppleShowAllFiles"
if plistValue is "false" then
set shellCommand to plistCommand & " true"
else
set shellCommand to plistCommand & " false"
end if
public static void fileCopy( File in, File out ) throws IOException {
FileChannel inChannel = new FileInputStream( in ).getChannel();
FileChannel outChannel = new FileOutputStream( out ).getChannel();
try {//
inChannel.transferTo(0, inChannel.size(), outChannel);
// original -- apparently has trouble copying large files on Windows 
// magic number for Windows, 64Mb - 32Kb)
int maxCount = (64 * 1024 * 1024) - (32 * 1024);
long size = inChannel.size();
long position = 0;
@inferjay
inferjay / Get Beijing Time Zone Today of the Start Timoe of Millisecond Value
Created October 30, 2013 14:45
获取北京时区当天开始时间的毫秒值
public static long getTodayStartTime(){
Calendar todayStart = Calendar.getInstance(new SimpleTimeZone(0, "Asia/Beijing"));
todayStart.set(Calendar.HOUR, 0);
todayStart.set(Calendar.MINUTE, 0);
todayStart.set(Calendar.SECOND, 0);
todayStart.set(Calendar.MILLISECOND, 0);
Date today = (Date) todayStart.getTime().clone();
return today.getTime();
}
@inferjay
inferjay / AutoLineFeedLayout
Created November 8, 2013 03:33
Add the layout of the child view can automatically wrap
public class AutoLineFeedLayout extends RelativeLayout {
// Space between child views.
private final static int PAD_H = 5, PAD_V = 5;
private int mHeight;
/**
*
* <p>Description: 构造方法</p>
*@param context 上下文
*
@inferjay
inferjay / adb+
Created January 6, 2016 05:59 — forked from race604/adb+
#!/bin/bash
# Script adb+
# Run any command adb provides on all your currently connected devices,
# Or prompt to select one device
showHelp() {
echo "Usage: adb+ [-a] <command>"
echo " -h: show help"
echo " -a: run command on all device"
echo " command: normal adb commands"
@inferjay
inferjay / Android Lollipop Widget Tinting Guide
Created January 6, 2016 05:59 — forked from seanKenkeremath/Android Lollipop Widget Tinting Guide
How base colors in Lollipop apply to different UI elements
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21. To use the support version of these attributes, remove the android namespace. For instance, "android:colorControlNormal" becomes "colorControlNormal". These attributes will be propagated to their corresponding attributes within the android namespace for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
* ripple effect (Lollipop only) -- "colorControlHighlight"
Status Bar:
------------
* background (Lollipop only) - "colorPrimaryDark"
/*
* 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
@inferjay
inferjay / google-fonts-proxy
Created September 8, 2016 06:56 — forked from gaoyifan/google-fonts-proxy
google-fonts-proxy
server {
listen 80;
listen 443;
listen [::]:80;
listen [::]:443;
server_name fonts.lug.ustc.edu.cn;
access_log /var/log/nginx/revproxy_access.log;
error_log /var/log/nginx/revproxy_error.log;