Skip to content

Instantly share code, notes, and snippets.

View akhileshnirapure's full-sized avatar

Akhilesh Nirapure akhileshnirapure

View GitHub Profile
@akhileshnirapure
akhileshnirapure / sphrequire_config
Created April 24, 2014 11:41
SharePoint Hosted App + RequireJS Config
define(function () {
//debugger;
var rconfig = {
baseUrl: '../Scripts/app',
deps:
[
'spruntime_js','sp_js'
],
paths: {
@akhileshnirapure
akhileshnirapure / MODULE_SP_USER
Last active August 29, 2015 14:00
Module for Web
var userInfoWebModule = function (jQuery) {
// Define user class/module
var userModule = function () {
function _getUserName() {
var context = SP.ClientContext.get_current();
var user = context.get_web().get_currentUser();
var userProfileModule = function (jQuery) {
// Define user class/module
var userProfileInfoModule = function () {
function _getUserName() {
var userProfileProperties;
//Get Current Context
var startModule = function (jQuery,userInfoWeb,userInfoProfile) {
function ShowUserName() {
userInfoWeb.getUserName();
userInfoProfile.getUserName();
};
SP.SOD.loadMultiple(['sp.js', 'userprofile'], ShowUserName);
// UnhandledExceptionFilterAttribute.cs
// http://stackoverflow.com/questions/12519561/throw-httpresponseexception-or-return-request-createerrorresponse
// http://pastebin.com/Uu65fRwT
// https://blog.iamandycohen.com/2013/02/09/webapi-and-the-behavior-of-exceptions-and-an-alternative-configurable-way-to-deal/
// https://github.com/iamandycohen/Omegaluz.GlobalApiExceptions/blob/master/ExampleApi/App_Start/WebApiExceptionConfig.cs
namespace Northwind.WebApi2Services.Filters
{
using System;
// Amikiri/src/Amikiri.Api/Infrastructure/Filters/ValidationExceptionFilter.cs
namespace Amikiri.Api.Infrastructure.Filters
{
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http.Filters;
using global::FluentValidation;
@akhileshnirapure
akhileshnirapure / Update-SPTokenLifetime.ps1
Created September 22, 2016 15:21 — forked from janikvonrotz/Update-SPTokenLifetime.ps1
PowerShell: Update SharePoint Token Lifetime #SharePoint #PowerShell
if(-not (Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)){Add-PSSnapin "Microsoft.SharePoint.PowerShell"}
# update SharePoint cache token lifetime
$SPContentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$SPContentService.TokenTimeout = (New-TimeSpan -minutes 5)
$SPContentService.Update()
# udpate SharePoint claims token lifetime
@akhileshnirapure
akhileshnirapure / angular-typescript-providers.ts
Created September 29, 2016 12:30 — forked from jepetko/angular-typescript-providers.ts
demonstrates how to define angularjs providers in Typescript
//Example 1: inline definition... not configurable :-(
angular.module("myApp", [])
.provider("Dummy", <ng.IServiceProvider>{
'$get': function() {
return { value: 1 };
}
})
.config(["DummyProvider", function(Dummy: ng.IServiceProvider) {
<div ng-app="wizardApp">
<div ng-controller="WizardSignupController">
<h2>Signup wizard</h2>
<div ui-view></div>
</div>
</div>
<script type="text/javascript" src="/js/vendor/angular-ui-router/release/angular-ui-router.min.js"></script>
<script type="text/javascript">
angular.module('wizardApp', [
'ui.router',
@akhileshnirapure
akhileshnirapure / TW-CreateBlankClientExtranetSite.ps1
Created October 11, 2016 13:31 — forked from pkskelly/TW-CreateBlankClientExtranetSite.ps1
Add a blank site collection to an Office 365 tenant in SharePoint Online
# =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# Script: TW-CreateBlankClientExtranetSite.ps1
#
# Author: Pete Skelly
# Twitter: ThreeWillLabs
# http://www.threewill.com
#
# Description: Add a blank site collection to an Office 365 tenant in SharePoint Online
#
# WARNING: Script provided AS IS with no warranty. Your mileage will vary. Use