Skip to content

Instantly share code, notes, and snippets.

View cozzin's full-sized avatar
🎯
Focusing

SeongHo Hong cozzin

🎯
Focusing
View GitHub Profile
@iamchiwon
iamchiwon / Rx+Control.swift
Last active August 1, 2018 08:45
Control 이벤트에 sender 를 알게 한다.
//
// Rx+Control.swift
// ReactiveSample
//
// Created by iamchiwon on 2018. 8. 1..
// Copyright © 2018년 iamchiwon. All rights reserved.
//
import UIKit
import RxSwift
@Fazzani
Fazzani / free_m3u8.m3u
Created July 28, 2018 09:13
Free m3u8 streams
http://sample.vodobox.net/skate_phantom_flex_4k/skate_phantom_flex_4k.m3u8
http://playertest.longtailvideo.com/adaptive/wowzaid3/playlist.m3u8
http://cdn-fms.rbs.com.br/vod/hls_sample1_manifest.m3u8
http://nasatv-lh.akamaihd.net/i/NASA_101@319270/index_1000_av-p.m3u8?sd=10&rebase=on
http://content.jwplatform.com/manifests/vM7nH0Kl.m3u8
@Deub27
Deub27 / UIStackView+removeAll.swift
Created November 25, 2017 14:00
Remove all arranged subviews from UIStackView at once
import UIKit
extension UIStackView {
func removeAllArrangedSubviews() {
let removedSubviews = arrangedSubviews.reduce([]) { (allSubviews, subview) -> [UIView] in
self.removeArrangedSubview(subview)
return allSubviews + [subview]
}
@RamwiseMatt
RamwiseMatt / RxJTAppleCalendarDelegateProxy.swift
Last active June 21, 2018 05:59
Example of broken DelegateProxy (rxSwift 4.0) for pure Swift delegate protocols
//
// RxJTAppleCalendarDelegateProxy.swift
// bookingclient
//
// Created by Mats on 7/9/17.
// Copyright © 2017 Ramwise. All rights reserved.
//
import JTAppleCalendar
import RxSwift

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
@andreaantonioni
andreaantonioni / ios-cell-registration-swift.md
Last active July 15, 2021 13:41 — forked from gonzalezreal/ios-cell-registration-swift.md
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)
public func register(_ nib: UINib?, forCellReuseIdentifier identifier: String)
@ralfr
ralfr / README.md
Created January 15, 2017 19:22 — forked from pdanford/README.md
Applescript to launch iTerm2 Version 3+ from OS X Finder via keyboard shortcut or Toolbar

Description

Based on info from http://peterdowns.com/posts/open-iterm-finder-service.html but with modified behavior and fixed to work with iTerm2 version 3 or later. It will not work with older versions of iTerm. The modified behavior is to open a new terminal window for each invocation instead of reusing an already open window. Update - The original author released a build script for the newer iTerm2 versions at https://github.com/peterldowns/iterm2-finder-tools that keeps the original behavior of reusing an open iTerm2 window.

To open iTerm2 at selected folder with keyboard shortcut

  1. Run Automator, select a new Service
  2. Select Utilities -> Run AppleScript
  3. Service receives selected 'folders' in 'finder.app'
  4. Paste script:

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@jonschlinkert
jonschlinkert / open-iterm-from-finder.md
Last active May 24, 2022 01:33
Add an icon to your finder toolbar to open iTerm in the current folder.

Open iTerm from finder

The code and instructions in this gist are from http://peterdowns.com/posts/open-iterm-finder-service.html. I've had to do this a few times and wanted to distill it the basics.

  1. Open Automator
  2. Create an Application
  3. Choose Actions > Utilities > Run Applescript
  4. Paste the contents of open_in_iterm.app into the window.
  5. Save the script somewhere convenient
  6. Find the script, then drag the script onto the Finder window while holding the command key (or in Yosemite, the command + option keys)
@kristopherjohnson
kristopherjohnson / methodNames.swift
Last active July 26, 2023 13:06
Get method names for an Objective-C class in Swift
import Foundation
/// Given pointer to first element of a C array, invoke a function for each element
func enumerateCArray<T>(array: UnsafePointer<T>, count: UInt32, f: (UInt32, T) -> ()) {
var ptr = array
for i in 0..<count {
f(i, ptr.memory)
ptr = ptr.successor()
}
}