Skip to content

Instantly share code, notes, and snippets.

View blacktambourine's full-sized avatar

Black Tambourine blacktambourine

View GitHub Profile
@blacktambourine
blacktambourine / Token.aspx
Created March 17, 2016 09:03
Add an Anti Forgery Token
<%= AntiForgery.GetHtml() %>
@blacktambourine
blacktambourine / PostExample.js
Created March 16, 2016 07:58
Angular JS Post to Web API
contactModule.controller('QuoteRequestController', ['$scope', '$q', '$timeout', 'QuoteRequestService', function ($scope, $q, $timeout, QuoteRequestService)
{
$scope.saveData = new QuoteRequestService();
$scope.saveData.Title = "my string value";
$scope.saveData.$save(function ()
{
//do something after save
});
}]);
@blacktambourine
blacktambourine / parametersobject.js
Created March 16, 2016 07:44
Parameter Mapping in Angular//
$scope.callWebApiService(SearchService,
{
Keywords: searchData.keywords,
CategoryPaths: searchData.categoryPaths,
SubCategoryPaths: searchData.subCategoryPaths,
Types: searchData.types,
CurrentPage: $scope.pager.currentPage,
DateFrom: $scope.dateFrom,
DateTo: $scope.dateTo
})
using System;
using System.Collections.Generic;
using System.Web.Http;
using System.Web.Http.Description;
using MyProject.Web.Models.Common;
using NLog;
namespace MyProject.Web.WebApi
{
public class DemoController : ApiController
@blacktambourine
blacktambourine / example_angular_controller.js
Created March 16, 2016 07:20
example angular controller
var accordionModule = angular.module('corpApp.accordionContentModule', ['ngRoute']);
accordionModule.controller('AccordionContentCtrl', ['$scope', '$controller', 'AccordionContentService', function ($scope, $controller, AccordionContentService) {
$scope.populatePageData = function (itemId)
{
$scope.callWebApiService(AccordionContentService, { id: itemId })
.then(function (result)
{
$scope.HandleResponseErrors(result);
@blacktambourine
blacktambourine / base_controller.js
Last active March 16, 2016 07:13
Base Controller
var baseModule = angular.module('corpApp.baseModule', ['ngRoute']);
baseModule.controller('BaseCtrl', ['$scope', '$q', '$timeout', function ($scope, $q, $timeout)
{
//#region Initialise variables
$scope.pageErrors = {};
$scope.data = {};
@blacktambourine
blacktambourine / services.js
Created March 16, 2016 03:18
Angular JS Services
var corpServices = angular.module('corpApp.corpServices', ['ngResource']);
(function ()
{
//#region Common Service Methods
var serviceRootPath = '/api/';
//add anti-forgery token to all Authenticated GET and POST requests
var AntiForgeryRequest = function (enableCache)
{
@blacktambourine
blacktambourine / install.ps1
Created January 14, 2016 04:39
Nuget Powershell to Set CopyLocal to false for dlls
param($installPath, $toolsPath, $package, $project)
$asms = $package.AssemblyReferences | %{$_.Name}
$configName = $project.ConfigurationManager.ActiveConfiguration.ConfigurationName
Write-Host "Updating dlls for configuration - ${configName}";
if ($configName -NotLike "*CD")
{
Write-Host "Updating dlls for Non-CD (Content Delivery) Environment";
@blacktambourine
blacktambourine / RadEditor.Dialogs.resx
Created January 4, 2016 06:15
Telerik Rad Editor Missing Labels Fix
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
@blacktambourine
blacktambourine / WorkboxPlus.config
Created December 11, 2015 02:42
Sitecore Custom Config File
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<!--Workbox Plus Module Settings-->
<WorkboxPlus>
<configuration type="BlackTambourine.Web.Helpers.WorkboxPlusConfig, BlackTambourine.Web">
<!--Enable Page Level Approval - i.e. group children of Pages / Item together in the Workbox-->
<param name="EnablePageLevelApproval">true</param>