Skip to content

Instantly share code, notes, and snippets.

{
"name": "Chrome Extension React",
"version": "1.0",
"manifest_version": 2,
"browser_action": {
"default_popup": "index.html"
}
}
{
"name": "Chrome Extension React",
"version": "1.0",
"manifest_version": 2,
"browser_action": {
"default_popup": "index.html"
},
"content_security_policy": "script-src 'self' 'sha256-[YOUR_KEY_HERE]'; object-src 'self'"
}
let a = 1;
let b = 2;
let c = a + b;
console.log('c = ', c);
//Output: c = 3
a = 2;
console.log('c = ', c);
//Output: c = 3
let a = 1;
let b = 2;
let c = a + b;
console.log('c = ', c);
//Output: c = 3
a = 2;
console.log('c = ', c);
//Output: c = 4
function Click() {
this.handlers = []; // observers
}
Click.prototype = {
subscribe: (fn) => {
this.handlers.push(fn);
},
unsubscribe: (fn) => {
this.handlers = this.handlers.filter(...);
var Iterator = function(items) {
this.index = 0;
this.items = items;
}
Iterator.prototype = {
first: () => {
this.reset();
return this.next();
},
// create observable
const exampleObservable$ = new Observable((observer) => {
// observable execution
observer.next('example value 1');
observer.next('example value 2');
observer.next('example value 3’);
observer.complete();
})
const bubbleSort = (inputArr) => {
let length = inputArr.length;
for (let i = 0; i < length; i++) {
for (let j = 0; j < length; j++) {
if (inputArr[j] > inputArr[j + 1]) {
let tmp = inputArr[j];
inputArr[j] = inputArr[j + 1];
inputArr[j + 1] = tmp;
}
}
function selectionSort(array) {
for (var i = 0; i < array.length; i++) {
let min = i; // storing the index of minimum element
for (var j = i + 1; j < array.length; j++) {
if (array[min] > array[j]) {
min = j; // updating the index of minimum element
}
<!DOCTYPE html>
<html>
<head>
<title>Root application</title>
<meta name="importmap-type" content="systemjs-importmap">
<script type="systemjs-importmap">
{
"imports": {
"angular-app": "http://localhost:4201/main.js",
"react-app": "http://localhost:4202/main.js",