Skip to content

Instantly share code, notes, and snippets.

@vaderj
vaderj / cheatsheet
Last active February 27, 2020 16:17
#node.js #npm cheatsheet NPM & Node.js cheatsheet
#If NPM is throwing errors about permissions issues:
npm config set unsafe-perm=true
# error : "Error: EPERM: operation not permitted, rename" ... includes cache clear twice
npm cache clean --force
npm install -g npm@latest --force
npm cache clean --force
@vaderj
vaderj / cheatsheet
Last active February 25, 2020 22:19
#git Cheat sheet and troubleshooting git
From the root of your project folder
1.) git init
2.) git add .
3.) git commit -m "initial commit"
(the next two are from DevOps once the Repo has been established)
4.) git remote add origin https://tenant@dev.azure.com/tenant/ProjectName/_git/ProjectName
5.) git push -u origin –all
To update the repo from your local project :
@vaderj
vaderj / reg-ex.notepad++.txt
Last active February 27, 2020 19:05
#regEx #notepad++ RegEx's that work with Notepad++
Select everything before the occurance: ^(.*?)\
Usage: (find and replace everything before and including "VM911.1") : ^(.*?)\VM911:1
@vaderj
vaderj / disableCalendarDblClick.js
Created June 27, 2018 16:20
Disable the double click event listeners for the SharePoint calendar (that creates a new item) #Javascript #SharePoint
//Disable the dblclick event listener which creates a new item on the calendar
ExecuteOrDelayUntilScriptLoaded(MyCalendarHook,'SP.UI.ApplicationPages.Calendar.js');
function MyCalendarHook(){
var calendarCreate = SP.UI.ApplicationPages.CalendarContainerFactory.create;
SP.UI.ApplicationPages.CalendarContainerFactory.create = function (elem,cctx,viewType,date,startupData) {
cctx.canUserCreateItem = false;
calendarCreate(elem, cctx, viewType, date, startupData);
}
}
@vaderj
vaderj / ShowListViewRibbon.js
Last active June 27, 2018 16:15
Show list view ribbon #Javascript #SharePoint
//Expose the ribbon : http://spjsblog.com/2012/01/12/bring-back-the-missing-list-tools-menu-in-list-view-with-multiple-webparts/
ExecuteOrDelayUntilScriptLoaded(init_defaultWP, "sp.ribbon.js");
function init_defaultWP(){
setTimeout(function(){
var defaultWP = document.getElementById("MSOZoneCell_WebPartWPQ2");
WpClick({target:defaultWP,srcElement:defaultWP});
},100);
hideRibbonPieces() ;
}
@vaderj
vaderj / map.geojson
Last active June 12, 2018 15:10
Georgia #GeoJSON
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am vaderj on github.
  • I am vaderj (https://keybase.io/vaderj) on keybase.
  • I have a public key ASBDqarioFjE6M8HrTY5OmnD_rFDFV7VWgc6p3t-HGuUsgo

To claim this, I am signing this object:

@vaderj
vaderj / get-SPlibrarySize.ps1
Last active June 12, 2018 15:11
Powershell - Get size of SharePoint document libray #PowerShell #SharePoint
Add-PSSnapin Microsoft.SharePoint.PowerShell
$siteURL = "YourSitename"
$site = new-object Microsoft.SharePoint.SPSite($siteURL)
foreach ($web in $site.AllWebs)
{
foreach ($list in $web.Lists)
{
@vaderj
vaderj / Drews dumb DIRLog.js
Last active June 12, 2018 15:03
SP REST - create new list / add columns / create new view & add columns & query #Javascript #SharePoint #ListTemplate
/*
DIRLog template:
Column Name |Column Type| Required?
Title | SLT | True #
@vaderj
vaderj / groupBy_array-of-properties.js
Last active June 12, 2018 15:12
GroupBy property value within an array #Javascript
//src: https://www.consolelog.io/group-by-in-javascript
Array.prototype.groupBy = function(prop) {
return this.reduce(function(groups, item) {
var val = item[prop];
groups[val] = groups[val] || [];
groups[val].push(item);
return groups;
}, {});
}