Skip to content

Instantly share code, notes, and snippets.

😴
Procrastinating

Foram Sojitra FSojitra

😴
Procrastinating
Block or report user

Report or block FSojitra

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View moment.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
setInterval(function(){
var divUtc = $('#divUTC');
View convert_file_htmltopdf.js
var express = require('express');
var fs = require('fs');
var pdf = require('html-pdf');
var app = express();
app.get('/',function(req, res){
var html = fs.readFileSync('./test/test.html', 'utf8');
var options = { format: 'Letter' };
pdf.create(html, options).toFile('./test.pdf', function(err, resp) {
View api_call_throuh_request.js
var express = require("express");
var app = express();
var request = require('request');
var options = {
//url:'https://jsonplaceholder.typicode.com/comments',
url:'http://date.jsontest.com/?service='+'ip',
method: 'get',
//path:'/comments',
headers: {
@FSojitra
FSojitra / faker.js
Created Nov 21, 2017
Using Faker.js to add or display fake data into your web app or you can use it if you don't have Database but you want data to display in web app.
View faker.js
//you have to install two dependency "npm install express" and "npm install faker"
var express = require('express');
var faker = require('faker');
var app = express();
app.get('/', function(req, res){
//res.render('index.ejs');
res.json({
@FSojitra
FSojitra / index.ejs
Last active Nov 20, 2017
code to upload file to the server with extension using express.js and multer
View index.ejs
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form method="post" enctype="multipart/form-data"><input type="text" name="a">
<input id="file" type="file" name="photo" />
<button type="submit">test</button>
You can’t perform that action at this time.