Skip to content

Instantly share code, notes, and snippets.

View rakkang's full-sized avatar

iCoder rakkang

  • Personal
  • Beijing
View GitHub Profile
@rakkang
rakkang / PockerII+Modifier.md
Last active October 14, 2016 07:50
Pocker II modify key for mac

##Poker II 机械键盘 Mac 键位改造

Refer】:Segmentfault.com

###Step 1. Pocker II 开关设置

  • 原始布局:

    original

  • 开关设置

@rakkang
rakkang / SVN+Log+Filter.py
Created April 27, 2016 03:52
过滤 svn 日志
#!/usr/bin/python
# coding:utf-8
import sys
argv_len = len(sys.argv)
def help():
print 'Filter svnlog by user or date! '
print 'USEAGE: svnlog [ARGs] '
@rakkang
rakkang / Optional+NSLog.swift
Created April 23, 2016 07:00
Control your log with DEBUG or RELEASE
// Refer: http://swifter.tips/condition-compile/
// 使用之前需要在项目的 Build Settings 中,找到 Swift Compiler - Custom Flags,并在其中的 Other Swift Flags 加上 -D DEBUG
class Utils {
/**
Control your log an DEBUG and RELEASE
- parameter anyObj: any info
- parameter file: Logging file name
- parameter fun: Logging function name
@rakkang
rakkang / GetFloatCountAfterDot.php
Created February 16, 2016 02:48
Get the availble number count after the dot in a float number!
<?php
/**
* 获取浮点数后的有效小数位数
*/
function getFloatLenAfterDot($numbric)
{
echo "Orinial: " . $numbric . "\n";
$arr = explode(".", $numbric);
@rakkang
rakkang / PHP+Uniform+Rand+Serial.php
Last active May 17, 2016 08:39
生成伪均匀分布的随机序列
<?php
/**
* Rang = [$start, $end]
*/
function gen_rand_serial($count, $start, $end)
{
$R = $end - $start + 1;
$count = min($R, $count);
if ($R == $count) {
@rakkang
rakkang / Flowchart.tmLanguage
Last active January 13, 2016 04:10
Flowchart Syntax
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>flowchart</string>
</array>
<key>foldingStartMarker</key>
<string>{</string>
@rakkang
rakkang / Mac+Polipo.plist
Last active August 5, 2021 05:00
Mac 开机启动 plist 文件配置
<?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>
@rakkang
rakkang / PHP+Executable+Script.php
Last active August 2, 2016 07:21
A executable PHP script template.
<?php
/**
* @desc Shell execuatable php script
* @author rakkang
* @date 2015-12-30
*/
const G_DESCRIPTION = 'Sample script.';
//!!!! DON'T CHANGE VARIABLE NAME
#!/bin/sh
# 配置你喜欢的diff程序路径
DIFF="vimdiff"
# SVN diff命令会传入两个文件的参数
LEFT=${6}
RIGHT=${7}
# 拼接成diff命令所需要的命令格式
$DIFF $LEFT $RIGHT
@rakkang
rakkang / UIView+ColorGradient.mm
Created September 24, 2015 07:15
UIView 颜色渐变背景
// 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];