Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Finally learning python writing my first rule engine!

Krishna Prasad C KPChakravarthy

💭
Finally learning python writing my first rule engine!
  • CognitiveClouds
  • Bangalore
View GitHub Profile
@KPChakravarthy
KPChakravarthy / htmldiff.js
Created Aug 10, 2020
Diff between 2 HTML documents
View htmldiff.js
var Match,
calculate_operations,
consecutive_where,
create_index,
diff,
find_match,
find_matching_blocks,
html_to_tokens,
is_end_of_tag,
is_start_of_tag,
View manifest.json
{
...
"permissions": [
...
"activeTab"
...
]
...
}
View background.js
function sendFile() {
var x = new XMLHttpRequest();
x.open("GET", blobURL);
x.responseType = "blob";
x.onload = function () {
var url = URL.createObjectURL(x.response);
localStorage.setItem("fileToProcess", url);
window.onload = function () {
document.getElementById("fetchImageFromBlob").click();
};
View background.js
chrome.tabs.create(
{
url: url,
},
(tab) => {
chrome.tabs.executeScript(
tab.id,
{
code: `var blobURL = "${blobURL}"; console.log("1:::")`,
},
View background.js
function selectFile(event) {
let blobURL = window.URL.createObjectURL(event.target.files[0])
// Do what you will with the blob
};
View angular.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@KPChakravarthy
KPChakravarthy / excelFileRead.js
Last active Aug 23, 2019
NodeJS Postgresql Bulk upsert.
View excelFileRead.js
// import XlsxStreamReader - it is an npm package ==== https://www.npmjs.com/package/xlsx-stream-reader
function readXlsx(file, headers) {
return new Promise((resolve, reject) => {
let resp_row = [];
var workBookReader = new XlsxStreamReader();
workBookReader.on('error', function (error) {
throw error;
});
workBookReader.on('sharedStrings', function () {
@KPChakravarthy
KPChakravarthy / chat.component.ts
Last active Nov 9, 2020
Angular 7 + Firebase Support Chat Snippets
View chat.component.ts
import { Component, OnInit } from '@angular/core';
import { ChatService } from './chat.service';
@Component({
selector: 'app-chat',
templateUrl: './chat.component.html',
styleUrls: ['./chat.component.scss']
})
export class ChatComponent implements OnInit {
messagesList: any;