Skip to content

Instantly share code, notes, and snippets.

View dotWasim's full-sized avatar
🏠
Working from home

Wasim Alatrash dotWasim

🏠
Working from home
  • Turkey
View GitHub Profile
@vinczebalazs
vinczebalazs / SheetModalPresentationController.swift
Last active February 1, 2024 04:40
A presentation controller to use for presenting a view controller modally, which can be dismissed by a pull down gesture. The presented view controller's height is also adjustable.
import UIKit
extension UIView {
var allSubviews: [UIView] {
subviews + subviews.flatMap { $0.allSubviews }
}
func firstSubview<T: UIView>(of type: T.Type) -> T? {
allSubviews.first { $0 is T } as? T
@iandundas
iandundas / xcode-downloader.rb
Created February 21, 2017 09:02
Script for reliably downloading binaries (e.g. Xcode) from Apple's CDN
#!/usr/bin/env ruby
print "What is the URL of your Apple Downloads resource?\nURL:"
url = gets.strip
print "What is the ADCDownloadAuth cookie token:\nADCDownloadAuth: "
token = gets.strip
command = "aria2c --header \"Host: adcdownload.apple.com\" --header \"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\" --header \"Upgrade-Insecure-Requests: 1\" --header \"Cookie: ADCDownloadAuth=#{token}\" --header \"User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_1 like Mac OS X) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0 Mobile/14B72 Safari/602.1\" --header \"Accept-Language: en-us\" -x 16 -s 16 #{url} -d ~/Downloads"
@ndarville
ndarville / diff.mdown
Created July 23, 2012 20:33
Paul Heckel's Diff Algorithm

[Isolating Differences Between Files][paper]

Advantage over Other Algorithms

The diff output is more specific:

[I]f a whole block of text is moved, then all of it, rather than just the beginning and end, is detected as changed.

>The algorithm described here avoids these difficulties. It detects differences that correspond very closely to our intuitive notion of difference.