Skip to content

Instantly share code, notes, and snippets.

View trojanh's full-sized avatar

Rajan Tiwari trojanh

  • Mumbai
View GitHub Profile
@joranquinten
joranquinten / generate-sitemap.js
Created January 22, 2019 14:03
Generate sitemap XML for NextJs static sites based on exportPathMap
/*
Generates a sitemap based on the entries in exportPathMap in next.config.js file
Author: Joran Quinten
Don't forget to add the domain name as process variable PUBLIC_DOMAIN!
Trigger the file with a separate script in your package.json and add it to your build command in Netlify
(for instance, set Build command to: "npm run production && npm run postexport")
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@christopherscott
christopherscott / ExcelToJsDate.js
Created May 24, 2012 16:40
Convert Excel date values to JavaScript date objects
// Convert Excel dates into JS date objects
//
// @param excelDate {Number}
// @return {Date}
function getJsDateFromExcel(excelDate) {
// JavaScript dates can be constructed by passing milliseconds
// since the Unix epoch (January 1, 1970) example: new Date(12312512312);