Skip to content

Instantly share code, notes, and snippets.

View dileephell's full-sized avatar
🎯
Focusing

Dileep Singh dileephell

🎯
Focusing
View GitHub Profile
@dileephell
dileephell / async.js
Created July 24, 2018 08:15 — forked from bschwartz757/async.js
Async/await function to fetch data from multiple URLs in parallel
/* Client side, works in Chrome 55 and Firefox 52 without transpilation */
//https://blogs.msdn.microsoft.com/typescript/2016/11/08/typescript-2-1-rc-better-inference-async-functions-and-more/
async function fetchURLs() {
try {
// Promise.all() lets us coalesce multiple promises into a single super-promise
var data = await Promise.all([
/* Alternatively store each in an array */
// var [x, y, z] = await Promise.all([
// parse results as json; fetch data response has several reader methods available:
//.arrayBuffer()
app.post('/upload', function (req, res) {
console.log("Context path1=" + __dirname);
var busboy = new Busboy({ headers: req.headers });
busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
console.log("Context path=" + __dirname);
var saveTo = path.join(__dirname +"/uploads" ,filename);
console.log("inside upload get request111111::: "+filename);
console.log('Uploading: ' + saveTo);
file.pipe(fs.createWriteStream(saveTo));
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" media="all" href="index.css">
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<link rel="stylesheet" href="popupS.css">
<script src="popupS.js"></script>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
@dileephell
dileephell / app.js
Created May 16, 2018 06:31
index of bot
var express = require('express');
var app = express();
var path = require('path');
var Busboy = require('busboy');
//require('./chatflow.js').DataTable;
var chatFlow=require('./chatflow.js');
const fs = require('fs');
const request = require('request');
const url = require('url');
const https = require('https');
var express = require('express');
var app = express();
var path = require('path');
//require('./chatflow.js').DataTable;
var chatFlow=require('./chatflow.js');
const fs = require('fs');
const request = require('request');
const url = require('url');
const https = require('https');
function getNextMsgId(intent) {
console.log("Inside getNextMsgId method " + prevMsg );
for (var c in chatFlow.DataTableArray) {
console.log("1: "+String(chatFlow.DataTableArray[0][1])+" 2: "+String(prevMsg));
if (String(prevMsg) in String(chatFlow.DataTableArray.indexOf([0][1]) !== 1)) {
console.log("Inside For In Loop " + prevMsg );
console.log("Inside For In Loop" + chatFlow.DataTableArray.indexOf([0][1]));
console.log("Inside For In Loop" + chatFlow.DataTableArray[2]);
chatFlow.DataTableArray[0][4]=msg;
@dileephell
dileephell / index.html
Created April 18, 2018 13:03
index.html
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" media="all" href="index.css">
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
</head>
@dileephell
dileephell / app.js
Last active April 18, 2018 13:02
app.js
var express = require('express');
var app = express();
var path = require('path');
require('./chatflow.js').DataTable;
var path = require("path");
const fs = require('fs');
const request = require('request');
@dileephell
dileephell / chatflow.js
Last active April 18, 2018 11:20
chatflow.js
var DataTable = {
source: [],
setEntry: function(i,j,e) {
var o ;
if( !!! ( o = this.source[i] ) ) o = this.source[i] = [] ;
o[j] = e ;
return this ;
},
getEntry: function(i,j) {
var o, e = null ;
@dileephell
dileephell / wirt.js
Last active April 16, 2018 16:06
wit
var express = require('express');
var app = express();
var path = require('path');
var chatflow = require('./chatflow.js');
const fs = require('fs');
const request = require('request');
const url = require('url');