Regex help for Page monitor - regex

I want to check for the particular text below in a webpage
<img class="highlights" src="http://www.carsportal.com/images/highlights/green.jpg">
Using this regex for doing so,
<img class="highlights" src="[^]*green.jpg">
I am trying to monitoring the changes on this webpage using Page Monitor(Chrome extension). I tested it here.
But its not working on this extension.

Somethings like this:
<img class="highlights" src="[^\"]*green\.jpg">

Related

How can I make gifs show up on Github Pages posts?

I've found that I can make a gif show up on the README.md page like so:
![gif](https://github.com/jss367/antools/blob/gh-pages-2.3.4/assets/images/cat.gif)
or like so:
<img src='https://github.com/jss367/antools/blob/gh-pages-2.3.4/assets/images/cat.gif' />
However, those same lines of code don't work when I add them to a blog post. Do I need to add something to the layout? Or is it turned off in Github Pages?
I've found that they show up on the blog post when the gif is hosted on gifs.com but not when hosted on Github. For example, this works:
<iframe src='//gifs.com/embed/k8A5jN' frameborder='0' scrolling='no' width='1280px' height='720px' style='-webkit-backface-visibility: hidden;-webkit-transform: scale(1);' ></iframe>
but this doesn't:
<iframe src='https://github.com/jss367/antools/blob/gh-pages-2.3.4/assets/images/cat.gif' frameborder='0' scrolling='no' width='1280px' height='720px' style='-webkit-backface-visibility: hidden;-webkit-transform: scale(1);' ></iframe>
I'd like to host it directly on github.com.
Your link goes to a webpage. Use a direct link or proper directory
Try this:
<img src='https://github.com/jss367/antools/blob/gh-pages-2.3.4/assets/images/cat.gif?raw=true' />

Cannot link to static files with Hugo

I have this in config.toml:
baseURL = "https://my-username.github.io/blog/"
and there is a static file at static/img/foo.png.
Now, in content/posts/bar.md, I have the following content:
---
title: "Bar"
---
![foo](img/foo.png)
The picture isn't showing after I started the hugo server, so I inspected elements, and found out that Hugo generated the following URL for it:
http://localhost:1313/blog/posts/bar/img/hireme.png
This is not what I expect; it should be
http://localhost:1313/blog/img/hireme.png
When I use ![foo](/blog/img/foo.png), the picture is displayed correctly, but this is quite strange: /blog/ is part of baseURL, why do I need to type it again?
I think you should use <base> tag to make baseURL for static files.
Add the <base> tag into <head>:
<base href="{{ .Site.BaseURL }}">
And then you can insert image in post like this:
![Foo image](img/foo.jpg)
References:
https://www.w3schools.com/tags/tag_base.asp
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
In a simple setup where your site lives in the domain's root, a absolute reference to the image would be a standard practice. However, in your case where the site is nested, a more crafty solution is necessary.
I suggest using a shortcode to solve your dilemma. Just simply create a shortcode that takes in a resource file path and spits out the desired absolute path every time. The advantage to this approach is flexibility for future resource relocation to a cdn for example.
Your markdown code will be something like this:
![foo]({{< resource url="img/foo.png" >}})
Your shortcode template will be something like this:
{{ .Site.BaseURL }}{{ .Get "url" }}
Create a file named 'resource.html' in 'layouts/shortcodes/' folder, and drop in the shortcode template code above.
So when you decide you want to switch to a cdn you could easily do this:
://cdn.example.com/{{ .Get "url" }}

display static html asset in jekyll + github pages

I want to add a link to a static html page (which I have created, not hosted anywhere). I added the html file to my images folder (contains the images which are being rendered in my jekyll blog). Then I make a hyperlink to the html files which I just added in the images folder, like this:
<a href=https://raw.githubusercontent.com/USERNAME/USERNAME.github.io/master/images/time.vs.score.html>View plots here</a>
Where username is my github username. This does not open a new html page, instead I just see the plain text of the html file. How can I add static html files are part of the assets? Thanks!
Thats what raw.githubusercontent.com is made returning raw file.Files are returned with Content-Type:text/plain; and then displayed as text by your browser.
You'd better link to github pages published content at https://USERNAME.github.io/images/time.vs.score.html
I found an easy solution using this tool: https://rawgit.com/
just replace:
<a href=https://raw.githubusercontent.com/USERNAME/USERNAME.github.io/master/images/time.vs.score.html>View plots here</a>
with:
<a href=https://cdn.rawgit.com/USERNAME/USERNAME.github.io/master/images/time.vs.score.html>View plots here</a>

Sitecore - setting background-image a div to a CMS value

I've been try to add the background image of a div to a value from Sitecore (8.0) in C# MVC using the code
<div style="background-image: url({Model.MyImage.Src})>
Where MyImage is of type Image as returned by GlassView
This is returning html such as
<div style="background-image: url(/~/media/myFolders/myImage.ashx)">
This image isnt being displayed when the page is rendered- although the url resolves when entered into the browser's address bar so it must be an issue with the .ashx extension as a background image for a div.
I also tried using Sitecore.Resources.Media.MediaManager.GetMediaUrl(mediaItem) but this also returned me the ashx which couldn't be resolved!
Try background-image: url('#Model.Image.Src'). While your example doesn't show it, you most likely have spaces in your folder or file name, which requires single or double quotes.
Add single quotes around it.
url('{Model.MyImage.Src}')
Should make this
url('/~/media/myFolders/myImage.ashx')
for my case sitecore 8.2 stop working below code because of style attribute
I have replaced style attribute with img tag and start working
<span><img src="#item.GetImageUrl("MyImage")" alt="" class="icon" /></span>

Extract all Images from HTML whose width or height higher than a specified value - Regex

I'm trying to make a small link share function with Classic ASP like LinkedIn or Facebook.
What I need to do is to get HTML of remote URL and extract all the images whose width are greater than 50px for example.
I can crawl and take the HTML and also I can find the images with this regex:
<img([^<>+]*)>
It matches; <img src="/images/icon.jpg" width="60" height="90" style="display:none"/>
Then I'm able to extract the path but sometimes it matches <img src="/track.php" style="display:none" width="1" height="1"/> which is not a real image.
Anyway, I feel like you are gonna be mad because of classic ASP but my company ....
I know there are lots of topics about this issue and mostly, they recommend not to USE regex but I couldn't find a way to this with classic asp. Is there a component or something to this?
Regards
This will get you close:
<img [^>]*width="(0?[1-9]\d{2,}|[5-9]\d)"[^>]*>
It accepts image tags with a width of 50 or greater.
Edit: tags with unspecified widths:
<img [^>]*width="(0?[1-9]\d{2,}|[5-9]\d)"[^>]*>|<img ((?!width=)[^>])*>