Skip to content

Instantly share code, notes, and snippets.

View codesorter2015's full-sized avatar
🏠
Working from home

Krish codesorter2015

🏠
Working from home
View GitHub Profile
@codesorter2015
codesorter2015 / escaopeHTMLTag.js
Created April 11, 2018 10:18 — forked from Rob--W/escaopeHTMLTag.js
Example of safe HTML escaping using template literals
/* Example:
var someUnsafeStr = '<img>';
var result = escapeHTMLTag`<input value="${someUnsafeStr}">`;
console.log(result); // <input value="&lt;img&gt;">
// Questions? rob {at} robwu.nl
// */
function escapeHTML(str) {
// Note: string cast using String; may throw if `str` is non-serializable, e.g. a Symbol.
@codesorter2015
codesorter2015 / background.js
Created April 11, 2018 10:16 — forked from Rob--W/background.js
Implementation example of writable response bodies for Chromium extensions (API draft).
/**
* Implementation example of writable response bodies.
* Based on the draft of the Streams API (19 March 2014)
* https://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm
* Design document for response body reading/writing:
* https://docs.google.com/document/d/1iE6M-YSmPtMOsec7pR-ILWveQie8JQQXTm15JKEcUT8
*/
/* globals chrome, ByteStream, URL, XMLHttpRequest */
'use strict';
@codesorter2015
codesorter2015 / README.md
Last active July 22, 2019 11:32 — forked from yckart/LICENSE.txt
getElementByXPath | Get DOM-Nodes by its XPath.