This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 获取当前系统亮度 | |
**/ | |
public int getGlobalScrennBrightness(Context context) { | |
int nowBrightnessValue = -1; | |
ContentResolver resolver = context.getContentResolver(); | |
try { | |
nowBrightnessValue = android.provider.Settings.System.getInt(resolver, | |
Settings.System.SCREEN_BRIGHTNESS); | |
} catch (Exception e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 在 Info.plist 中添加以下代码 | |
<dict> | |
<key>NSAllowsArbitraryLoads</key> | |
<true/> | |
</dict> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 避免 block 循环引用 | |
__weak id <JumpActionDelegate> soft_delegate = _jumpDelegate; | |
mCategoryAdapter.onCategoryItemClick = ^(NSString *category_id) { | |
[soft_delegate jumpToCategoryList:category_id]; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UIImageView 圆形效果 | |
imgView.layer.cornerRadius = 24; // 圆角半径 | |
imgView.layer.masksToBounds = YES; // 剪裁 View | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 方法一: | |
/* | |
1: NSAttributedString 的每个部分都要至少设置两个属性: | |
NSFontAttributeName | |
NSForegroundColorAttributeName | |
2: NSStringDrawingOptions 的值, 在多行的情况下, 至少要有 | |
NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UIView 颜色渐变背景 | |
CAGradientLayer *gradient = [CAGradientLayer layer]; | |
gradient.frame = view.frame; | |
gradient.colors = [NSArray arrayWithObjects: | |
(id)kUIColorFromRGB(0x000000, 0.8).CGColor, | |
(id)kUIColorFromRGB(0x000000, 0.5).CGColor, | |
(id)kUIColorFromRGB(0x000000, 0.3).CGColor, | |
(id)kUIColorFromRGB(0x000000, 0.2).CGColor, | |
(id)kUIColorFromRGB(0x000000, 0.005).CGColor, nil]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# 配置你喜欢的diff程序路径 | |
DIFF="vimdiff" | |
# SVN diff命令会传入两个文件的参数 | |
LEFT=${6} | |
RIGHT=${7} | |
# 拼接成diff命令所需要的命令格式 | |
$DIFF $LEFT $RIGHT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @desc Shell execuatable php script | |
* @author rakkang | |
* @date 2015-12-30 | |
*/ | |
const G_DESCRIPTION = 'Sample script.'; | |
//!!!! DON'T CHANGE VARIABLE NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" ecoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" | |
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>jopper.proxy.polipo</string> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>KeepAlive</key> |
OlderNewer