Skip to content

Instantly share code, notes, and snippets.

@buoge
buoge / LinkPageHelper.swift
Last active September 29, 2017 03:05
LinkPage iOS 接入 swift3 服务注册代码,官方文档是旧的 swift2, xcode9 没法使用,希望可以帮助到其他小伙伴
### 一些配置,看官方文档就可以了,填写包信息,schemes信息 等等
### application
// 判断是否是通过LinkedME的UrlScheme唤起App
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
if url.absoluteString.components(separatedBy: "click_id").count > 1 {
return LinkedME.getInstance().handleDeepLink(url);
}
return true
}
@buoge
buoge / GDTApi.swift
Created May 17, 2017 11:06
广点通接口调用 swift 版本,调试一些时间终于调用成功!
//
// GDTApi.swift
// zaozuo-ios
//
// Created by wuchuanbo on 16/4/20.
// Copyright © 2016年 zaozuo. All rights reserved.
//
import Foundation
@buoge
buoge / gist:a94798cd49854a569fdc32825c015167
Created April 24, 2017 09:47
截屏并展示在屏幕上
// 调用方法 didFinishLaunchingWithOptions中调用
// 注册截屏事件通知: AppScreenshotDelegate(appDelegate: self).registObserver()
import Foundation
class AppScreenshotDelegate: NSObject {
weak var mAppDelegate: AppDelegate?
init(appDelegate: AppDelegate?) {
self.mAppDelegate = appDelegate
}
@buoge
buoge / dlmusic
Created May 29, 2016 04:50 — forked from vetch/dlmusic
download 320kbps music from xiami.com
#!/usr/bin/env python
#-*-coding:utf8-*-
"""
vesion2.0
这个脚本的作用是通过输入某首歌页面的url,来实现这首歌的下载,保存到当前工作目录下。
目前可以实现高音质音乐的下载,无须账号登陆。
比如,When I'm Sixty-Four的页面的url是 http://www.xiami.com/song/1003908
download_hq_music('http://www.xiami.com/song/1003908'),将会实现When I'm Sixty-Four的320k版本下载
@buoge
buoge / NSAttributedString+Hyperlink.swift
Created November 5, 2015 11:47 — forked from Isuru-Nanayakkara/NSAttributedString+Hyperlink.swift
This is the Swift translation of the Apple's code snippet (https://developer.apple.com/library/mac/qa/qa1487/_index.html) displaying how to embed hyperlinks in NSTextField and NSTextView.
import Foundation
import UIKit
public enum UIButtonBorderSide {
case Top, Bottom, Left, Right
}
extension UIButton {
public func addBorder(side: UIButtonBorderSide, color: UIColor, width: CGFloat) {