How to create an anchor and redirect to this specific anchor in Ruby on Rails

Actually, anchor is an option for the path, not for the link_to <%= link_to ‘#’, post_path(comment.post, :anchor => “comment_#{comment.id}”) %> http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#M001565 link_to “Comment wall”, profile_path(@profile, :anchor => “wall”) # => <a href=”http://stackoverflow.com/profiles/1#wall”>Comment wall</a>

Google Apps Script to open a URL

This function opens a URL without requiring additional user interaction. /** * Open a URL in a new tab. */ function openUrl( url ){ var html = HtmlService.createHtmlOutput(‘<html><script>’ +’window.close = function(){window.setTimeout(function(){google.script.host.close()},9)};’ +’var a = document.createElement(“a”); a.href=”‘+url+'”; a.target=”_blank”;’ +’if(document.createEvent){‘ +’ var event=document.createEvent(“MouseEvents”);’ +’ if(navigator.userAgent.toLowerCase().indexOf(“firefox”)>-1){window.document.body.append(a)}’ +’ event.initEvent(“click”,true,true); a.dispatchEvent(event);’ +’}else{ a.click() }’ +’close();’ +'</script>’ // Offer URL as … Read more

When should I use rel=noreferrer?

In short, the noreferrer link type hides referrer information when the link is clicked. A link with the noreferrer link type looks something like this: <a href=”http://www.example.com” rel=”noreferrer”>Click here for more info</a> If someone arrives at your site from a link that uses this link type, your analytics won’t show who refered that link. Instead, … Read more

C# regex pattern to extract urls from given string – not full html urls but bare links as well

You can write some pretty simple regular expressions to handle this, or go via more traditional string splitting + LINQ methodology. Regex var linkParser = new Regex(@”\b(?:https?://|www\.)\S+\b”, RegexOptions.Compiled | RegexOptions.IgnoreCase); var rawString = “house home go www.monstermmorpg.com nice hospital http://www.monstermmorpg.com this is incorrect url http://www.monstermmorpg.commerged continue”; foreach(Match m in linkParser.Matches(rawString)) MessageBox.Show(m.Value); Explanation Pattern: \b -matches … Read more

HTML: How to get my subpages listed on a google search

Those are called “sitelinks” and are automated but you can partially configure them in Google’s webmaster’s tools. In webmaster’s tools, click “sitelinks” in the navigation menu on the left. From the sitelinks page: Sitelinks are links to a site’s interior pages. Not all sites have sitelinks. Google generates these links automatically, but you can remove … Read more

What is the RTF syntax for a hyperlink?

The equivalent of the following HTML: <a href=”https://www.google.com”>Google</a> for an RTF file is: {\field{\*\fldinst HYPERLINK “http://www.google.com/”}{\fldrslt Google}} which results in a link: Google but without additional style information, will appear unformatted: Google

Facebook share link – can you customize the message body text?

NOTE: @azure_ardee solution is no longer feasible. Facebook will not allow developers pre-fill messages. Developers may customize the story by providing OG meta tags, but it’s up to the user to fill the message. This is only possible if you are posting on the user’s behalf, which requires the user authorizing your application with the … Read more

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