Skip to content

Instantly share code, notes, and snippets.

@samperrow
samperrow / preload-code.html
Last active March 25, 2018 07:46
preload code
<link rel="preload" href="https://fonts.googleapis.com/css?family=Merriweather" as="font" crossorigin>
<link rel="preload" href="https://www.youtube.com/embed/kkwiQmGWK4c" as="document">
<link rel="preload" href="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js" as="script">
<link rel="dns-prefetch" href="https://www.youtube.com">
<link rel="dns-prefetch" href="https://static.jsbin.com">
<link rel="dns-prefetch" href="https://s.ytimg.com">
<link rel="dns-prefetch" href="https://i.ytimg.com">
<link rel="dns-prefetch" href="https://fonts.gstatic.com">
<link rel="dns-prefetch" href="https://static.doubleclick.net">
<link rel="dns-prefetch" href="https://www.google.com">
<link rel="dns-prefetch" href="https://googleads.g.doubleclick.net">
<link rel="dns-prefetch" href="https://stats.g.doubleclick.net">
<link rel="dns-prefetch" href="https://www.google-analytics.com">
<link rel="prerender" href="https://www.youtube.com">
<link rel="preconnect" href="https://www.youtube.com">
<link rel="preconnect" href="https://static.jsbin.com">
<link rel="preconnect" href="https://s.ytimg.com">
<link rel="preconnect" href="https://i.ytimg.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preconnect" href="https://static.doubleclick.net">
<link rel="preconnect" href="https://www.google.com">
<link rel="preconnect" href="https://googleads.g.doubleclick.net">
<link rel="preconnect" href="https://stats.g.doubleclick.net">
<link rel="preconnect" href="https://www.google-analytics.com">
@samperrow
samperrow / js-autoloader.js
Last active March 16, 2019 16:30
This script will load multiple JS files dynamically without jQuery
ExecuteOrDelayUntilScriptLoaded(loadJS, 'sp.js');
function loadJS() {
var index = 0;
var site = document.location.href;
var resources = [];
function createResource(type, location, url, code) {
var obj = document.createElement(type);
@samperrow
samperrow / Format default UTC datetimes
Last active June 19, 2018 22:29
Replaces the default UTC datetime stamps on SharePoint display forms with formatted datetimes.
<xsl:value-of select="ddwrt:FormatDateTime(string(@EventDate),1037, 'yyyy-MM-dd hh:mm:ss')"/>
@samperrow
samperrow / original XSL markup for datetime
Created June 19, 2018 22:11
Original XSL markup for UTC datetime
<xsl:value-of select=@EventDate/>
// get recurring calendar events
var events = []; // this is the global variable I am using to store the events data.
function getCalendarEvents(listName, asyn) {
// set up the CAML query. returns single and recurring events by default, unless otherwise specified.
var camlQuery = "<query>" +
"<Query>" +
"<Where>" +
@samperrow
samperrow / getAllEvents.js
Created July 4, 2018 21:16
Collects all events (single and recurring) from a SharePoint calendar list.
// get recurring calendar events
var events = []; // this is the global variable I am using to store the events data.
function getCalendarEvents(listName, async) {
// set up the CAML query. returns single and recurring events by default, unless otherwise specified.
var camlQuery = "<query>" +
"<Query>" +
"<Where>" +
@samperrow
samperrow / spcalendarpro.js
Last active April 8, 2019 23:06
SP Calendar Pro- An ultra lightweight, dependency-free JavaScript library to easily manage SharePoint calendar events.
/*
* @name SPCalendarPro
* Version 1.3.2
* No dependencies!
* @description An ultra lightweight JavaScript library to easily manage SharePoint calendar events.
* @documentation https://sharepointhacks.com/sp-calendar-pro
* @author Sam Perrow sam.perrow399@gmail.com
*
* Copyright 2018 Sam Perrow (email : sam.perrow399@gmail.com)
* Licensed under the MIT license: