Skip to content

Instantly share code, notes, and snippets.

View ThorstenHans's full-sized avatar
🍒

Thorsten Hans ThorstenHans

🍒
View GitHub Profile
@ThorstenHans
ThorstenHans / ChromeSample.js
Last active December 31, 2015 06:09
ShareCoffee ChromeControl
var iconUrl = 'https://www.example.com/myappicon.png';
var appChromeSettings = new ShareCoffee.ChromeSettings(iconUrl, 'SharePoint ChromeControl Sample',
// Settings links are displayed within the AppChrome.
// 1. Parameter = 'TargetURL'
// 2. Parameter = 'Title'
// 3. Parameter = AppendCurrentQueryString (true|false)
new ShareCoffee.SettingsLink('foo.html', 'Foo', true),
new ShareCoffee.SettingsLink('bar.html', 'Bar', true));
var onSuccess = function(){
console.log('SharePoint App Chrome and CSS loaded');
@ThorstenHans
ThorstenHans / App.js
Last active December 31, 2015 22:29
ShareCoffee and ChartJS.org
// the next line of code brings somple IntelliSense within VS
/// <reference path="ShareCoffee/ShareCoffee.js"/>
$(document).ready(function () {
var onLoaded = function (data) {
var ctx = document.getElementById("myChart").getContext("2d");
var chartData = {
labels: [],
datasets: [{
fillColor: "#3399cc",
@ThorstenHans
ThorstenHans / Default.html
Last active January 4, 2016 19:50
ShareCoffee.Search
<!-- for the minified version -->
<script type='text/javascript' src="~/Scripts/ShareCoffee/ShareCoffee.min.js"></script>
<script type='text/javascript' src="~/Scripts/ShareCoffee.Search/ShareCoffee.Search.min.js"></script>
<!-- or for the debug version -->
<script type='text/javascript' src="~/Scripts/ShareCoffee/ShareCoffee.js"></script>
<script type='text/javascript' src="~/Scripts/ShareCoffee.Search/ShareCoffee.Search.js"></script>
@ThorstenHans
ThorstenHans / GetFormDigestValue.coffee
Last active January 4, 2016 20:39
Obtain ContextInfo using ShareCoffee
$http(ShareCoffee.REST.build.create.for.angularJS {url: 'contextinfo'})
.success((data)->
# great for single time use
formDigestValue = data.d.GetContextWebInformation.FormDigestValue
# use this for page instace wide usages
ShareCoffee.Commons.formDigestValue = data.d.GetContextWebInformation.FormDigestValue
).error((error)->
console.log "error while loading contextinfo"
)
@ThorstenHans
ThorstenHans / InstallAndCreateAddOn.bash
Last active August 29, 2015 13:55
Installing yeoman and generator-sharecoffee-addon
# Ensure that nodejs is installed on your system
# Install yeoman globally
npm install yo -g
# on unix systems or macs you should use sudo when installing global packages
sudo npm install yo -g #MAC/LINUX
# Install generator globally
npm install generator-sharecoffee-addon -g
@ThorstenHans
ThorstenHans / ArraysAndObjects.coffee
Last active August 29, 2015 13:56
Introduction to CoffeeScript
myObject =
foo: 'bar'
isThisAwesome: true
requiresLessKeystrokes: true
complex:
ifYouAreInterestedIn: true
stillReadable: true
caption: 'CoffeeScript'
compilesTo: 'JavaScript'
cost: 0
# install sass on windows
gem install sass
# ensure root permissions on -ix systems using sudo
sudo gem install sass
# check the installation by querying for the current SASS version
sass -v
@ThorstenHans
ThorstenHans / Sample.coffee
Last active August 29, 2015 13:56
ShareCoffee.UserProfiles
window.MyAngularApp.service 'userProfilesService', ['$http', ($http) ->
loadMyProfile: (onSuccess, onError) ->
$http ShareCoffee.REST.build.read.for.angularJS
url: ShareCoffee.Url.GetMyProperties
.success onSuccess
.error onError
loadProfilePropertiesForUser: (accountName, onSuccess, onError) ->
properties = new ShareCoffee.UserProfileProperties(ShareCoffee.Url.GetUserProfileProperty, accountName, 'WorkEmail')
@ThorstenHans
ThorstenHans / appweburl.js
Last active August 29, 2015 13:56
ShareCoffee0011
// Load the AppWebUrl (default implementation)
var appWebUrl = ShareCoffee.Commons.getAppWebUrl();
// provide a custom load function for loading the AppWebUrl
ShareCoffee.Commons.loadAppWebUrlFrom = function(){
$.ajax({url: 'Context/AppWebUrl', type: 'GET', async: false}).responseJSON;
};
var appWebUrl = ShareCoffee.Commons.getAppWebUrl();
@ThorstenHans
ThorstenHans / CalendarAPISample.cs
Last active June 28, 2019 16:45
O365 API Sample
using Microsoft.Office365.Exchange;
using Microsoft.Office365.OAuth;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebApplication2
{