Skip to content

Instantly share code, notes, and snippets.

View phillipharding's full-sized avatar

Phil Harding phillipharding

View GitHub Profile
@phillipharding
phillipharding / SharePoint People Picker
Created May 31, 2014 23:29
Set the value of SharePoint People Picker Controls
(function(module,$) {
"use strict";
window.PD = window.PD || {};
PD.SP = PD.SP || {};
PD.SP.PeoplePicker = function() {
var
_module = {
Validate: ValidatePeoplePicker,
@phillipharding
phillipharding / Filter LVWP - JS - 2010
Last active August 29, 2015 14:03
Filter LVWP App 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 });
<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>
/* CLEARFIX */
.cdtm-wrapper .row:before,
.cdtm-wrapper .row:after {
content: "";
display: table;
}
.cdtm-wrapper .row:after {
clear: both;
}
(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 }),
<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>
/* CLEARFIX */
.cdtm-wrapper .row:before,
.cdtm-wrapper .row:after {
content: "";
display: table;
}
.cdtm-wrapper .row:after {
clear: both;
@phillipharding
phillipharding / EnsureListFolderTree
Last active August 29, 2015 14:04
Create Folder Tree's for SharePoint Lists and Libraries
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()
(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 August 22, 2014 15:21
Javascript module for shortening URLs using Bitly
(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;