Author: sutrus
Date: Thu 17. Mar 2022 9:45:04
Category: Prism JS syntax highlighter

Views: 65
Comments: 0

Next Test Prism JS syntax highlighter

Description: Test Prism JS syntax highlighter

Link to article (bb-code [URL]): Copy

[url=https://phpbb4.spssoftware.cz/knowledgebase/article?k=6]Next Test Prism JS syntax highlighter[/url]

Direct link: Copy

https://phpbb4.spssoftware.cz/knowledgebase/article?k=6

Code: Select all

<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Testing prism-js!</title>
</head>
<body>
  <h1>Yay!</h1>
  <script>
    var foo = 5;

    for (var i=0; i < foo; i++) {
      console.log('Iteration '+i);
    }
  </script>
</body>
</html>

Code: Select all

.line-highlight {
    position: absolute;
    left: 0;
    right: 0;
    padding: inherit 0;
    margin-top: 1em; /* Same as .prism’s padding-top */

    background: hsla(24, 20%, 50%,.08);
    background: -moz-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
    background: -webkit-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
    background: -o-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
    background: linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));

    pointer-events: none;

    line-height: inherit;
    white-space: pre;
}

Code: Select all

(function() {
	'use strict';
	document.body.addEventListener('click', copy, true);
	function copy(e) {
		var
			navClipboard = navigator.clipboard,
			t = e.target,
			c = t.dataset.copytarget,
			inp = (c ? document.querySelector(c) : null);
		if (inp && inp.select)
		{
			try
			{
				inp.select();
				if (!navClipboard)
				{
					// old method deprecated
					document.execCommand('copy');
				} else
				{
					// New method works only https
					navClipboard.writeText(inp.defaultValue);
				 }
				inp.blur();
				t.classList.add('copied');
				setTimeout(function() {
					t.classList.remove('copied'); }, 1500);
			 }
			 catch (err)
			 {
				alert('please press Ctrl/Cmd+C to copy');
			 }
		}
	}
})();

Code: Select all

myObj = {
  "name":"John",
  "age":30,
  "cars": {
    "car1":"Ford",
  }
 }
 

Code: Select all

def getRemoteFolders():
    # Get all 1-Wire remote folders
    fname =local + "remotes"
    file = open(fname)
    folders = file.read().splitlines()
    file.close()
    return folders

Code: Select all

# Create a ~/.gitignore in your user directory
cd ~/
touch .gitignore

# Exclude bin and .metadata directories
echo "bin" >> .gitignore
echo "*~" >> .gitignore
echo ".DS_Store" >> .gitignore

# Use this file as global .gitignore

git config --global core.excludesfile ~/.gitignore