Problem:
The following commands fail on OSX:
gem install nokogiri
gem install nokogiri -- --use-system-libraries
gem install nokogiri -- --use-system-libraries --with-xslt-dir=/usr/local/opt/libxslt --with-xml2-dir=/usr/local/opt/libxml2
Version:
| // Unselect all territories | |
| $('.mat-option.mat-selected').click() | |
| // Select all territories that are listed in the array | |
| $('.mat-option').filter((idx, el) => { return ["Austria"].indexOf(el.children[1].textContent) != -1 }).click() |
Problem:
The following commands fail on OSX:
gem install nokogiri
gem install nokogiri -- --use-system-libraries
gem install nokogiri -- --use-system-libraries --with-xslt-dir=/usr/local/opt/libxslt --with-xml2-dir=/usr/local/opt/libxml2
Version:
| struct Product { | |
| let price: NSDecimalNumber | |
| let locale: NSLocale | |
| var priceString: String { | |
| let formatter = NSNumberFormatter() | |
| formatter.numberStyle = .CurrencyStyle | |
| formatter.locale = locale | |
| return formatter.stringFromNumber(price)! | |
| } |
| extension String { | |
| var bytes: [UInt8]? { | |
| return dataUsingEncoding(NSUTF8StringEncoding) | |
| .flatMap { data in | |
| return (0..<data.length).map { | |
| UnsafeMutablePointer<UInt8>(data.bytes.advancedBy($0)).memory | |
| } | |
| } | |
| } | |
| } |
| func testPriceIsBeingLocalizedForGivenLocale() { | |
| let sut = Product(price: NSDecimalNumber(float: 9.99), locale: NSLocale(localeIdentifier: "de_DE")) | |
| XCTAssertEqual(sut.priceString, "9,99 €") | |
| } |
| #!/usr/bin/env ruby | |
| require 'open-uri' | |
| require 'nokogiri' | |
| def log (message) puts " #{message}" end | |
| def success (message) puts "+ #{message}" end | |
| def fail (message) puts "- #{message}" end | |
| def notify (message) | |
| success message.upcase | |
| system 'osascript -e \'Display notification "Bürgerbot" with title "%s"\'' % message |
| class ProfileViewModelTests: XCTestCase { | |
| func testDelegateNotifiedWhenProfileDeleted_Refactored() { | |
| // given | |
| let (viewModel, _, delegate) = initializedViewModel() | |
| // when | |
| viewModel.deleteProfile() | |
| // then | |
| XCTAssert(delegate.didDeleteUser) |
| class ProfileViewModelTests: XCTestCase { | |
| func testDelegateNotifiedWhenProfileDeleted() { | |
| // given | |
| let fakeClient = FakeAPIClient() | |
| let delegate = FakeDelegate() | |
| let viewModel = ProfileViewModel(apiClient: fakeClient, delegate: delegate) | |
| // when | |
| viewModel.deleteProfile() | |
| class ProfileViewModel { | |
| let apiClient: APIClientType | |
| weak var delegate: ProfileViewModelDelegate? | |
| init(apiClient: APIClientType = APIClient(), delegate: ProfileViewModelDelegate) { | |
| self.apiClient = apiClient | |
| self.delegate = delegate | |
| } | |
| func deleteProfile() { |
| # Put this into your `~/.bashrc` and `source ~/.bashrc` | |
| function expandurl { | |
| # -s Only output | |
| # -I HEAD request | |
| # -L Follow redirects. Combined with -I will print headers from all intermediate redirects | |
| REDIRECTS=$(curl -sIL $1 | grep ^Location); | |
| if [[ -z $REDIRECTS ]]; then | |
| echo "Location: ${1}"; | |
| else |