Skip to content

Instantly share code, notes, and snippets.

@minsOne
minsOne / gist:aa3b4b0f071f72d5a58000abcac73e22
Created April 22, 2016 06:12 — forked from zetachang/gist:4111314
Instruction on adding a Acknowledgements Settings.bundle
  • To add Settings.bundle in Xcode. Command N and in Resource, choose Settings Bundle .
  • Open Root.plist in source code, paste the code below to replace it,
<?xml version="1.0" encoding="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>PreferenceSpecifiers</key>
	

Videos

@minsOne
minsOne / DragView.swift
Created August 17, 2016 16:29 — forked from fpg1503/DragView.swift
Drag and Drop View on macOS
protocol DragViewDelegate {
var acceptedFileExtensions: [String] { get }
func dragView(dragView: DragView, didDragFileWith URL: NSURL)
}
class DragView: NSView {
required init?(coder: NSCoder) {
super.init(coder: coder)
registerForDraggedTypes([NSFilenamesPboardType, NSURLPboardType])
@minsOne
minsOne / NRLabel.swift
Created September 23, 2016 05:41 — forked from NikolaiRuhe/NRLabel.swift
A UILabel subclass that adds padding around the text and handles layout properly.
import UIKit
class NRLabel : UILabel {
var textInsets: UIEdgeInsets = UIEdgeInsetsZero {
didSet { invalidateIntrinsicContentSize() }
}
override func textRectForBounds(bounds: CGRect, limitedToNumberOfLines numberOfLines: Int) -> CGRect {
var rect = textInsets.apply(bounds)
@minsOne
minsOne / Channel.swift
Created April 6, 2018 07:40 — forked from gokselkoksal/Channel.swift
Channel implementation
public class Channel<Value> {
private class Subscription {
weak var object: AnyObject?
private let notifyBlock: (Value) -> Void
private let queue: DispatchQueue
var isValid: Bool {
return object != nil
@minsOne
minsOne / GIF2MP4.swift
Created April 16, 2018 08:57 — forked from powhu/GIF2MP4.swift
Swift 3.0 GIF to MP4
//
// GIF2MP4.swift
//
// Created by PowHu Yang on 2017/1/24.
// Copyright © 2017 PowHu Yang. All rights reserved.
//
/*
let data = try! Data(contentsOf: Bundle.main.url(forResource: "gif", withExtension: "gif")!)
let tempUrl = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("temp.mp4")
GIF2MP4(data: data)?.convertAndExport(to: tempUrl, completion: { })
#!/bin/bash
# This script checks the binary and all nested frameworks for duplicated classes (both ObjectiveC and Swift).
# The script fails if it finds any duplicated classes.
function print_classes() {
otool -ov "$1" |
sed -n '/Contents of (__DATA,__objc_classlist)/,/Contents of/p' | # all lines for (__DATA,__objc_classlist) section
egrep '^[0-9]' | # take just a class header
cut -d ' ' -f 3 | # take just a symbol name
@minsOne
minsOne / SimpleHTTPServerWithUpload.py
Created January 19, 2020 06:38 — forked from touilleMan/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload - Python3 version
#!/usr/bin/env python3
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
see: https://gist.github.com/UniIsland/3346170
"""
// Copyright © 2019 Ooma Inc. All rights reserved.
import Foundation
import RIBs
import RxSwift
// MARK: - Plugin
public protocol Plugin: AnyObject {
associatedtype Component = Dependency
@minsOne
minsOne / hello.h
Created February 7, 2020 02:23 — forked from ddrccw/hello.h
detect jailbreak
//
// Created by ddrccw on 14-1-10.
// Copyright (c) 2014年 ddrccw. All rights reserved.
// refer to http://danqingdani.blog.163.com/blog/static/1860941952012102122847478/
#import <sys/stat.h>
#import <mach-o/dyld.h>
//#import <stdlib.h>
//#import <string.h>