Skip to content

Instantly share code, notes, and snippets.

View tristian2's full-sized avatar
🎯
Focusing on final MSc Data visualisation assignment and SharePoint migration

tristian o'brien tristian2

🎯
Focusing on final MSc Data visualisation assignment and SharePoint migration
View GitHub Profile
@tristian2
tristian2 / SharePointSitesListsandFieldsReportUsingREST.txt
Last active November 4, 2015 09:00
SharePointSitesListsandFieldsReportUsingREST
<!--place code in a script editor webpart, or use as the basis of custom JavaScript etc.
returns all Webs on a given url and child lists
to return both domains, duplicate the code, but need to configure CORS on your webservers
this version carries out three depenedent rest calls to get the webs, their lists and then the url of the list - this is a "feature" of working with restful SHarePoint
intent tion is to bundle this into a webpart - then solution-->
<script type="text/javascript">
ACME.SupportSite.Utilities.WebListsReport = function (divToPlaceReport) {
var webs = [];
var lists = [];

jQuery.ajax.fake

when you want to fake an ajax call, that's because your server's web service is just not ready yet, and whenever that web service is ready, switching back to it should cost nothing..

with jquery.ajax.fake you simply write pure jQuery ajax call, with only one extra property fake: true

How to use it

include jquery.ajax.fake.js script into your markup, and create webservices.fake.js to handle fake ajax calls

<script src="jquery.ajax.fake.js"></script>
@tristian2
tristian2 / A-Pen-by-tristian-obrien.markdown
Created November 21, 2013 16:34
A Pen by tristian o'brien.
@tristian2
tristian2 / An-Anonymous-Pen.markdown
Created November 21, 2013 16:33
A Pen by Anonasaurus Rex.
@tristian2
tristian2 / CRUDLists
Created January 12, 2016 14:09
CRUD SharePoint List REST Methods
//just for the console
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict()
//just for the console END
var listurl = "http://sharepointsupport/smallsys/testscr/Lists/TestKnockoutCRUD/AllItems.aspx";
@tristian2
tristian2 / selectors.js
Created January 12, 2016 15:31
JQuery selectors
//just for the console
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict()
//just for the console END
jQuery(document).ready(function() {
cls
$certPath = "C:\Certs\TrisOfficePnP.cer"
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import($certPath)
$rawCert = $cert.GetRawCertData()
$base64Cert = [System.Convert]::ToBase64String($rawCert)
$rawCertHash = $cert.GetCertHash()
$base64CertHash = [System.Convert]::ToBase64String($rawCertHash)
$KeyId = [System.Guid]::NewGuid().ToString()
@tristian2
tristian2 / Preplog.cpp
Created August 3, 2016 14:25
Preplog.cpp
/*
****************************************************************
* File: preplog.cpp
* Author: David Grant(MS)
* Purpose: Removes lines beginning with "#" from an input
* text file
* Written to remove header lines from IIS
* web logs for BULK IMPORT to SQL
*
* Disclaimer: This code is to be used for sample purposes only
@tristian2
tristian2 / gist:54bc9febfd2be5b30467dfd300e5891d
Created August 10, 2016 11:37
BattleShips port rom GROOVY to c#
//one
using System;
using System.Collections;
using System.Linq;
public class Program
{
public static void Main()
{
Console.WriteLine("Start");
@tristian2
tristian2 / Ships.js
Created August 19, 2016 14:36
BattleShips demo of how we can "subclass" in JS
//from https://github.com/tristian2/BattleShipsJS
var TrisCorp = TrisCorp || {};
TrisCorp.BattleShips = TrisCorp.BattleShips || {};
TrisCorp.BattleShips.Ship = TrisCorp.BattleShips.Ship || {};
/**
@constructor
@abstract
*/
TrisCorp.BattleShips.Ship = function() {
if (this.constructor === TrisCorp.BattleShips.Ship) {