Skip to content

Instantly share code, notes, and snippets.

@spdustin
spdustin / spAutoComplete.js
Created June 27, 2014 21:36
AutoComplete for SharePoint
var $theField = $('input[title=RelatedAnnouncements]');
var listName = 'Announcements';
var listSvc = _spPageContextInfo.webServerRelativeUrl + '/_vti_bin/listdata.svc/' + listName;
$theField.autocomplete({
source: function(request, response) {
var typed = request.term;
var listSvcFilter = listSvc + '?$filter=startswith(Title,\'' + typed + '\')';
$.getJSON(listSvcFilter, function(data) {
var items = [];
$.each(data.d.results, function(key, val) {
@spdustin
spdustin / SassMeister-input.scss
Created July 29, 2014 15:56
Generated by SassMeister.com.
// ----
// Sass (v3.3.10)
// Compass (v1.0.0.alpha.20)
// ----
$brandcolor: black;
$fontstack: "Segoe UI","Segoe",Tahoma,Helvetica,Arial,sans-serif;
@function forbackground($color) {
$lightness: lightness($color);
$functiontocall: if($lightness > 50%, 'darken', 'lighten');
ActiveRecord::RecordNotFound (Couldn't find Course with id=10000000000002):
/home/lms/canvas/vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.19/lib/active_record/relation/finder_methods.rb:344:in `find_one'
/home/lms/canvas/vendor/bundle/ruby/2.1.0/gems/switchman-1.2.18/lib/switchman/active_record/finder_methods.rb:20:in `find_one'
/home/lms/canvas/vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.19/lib/active_record/relation/finder_methods.rb:315:in `find_with_ids'
/home/lms/canvas/vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.19/lib/active_record/relation/finder_methods.rb:107:in `find'
/home/lms/canvas/vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.19/lib/active_record/querying.rb:5:in `find'
/home/lms/canvas/app/controllers/application_controller.rb:1699:in `block in profile_data'
/home/lms/canvas/app/controllers/application_controller.rb:1697:in `each'
/home/lms/canvas/app/controllers/application_controller.rb:1697:in `map'
/home/lms/canvas/app/controllers/application_controller.rb:1697:i
@spdustin
spdustin / data.xml
Created December 8, 2014 20:37
XSL for joined lists (HTML and JS Array output)
<dsQueryResponse>
<Projects>
<Rows>
<Row ID="1" ContentType="Item" Title="Project A" />
<Row ID="2" ContentType="Item" Title="Project B" />
</Rows>
</Projects>
<Tasks>
<Rows>
<Row Title="Task 1" Priority="(2) Normal" Status="Not Started" PercentComplete="0 %" PercentComplete.="0" Related_x0020_Project_x003a_ID="1" ID="1" />
@spdustin
spdustin / announcements.xml
Last active August 29, 2015 14:18
Announcements Sample
<dsQueryResponse>
<Rows>
<Row ID="1"
Title="Get Started with Microsoft SharePoint Foundation!"
Body="&lt;div class=&quot;ExternalClass7879AECA66014FDDB85450C1221CBCC4&quot;&gt;Microsoft SharePoint Foundation helps you to be more effective by connecting people, information, and documents. For information on getting started, see Help.&lt;/div&gt;"
Group="Group B"/>
<Row ID="2"
Title="Second announcement."
Body="&lt;div class=&quot;ExternalClass8297C2B34D8E4E958D2A0413F85229BC&quot;&gt;Bummer, there was already one there, so I couldn't claim &lt;strong&gt;FIRSTIES!&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;​&lt;/p&gt;&lt;/div&gt;"
Group="Group A"/>
@spdustin
spdustin / announcements.xsl
Created April 7, 2015 20:11
Announcements XSL
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- This XSL Stylesheet created by SharePoint Experts, Inc. -->
<!-- http://sharepointexperience.com -->
<xsl:output method="html" indent="yes"/>
<!-- This template is the "wrapper" or "container" for the custom view. -->
<xsl:template match="/">
<!-- This is the actual wrapper element that will be emitted -->
@spdustin
spdustin / org_chart.xsl
Created April 10, 2015 19:14
Org Chart XSL
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<!-- This template is the "wrapper" or "container" for the custom view. -->
<xsl:template match="/">
<!-- This is the actual wrapper element that will be emitted -->
<div>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
@spdustin
spdustin / announcements_grouped.xsl
Created July 7, 2015 20:00
XSL Example - Group By "Group"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:key name="group-by-group" match="Row" use="@Group"/>
<xsl:template match="/">
<xsl:apply-templates select="/dsQueryResponse/Rows/Row[count(. | key('group-by-group', @Group)[1]) = 1]" mode="header">
<xsl:sort select="@Group"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="Row" mode="header">
<h1><xsl:value-of select="@Group"/></h1>
@spdustin
spdustin / announcements_grouped_by_year.xsl
Created July 7, 2015 20:01
XSL Example - Group by year from "date"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:key name="group-by-group" match="Row" use="@Group"/>
<xsl:key name="group-by-year" match="Row" use="substring(@date,4,4)"/>
<xsl:template match="/">
<ul>
<xsl:apply-templates select="/dsQueryResponse/Rows/Row[count(. | key('group-by-year', substring(@date,4,4))[1]) = 1]" mode="header">
<xsl:sort select="substring(@date,4,4)"/>
</xsl:apply-templates>
</ul>
@spdustin
spdustin / baseline_dvwp.xsl
Created July 8, 2015 20:00
Baseline DVWP XSL
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- This XSL Stylesheet created by SharePoint Experts, Inc. -->
<!-- http://sharepointexperience.com -->
<xsl:output method="html" indent="yes"/>
<!-- This template is the "wrapper" or "container" for the custom view. -->
<xsl:template match="/">
<!-- This is the actual wrapper element that will be emitted -->