Skip to content

Instantly share code, notes, and snippets.

View sumansaurabh001's full-sized avatar
🎯
Focusing

Suman Saurabh sumansaurabh001

🎯
Focusing
  • India
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is based on the javascript.lang file of GtkSourceView.
It has additional Typescript keywords defined.
Author: Johannes Bergmann
Copyright (C) 2014 Johannes Bergmann
###
const multer = require('multer');
const storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, './uploads/')
},
filename: function (req, file, cb) {
cb(null, new Date().toISOString() + '-' + file.originalname)
}
})
@sumansaurabh001
sumansaurabh001 / asyncloops.js
Created December 11, 2019 06:48 — forked from lukehoban/asyncloops.js
Async/await and parallel loops
// ES6 w/ Promises
// Note: From a React starter template - see https://t.co/wkStq8y3I5
function fetchData(routes, params) {
let data = {};
return Promise.all(routes
.filter(route => route.handler.fetchData)
.map(route => {
return route.handler.fetchData(params).then(resp => {
data[route.name] = resp;
@sumansaurabh001
sumansaurabh001 / sql_cheatsheet2.php
Created November 12, 2019 05:17 — forked from sumanssaurabh/sql_cheatsheet2.php
mysql php crud cheatsheet
<?php
require 'db_config.php';
/**
* <?php
* $servername = "127.0.0.1";
* $username = "root";
* $password = "";
* $dbname = "myDB";
* ?>
@sumansaurabh001
sumansaurabh001 / readme.md
Created November 12, 2019 05:11 — forked from ionurboz/readme.md
Vanilla JS equivalents of jQuery methods

jQuery vs. JavaScript

Events

// jQuery
$(document).ready(function() {
  // code
})
import axios from 'axios'
import Cookies from 'js-cookie'
const setAuthHeader = () => {
const token = Cookies.getJSON('jwt');
if (token) {
return { headers: {'authorization': `Bearer ${token}`}};
}