Skip to content

Instantly share code, notes, and snippets.

Avatar

Ali Robertson alirobe

View GitHub Profile
@alirobe
alirobe / gist:d5ad4cd9f3c0eed1dc27
Created Jul 2, 2015
SharePoint 2013 Related Pages
View gist:d5ad4cd9f3c0eed1dc27
// shows related pages in SharePoint 2013 or Office 365
// via https://gist.github.com/chrisobriensp/4375519
// requires (minified under 10k): underscorejs, es6-promise (ES6 polyfill), fetch (ES6 polyfill)
function(element, title, count) {
var header = '<b>'+title+'</b><br/>';
var _linkTmpl = _.template('<a href="<%=Cells.results[6].Value%>"><%=Cells.results[3].Value%></a>');
var linkJoin = '<br/>';
var linkCount = count;
@alirobe
alirobe / sp2010 full breadcrumb.aspx
Created Oct 14, 2011
Full SP2010 Breadcrumb (for master page)
View sp2010 full breadcrumb.aspx
<!--
Preview - http://i.snag.gy/Dd4S4.jpg
-->
<div id="new-breadcrumb" class="s4-notdlg">
<div class="s4-titletext">
<h1 name="onetidProjectPropertyTitle">
<asp:SiteMapPath runat="server" SiteMapProvider="SPContentMapProvider">
<PathSeparatorTemplate>
<span class="s4-nothome s4-bcsep s4-titlesep">
<SharePoint:ClusteredDirectionalSeparatorArrow runat="server"/>
@alirobe
alirobe / spf-dropdown.js
Last active Sep 27, 2015
SharePoint Foundation Drop-down Navigation
View spf-dropdown.js
/*
spfDropDowns v.1 by @alirobe - gist: 1312059
To use this, just structure your top-menu bar links by using a leading '-- '
to denote submenu items, e.g.
Menu Item
-- Submenu Item
Menu Item
-- Submenu Item
-- Submenu Item
@alirobe
alirobe / loadfont.js
Created Nov 4, 2011
SharePoint 2010 Font Loader
View loadfont.js
// in IE only, we must ensure that we don't load the font when the page is loaded in a dialog, because this
// breaks the font reference.
// Dialogs work by appending ?isDlg=1 to the end of an existing page and loading it into an iFrame.
function loadFont(fontName) {
var iAmInternetExplorer = navigator.userAgent.indexOf('MSIE') != -1;
var iAmNotInADialog = window.location.href.indexOf('IsDlg') == -1;
// for other browsers, we load this in a conditional comment.
// due to a bug in IE, WOFF fonts can't be loaded twice.
if (iAmInternetExplorer && iAmNotInADialog) {
@alirobe
alirobe / style library-v5-script-v5.js
Last active Sep 29, 2015
kyleschaeffer.com's Responsive SP2010 (sans HTML5, via @alirobe)
View style library-v5-script-v5.js
// kyleschaeffer.com's Responsive SP2010 (sans HTML5, via @alirobe)
// add me to the bottom of v5.js
// via gist @ http://github.com/alirobe
window.onresize = function(){
var w=800, t=" lt-800 ", cw, h;
h = document.getElementsByTagName("html")[0];
cw = window.outerWidth||h.clientWidth;
if (cw<=w) {if(h.className.indexOf(t)==-1) {h.className+=t}}
else {h.className=h.className.replace(/lt-800/g,'').replace(/[\s]{2,}/g,' ');}
@alirobe
alirobe / html5.master.part
Created Feb 1, 2012
On-demand IE9 rendering for SharePoint 2010 Master Pages.
View html5.master.part
<asp:ContentPlaceHolder runat="server" id="html5">
<-- In your .aspx page, use a override this ContentPlaceHolder using "IE=9" to enable HTML5 features - on pages where it's required... -->
<meta http-equiv="X-UA-Compatible" content="IE=8"/>
</asp:ContentPlaceHolder>
@alirobe
alirobe / masterfile-snippet.html
Last active Oct 13, 2015
Enable Chrome 'quick-search' for SharePoint Intranets
View masterfile-snippet.html
<!--
add inside the 'head' element of master page.
replace title="Intranet" with the name of your intranet (if branded)
-->
<link rel="search" title="Intranet" type="application/opensearchdescription+xml" href="/Style%20Library/opensearch.xml" />
@alirobe
alirobe / stickyfooter-2010.js
Last active Dec 15, 2015
A modification of Randy Drisgill's "Sticky footers in SharePoint" for SP2010. Works for me...
View stickyfooter-2010.js
// Place the #custom-footer directly after the close of #s4-bodyContainer, and apply float:left to it.
// What needed changing:
// - consistent use of the jQueryFooter variable (rather than re-selecting the footer to apply the margin-top)
// - changed/simplified the math to calculate the difference, adding s4-mainarea (which floats:left and is not included in bodyContainer)
// - did not force footer to show in dialog boxes (use .ms-dialog #custom-footer {display:none} in CSS to hide)
// http://blog.drisgill.com/2013/01/sticky-footers-in-sharepoint.html
// jQuery.noConflict();
@alirobe
alirobe / enable-impersonation.ps1
Last active Mar 8, 2016
Enable CRM 2013 SP1 - Exchange 2013 Synchronisation
View enable-impersonation.ps1
# run on exchange machine
add-pssnapin Microsoft.Exchange.Management.PowerShell.SnapIn
$serviceAccountName = "CrmEmailServiceAcct"
$serviceAccountUser = Get-User -Identity $serviceAccountName
Get-ExchangeServer | where {$_.IsClientAccessServer -eq $TRUE} | ForEach-Object {
Add-ADPermission -Identity $_.distinguishedname -User $serviceAccountUser.identity -AccessRights ExtendedRight -ExtendedRight ms-Exch-EPI-Impersonation
Add-ADPermission -Identity $_.distinguishedname -User $serviceAccountUser.identity -AccessRights ExtendedRight -ExtendedRight ms-Exch-EPI-May-Impersonate
}
Get-MailboxDatabase | ForEach-Object {Add-ADPermission -Identity $_.DistinguishedName -User $serviceAccountName -ExtendedRights ms-Exch-EPI-May-Impersonate}
@alirobe
alirobe / bom-cron.sh
Last active May 17, 2016
simple cron job that downloads weather forecasts from australian bureau of meteorology
View bom-cron.sh
# This script downloads weather forecasts from BOM
# Please ensure you comply with their usage terms and copyright...
# & to keep up with changes to this API
# - follow BOM here: https://data.gov.au/organization/bureauofmeteorology
# - star and fork this gist.
# New South Wales and ACT
curl ftp://ftp2.bom.gov.au/anon/gen/fwo/IDN11060.xml > NSW-ACT.xml
# Victoria
curl ftp://ftp2.bom.gov.au/anon/gen/fwo/IDV10753.xml > VIC.xml