Works in Chrome, but breaks in Safari: Invalid regular expression: invalid group specifier name /(?

Looks like Safari doesn’t support lookbehind yet (that is, your (?<=\/)). One alternative would be to put the / that comes before in a non-captured group, and then extract only the first group (the content after the / and before the #). /(?:\/)([^#]+)(?=#*)/ Also, (?=#*) is odd – you probably want to lookahead for something … Read more

removeEventListener on anonymous functions in JavaScript

if you are inside the actual function, you can use arguments.callee as a reference to the function. as in: button.addEventListener(‘click’, function() { ///this will execute only once alert(‘only once!’); this.removeEventListener(‘click’, arguments.callee); }); EDIT: This will not work if you are working in strict mode (“use strict”;)

Swift Open Link in Safari

It’s not “baked in to Swift”, but you can use standard UIKit methods to do it. Take a look at UIApplication’s openUrl(_:) (deprecated) and open(_:options:completionHandler:). Swift 4 + Swift 5 (iOS 10 and above) guard let url = URL(string: “https://stackoverflow.com”) else { return } UIApplication.shared.open(url) Swift 3 (iOS 9 and below) guard let url = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)