This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export LC_CTYPE=C; | |
export LANG=C; | |
git filter-branch --tree-filter " | |
find . -type f -exec sed -i '' -E 's/sensitive-text/non-sensitive-text/g' {} + | |
" -f -- --all | |
git filter-branch --env-filter ' | |
OLD_EMAIL1="[email protected]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Scans all your *.swift.gyb files in your project folder and generates | |
# your boilerplates. | |
# Known bugs: | |
# 1) Timestamp of files with the name contains +, - would conflict each | |
# other. This is caused by Bash 3.2 doesn't support associative array, | |
# which enforces it to use dynamic variable name to store timestamps for | |
# difference file names, and variable name in Bash script cannot | |
# contain characters like "+" and "-", so "+" and "-" are all converted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
postfix operator !! { } | |
public postfix func !! <I: UnsignedIntegerType>(x: I) -> UInt { | |
#if arch(x86_64) || arch(arm64) | |
precondition( | |
x.toUIntMax() < 21, | |
"Invalid input to compute a factorial(< 21 on 64-bit arch)." | |
) | |
#else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIView+LiveHitTestTracing.h | |
// UIViewLiveHitTestTracing | |
// | |
// Created by Manfred on 10/28/15. | |
// | |
// | |
@import UIKit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[General] | |
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, localhost, *.local | |
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12 | |
# dns-server = 119.29.29.29, 223.5.5.5, 114.114.114.114 | |
dns-server = 114.114.114.114, 114.114.115.115 | |
loglevel = notify | |
[Proxy] | |
Proxy = http,1,2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public indirect enum BinarySearchTree<E: Comparable> { | |
public typealias Element = E | |
case Empty | |
case Node( | |
left: BinarySearchTree<Element>, | |
element: Element, | |
right: BinarySearchTree<Element>) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let string = "XCVBNMDFGHJRTYUERTYUSDFZDFWEDFASDASWE" | |
string.characters.count | |
let targetString = "ASWE" | |
targetString.characters.count | |
private class Substring { | |
var range: Range<String.Index> | |
var content: String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mechanize' | |
if !((ARGV[0] == 'SD' || ARGV[0] == 'HD' || ARGV[0] == 'ALL') && ARGV.size == 1) | |
puts %q{Usage: ruby WWDC_2015_downloader.rb SD | HD | ALL} | |
puts %q{Example: ruby WWDC_2015_downloader.rb SD - to download all SD videos} | |
puts %q{Example: ruby WWDC_2015_downloader.rb HD - to download all HD videos} | |
puts %q{Example: ruby WWDC_2015_downloader.rb ALL - to download videos in all resolutions} | |
exit | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Search an integer number in an ordered-cycling integer number array | |
var anArray = [22, 33, 44, 55, 66, 88, 99, 100, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
func find(number: Int, inArray anArray: [Int]) -> Int? { | |
return binary_search_considering_cycling(number, | |
inArray: anArray, baseIndex: 0) | |
} | |
func binary_search_considering_cycling(number: Int, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
private let SharedCASpringAnimationFactory = CASpringAnimationFactory() | |
public class CASpringAnimationFactory { | |
private var dummyView: UIView | |
private init() { | |
dummyView = UIView(frame: CGRect.zeroRect) | |
} |