This file contains 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 Foundation | |
protocol AnyEquatableWrappable { | |
func isEqualTo(_ other: AnyEquatableWrappable) -> Bool | |
var asEquatable: AnyEquatable { get } | |
} | |
extension AnyEquatableWrappable where Self: Equatable { | |
func isEqualTo(_ other: AnyEquatableWrappable) -> Bool { | |
guard let other = other as? Self else { return false } |
This file contains 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
extension Array { | |
var shuffled:[Element] { | |
var clone = self | |
for index1 in 0..<count { | |
let index2 = Int(arc4random_uniform(UInt32(count))) | |
guard index1 != index2 else { continue } | |
swap( &clone[index1], &clone[index2] ) | |
} | |
return clone |
This file contains 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
register_shutdown_function(function(){$d=xhprof_disable();uasort($d,function($a,$b){$k='wt';return$a[$k]>$b[$k]?-1:$a[$k]!=$b[$k];});var_export($d);});xhprof_enable(); |
This file contains 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
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "ubuntu-14.04" | |
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" | |
config.vm.network :forwarded_port, guest: 80, host: 8888 |
This file contains 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
1. Connect to vagrant: | |
---------------------- | |
vagrant ssh | |
2. In Vagrant: | |
-------------- | |
sudo ln -s /opt/VBoxGuestAdditions-*/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions | |
exit |
This file contains 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
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "ubuntu-14.04" | |
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" | |
end |