Skip to content

Instantly share code, notes, and snippets.

View sionjlewis's full-sized avatar

Siôn J. Lewis sionjlewis

View GitHub Profile
@sionjlewis
sionjlewis / VideoPlayer.js
Last active August 29, 2015 14:27
Example of how to embedding a video within a Script Editor Webpart (SharePoint Online), using the Office 365 Video Portal REST API
var PlayVideo = function (chid, vid) {
var rootURL = window.location.protocol + "//" + window.location.host;
var siteURL = rootURL + '/portals/hub'
var wsPath = '/_api/VideoService/Channels(guid\'' + chid + '\')/Videos(guid\'' + vid + '\')?$Select=Title,Description,CreatedDate,DefaultEmbedCode,VideoDurationInSeconds,ID,VideoProcessingStatus,ThumbnailUrl';
var followAPI = siteURL + wsPath;
var getVideo = function () {
jQuery.ajax({
url: followAPI,
headers: {
@sionjlewis
sionjlewis / SpecRunner.cshtml
Created June 24, 2015 15:49
Added a SpecRunner View
<link rel="shortcut icon" type="image/png" href="/Content/jasmine/jasmine_favicon.png">
@Styles.Render("~/Content/jasmine/jasmine.css")
@Scripts.Render("~/Scripts/jasmine/jasmine.js")
@Scripts.Render("~/Scripts/jasmine/jasmine-html.js")
@Scripts.Render("~/Scripts/jasmine/boot.js")
@Scripts.Render("~/Scripts/jquery-1.10.2.js")
@Scripts.Render("~/Scripts/knockout-3.2.0.debug.js")
@Scripts.Render("~/Scripts/jasmine/jasmine.js")
@sionjlewis
sionjlewis / CQWP-UseCache.xsl
Created June 24, 2015 14:30
Client-side Development Techniques with CQWP(s) and JavaScript - Part 5/5
<property name="UseCache" type="bool">False</property>
@sionjlewis
sionjlewis / XSL-JSRenderTrap.xsl
Created June 24, 2015 14:28
Client-side Development Techniques with CQWP(s) and JavaScript - Part 4/5
<label id="lblExample-{{{{attr:ID}}}}" title="{{{{attr:Product}}}}">{{:Product}}</label>
@sionjlewis
sionjlewis / _temp.js
Created June 24, 2015 14:26
Client-side Development Techniques with CQWP(s) and JavaScript - Part 3/5
var namespace = function (ns_string, obj) {
var parts = ns_string.split('.'),
parent = window,
pl, i;
for (i = 0, pl = parts.length; i < pl; i++) {
parent = parent[parts[i]] = parent[parts[i]] || (i == pl - 1 && obj ? (typeof obj == 'function' ? (obj() || {}) : obj) : {});
}
return parent;
@sionjlewis
sionjlewis / ContentQueryMain.xsl
Created June 24, 2015 14:20
Client-side Development Techniques with CQWP(s) and JavaScript - Part 2/5
<xsl:stylesheet
version="1.0"
exclude-result-prefixes="x xsl cmswrt cbq"
xmlns:x="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cmswrt="http://schemas.microsoft.com/WebPart/v3/Publishing/runtime"
xmlns:cbq="urn:schemas-microsoft-com:ContentByQueryWebPart">
<xsl:output method="html" indent="no" media-type="text/html" omit-xml-declaration="yes"/>
<xsl:param name="cbq_isgrouping" />
<xsl:param name="cbq_columnwidth" />
@sionjlewis
sionjlewis / MyWebpart.webpart.xml
Last active October 20, 2020 02:23
Client-side Development Techniques with CQWP(s) and JavaScript - Part 1/5
<webParts>​​
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.Publish​​ing.WebControls.ContentByQueryWebPart, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="GroupBy" type="string" />
<property name="FilterValue2" type="string" />
@sionjlewis
sionjlewis / SharePoint disabling or enabling devices and browsers
Created June 17, 2015 16:26
SharePoint On-Premises: For a more granular approach to disabling/enabling devices and browsers, edit the App_Browsers\compat.browser changing the following to "false" for the relevant userAgent:
<capability name="isMobileDevice" value="true" />
@sionjlewis
sionjlewis / SharePoint Disable For All Mobile Devices
Last active August 29, 2015 14:23
SharePoint On-Premises: The quickest way for all mobile devices and browsers add the following to the web applications web.config file.
<browserCaps>
<result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<filter>isMobileDevice=false</filter>
</browserCaps>