Skip to content

Instantly share code, notes, and snippets.

@zhuixinjian
zhuixinjian / gist:99591cabe8f4aa0610a9
Last active August 29, 2015 14:07 — forked from ov3rk1ll/gist:467db75bd559f7f97f9e
让当前view一直处于栈顶.
package com.handheldgroup.fullfocus;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import java.lang.reflect.Method;
@zhuixinjian
zhuixinjian / gist:a823fe72666f8b26a351
Created October 13, 2014 10:09
获取当前调用栈
StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace();
StackTraceElement e = stacktrace[4];// maybe this number needs to be corrected
String methodName = e.getMethodName();
String className = e.getClassName();
@zhuixinjian
zhuixinjian / gist:acad1ed476cfe6988a24
Created September 25, 2014 09:10
获取用户当前设置的壁纸
final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this.getContext());
final Drawable wallpaperDrawable = wallpaperManager.getDrawable();
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
1.CentOS 6.3
#yum install make gcc
#cd /opt
$wget http://redis.googlecode.com/files/redis-2.x.xx.tar.gz
$tar zxf redis-2.x.xx.tar.gz
$cd redis-2.x.xx
$make
$make install
//////
wget = Popen(['wget', url,'-O',wget_out_file], stdout=PIPE, stderr=STDOUT)
while True:
line = wget.stdout.readline()
if not line: break
print line
wget.wait()
wget = Popen(['wget', url,'-O',wget_out_file], stdout=PIPE, stderr=STDOUT)
while True:
line = wget.stdout.readline()
if not line: break
print line
wget.wait()
#import <QuartzCore/QuartzCore.h>
UIView *shadowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenWidth)];
shadowView.layer.shadowColor = [UIColor blackColor].CGColor;
shadowView.layer.shadowOpacity = 0.5;
shadowView.layer.shadowOffset = CGSizeMake(0, 2);
shadowView.layer.shadowPath = [UIBezierPath bezierPathWithRect:shadowView.frame].CGPath;
shadowView.layer.shadowRadius = 2.0f;
shadowView.layer.masksToBounds = NO;
[self.view addSubview:shadowView];