Skip to content

Instantly share code, notes, and snippets.

Avatar

Phil Harding phillipharding

View GitHub Profile
@phillipharding
phillipharding / SharePoint People Picker
Created May 31, 2014
Set the value of SharePoint People Picker Controls
View SharePoint People Picker
(function(module,$) {
"use strict";
window.PD = window.PD || {};
PD.SP = PD.SP || {};
PD.SP.PeoplePicker = function() {
var
_module = {
Validate: ValidatePeoplePicker,
View Filter LVWP - HTML - 2010
<link rel="stylesheet" type="text/css" href="../SiteAssets/sgm-meetings/css/fontello.css" runat="server" />
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="../SiteAssets/sgm-meetings/css/fontello-ie7.css" runat="server" />
<![endif]-->
<!-- Lib CSS -->
<link rel="stylesheet" type="text/css" href="../SiteAssets/sgm-meetings/css/cdtm-main.css" runat="server" />
<!-- Lib JS -->
<script type="text/javascript" src="../SiteAssets/sgm-meetings/scripts/knockout-3.1.0.js"></script>
View Filter LVWP - CSS - 2010
/* CLEARFIX */
.cdtm-wrapper .row:before,
.cdtm-wrapper .row:after {
content: "";
display: table;
}
.cdtm-wrapper .row:after {
clear: both;
}
View Filter LVWP - JS - 2010
(function(module,$) {
"use strict";
window.pd = window.pd || {};
pd.MeetingsViewModel = function() {
/* observable state */
this.FilterTextIm = ko.observable('');
this.FilterText = ko.computed(this.FilterTextIm)
.extend({ throttle: 400 });
View Filter LVWP - JS - 2013
(function(module,$) {
"use strict";
window.pd = window.pd || {};
pd.FilterLibraryViewModel = function() {
/* observable state */
this.FilterTextIm = ko.observable(''),
this.FilterText = ko.computed(this.FilterTextIm)
.extend({ throttle: 400 }),
View Filter LVWP - HTML - 2013
<link rel="stylesheet" type="text/css" href="../SiteAssets/sgm-meetings/css/fontello.css" runat="server" />
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="../SiteAssets/sgm-meetings/css/fontello-ie7.css" runat="server" />
<![endif]-->
<!-- App CSS -->
<link rel="stylesheet" type="text/css" href="../SiteAssets/sgm-meetings/css/cdtm-main.css" runat="server" />
<!-- Lib JS -->
<script type="text/javascript" src="../SiteAssets/sgm-meetings/scripts/knockout-3.1.0.js"></script>
View Filter LVWP - CSS - 2013
/* CLEARFIX */
.cdtm-wrapper .row:before,
.cdtm-wrapper .row:after {
content: "";
display: table;
}
.cdtm-wrapper .row:after {
clear: both;
@phillipharding
phillipharding / EnsureListFolderTree
Last active Aug 29, 2015
Create Folder Tree's for SharePoint Lists and Libraries
View EnsureListFolderTree
function EnsureListFolderTree($web, $list, $folderName) {
$curl = $list.RootFolder.ServerRelativeUrl
$folders = $folderName.Replace("^/+","").Split("/")
ForEach($fn in $folders) {
$furl = $curl + "/" + $fn
$f = $web.GetFolder($furl)
if ($f.Exists -eq $false) {
$f = $list.AddItem($curl, [Microsoft.SharePoint.SPFileSystemObjectType]::Folder, $fn)
$f.Update()
View CheckSPWebResource
(function($) {
"use strict";
function checkSPWebResource(url, async) {
var
endpoint = url.match(/^http[s]?:\/\//i) || url.match("^"+_spPageContextInfo.webServerRelativeUrl)
? url
: _spPageContextInfo.webServerRelativeUrl.replace(/\/$/g,'')
+ '/' + url.replace(/^\//g,''),
p = $.Deferred();
@phillipharding
phillipharding / pdogs-urlshortener-bitly.js
Created Aug 22, 2014
Javascript module for shortening URLs using Bitly
View pdogs-urlshortener-bitly.js
(function($,window) {
"use strict";
window.pdogs = window.pdogs || {};
pdogs.urlshortener = function() {
var
_bitlyAccessToken = '<YOUR BITLY ACCESS_TOKEN HERE>',
_bitlyShortDomain = 'j.mp',
_module = { shorten: shorten };
return _module;