Skip to content

Instantly share code, notes, and snippets.

@ZhangHang
ZhangHang / DragToSwitchView.swift
Created September 16, 2016 08:30
DragToSwitchView
import UIKit
public protocol DragToSwitchViewDelegate: class {
func dragToSwitchViewWillStartDragging(dragToSwitchView: DragToSwitchView)
func dragToSwitchViewDidEndDragging(dragToSwitchView: DragToSwitchView)
func dragToSwitchView(
dragToSwitchView: DragToSwitchView,
performSwitchingAnimationWithDuration duration: NSTimeInterval)
# 规则配置仅供参考,适用于 Surge iOS & Mac;
# 包含 Proxy Group、URL Rewrite 特性;
# 包含 Reject 规则,用于拦截广告、行为分析、数据统计;
# 屏蔽 Hao123、百度联盟广告以及部分运营商网页漂浮广告;
# Surge for Mac 简明指南 http://bit.ly/1TATRaG
[General]
# warning, notify, info, verbose
loglevel = notify
ipv6 = true
function LimitedTaxRule(from, to, rate) {
console.assert(from >= 0)
console.assert(to > from)
console.assert(rate >= 0)
//起始
this.from = from
//结束
this.to = to
//税率
@ZhangHang
ZhangHang / AppDelegate.swift
Last active February 28, 2016 15:57 — forked from sawapi/AppDelegate.swift
[Swift] Push Notification
//
// AppDelegate.swift
// pushtest
//
// Created by sawapi on 2014/06/08.
// Copyright (c) 2014年 sawapi. All rights reserved.
//
// iOS8用
import UIKit
@ZhangHang
ZhangHang / README.md
Created November 29, 2015 17:36 — forked from janlay/README.md
Yet another config for Surge.app

Install

  1. Modify index.txt with your output path and proxy info
  2. Use Text Builder to build configuration for Surge: $ text-builder -index /path/to/index.txt
  3. Import configuration via AirDrop/iTunes/Dropbox/iCloud

本人不提供任何保证和技术支持,使用者自负风险。
There are no guarantees, no any support. Use it at your own risk.

@ZhangHang
ZhangHang / vpnserver.sh
Created October 11, 2015 13:47 — forked from kevinzhow/vpnserver.sh
OnClickVPNServer
#!/usr/bin/env bash
echo 'deb http://shadowsocks.org/debian wheezy main' >> /etc/apt/sources.list
# Pre-requisites
sudo apt-get -y update
sudo apt-get -y install pptpd
sudo apt-get -y install fail2ban
sudo apt-get -y install shadowsocks-libev
@ZhangHang
ZhangHang / slideshowfactory
Last active August 29, 2015 14:11
have fun with javascript
function slideshowFactory(slideNodes, config) {
var _config = config || {};
var nodeAppearAnimator = _config.appear || fadeIn;
var nodeDisappearAnimator = _config.disappear || fadeOut;
var normalDelayInMS = _config.normalDelay || 3000;
var switchTimes = 0;
var isFirstLoop = true;
var isCancel = true;
var switchSlideTimeoutId = null;
@ZhangHang
ZhangHang / favicon.html
Created September 2, 2011 18:54
高分辨率 favicon
<link rel="icon" href="/static/img/icon_32x32.png" sizes="32x32" />
<link rel="icon" href="/static/img/icon_48x48.png" sizes="48x48" />