Skip to content

Instantly share code, notes, and snippets.

View Assassinss's full-sized avatar
🎯
Focusing

ShangjingZhu Assassinss

🎯
Focusing
View GitHub Profile
@rswofxd
rswofxd / PySched.py
Created June 23, 2012 10:45
Python:任务调度,定时执行
#coding=utf-8
import time
import sched
import os
import threading
"""
sched模块,准确的说,它是一个调度(延时处理机制),每次想要定时执行某任务都必须写入一个调度。
使用步骤如下:
(1)生成调度器:
s = sched.scheduler(time.time,time.sleep)
@scottdweber
scottdweber / ExpandingCircleAnimationDrawable.java
Created March 22, 2013 02:14
An example showing how to create and use a Drawable that animates.
package com.example.manualanimation;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.view.animation.AnimationUtils;
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 30, 2024 23:36
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@romannurik
romannurik / DrawInsetsFrameLayout.java
Created February 10, 2014 16:28
DrawInsetsFrameLayout — adding additional background protection for system UI chrome when using KitKat’s translucent decor flags.
/*
* Copyright 2014 Google Inc.
*
* 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
@candycode
candycode / image-arraybuffer.js
Created March 7, 2014 15:24
Create a jpg image from ArrayBuffer data
// Simulate a call to Dropbox or other service that can
// return an image as an ArrayBuffer.
var xhr = new XMLHttpRequest();
// Use JSFiddle logo as a sample image to avoid complicating
// this example with cross-domain issues.
xhr.open( "GET", "http://fiddle.jshell.net/img/logo.png", true );
// Ask for the result as an ArrayBuffer.
xhr.responseType = "arraybuffer";
@ssinss
ssinss / EndlessRecyclerOnScrollListener.java
Last active January 19, 2024 08:52
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
@sjudd
sjudd / RecyclerToListViewScrollListener
Last active September 21, 2018 18:19
RecyclerView scroll listener to AbsListView scroll listener
public class RecyclerToListViewScrollListener extends RecyclerView.OnScrollListener {
private final AbsListView.OnScrollListener scrollListener;
private int lastFirstVisible = -1;
private int lastVisibleCount = -1;
private int lastItemCount = -1;
public RecyclerToListViewScrollListener(AbsListView.OnScrollListener scrollListener) {
this.scrollListener = scrollListener;
}
@waylife
waylife / LauncherUtil
Created March 14, 2015 09:42
ShortcutUtil
import java.util.List;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ProviderInfo;
import android.content.pm.ResolveInfo;
import android.text.TextUtils;
/**
@jcdom
jcdom / ReboundInterpolator.java
Last active January 10, 2017 05:00
An interpolator where the rate of change starts out quickly, decelerates and then bounces at the end.
import android.content.Context;
import android.util.AttributeSet;
import android.view.animation.Interpolator;
/**
* An interpolator where the rate of change starts out quickly,
* decelerates and then bounces at the end.
*
* Created by jcdom on 02/04/15.
*/
@flyingzl
flyingzl / android_naviator_react-native.js
Last active September 26, 2017 06:32
Use Navigator component in react-native
'use strict';
var React = require('react-native');
var {
AppRegistry,
View,
Navigator,
Text,
BackAndroid,
StyleSheet