Skip to content

Instantly share code, notes, and snippets.

View chandermani's full-sized avatar

Chandermani chandermani

  • London
View GitHub Profile
@chandermani
chandermani / CacheImageFileConverter.cs
Created May 13, 2012 12:58
Windows Phone Image Caching Converter
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
@chandermani
chandermani / LongestIncreasingSequence.cs
Created May 23, 2012 15:20
Determining largest increasing sequence in an interger array using Patience Sort.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Algorithms
{
/// <summary>
/// Calculating longest sequence using Patience Sort. See here http://wordaligned.org/articles/patience-sort
/// </summary>
@chandermani
chandermani / DefaultServiceVersion.cs
Created June 19, 2012 12:37
Set the DefaultServiceVersion property of Azure blob storage.
var account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
var blobs = account.CreateCloudBlobClient();
var existingprops = blobs.GetServiceProperties();
blobs.SetServiceProperties(new Microsoft.WindowsAzure.StorageClient.Protocol.ServiceProperties()
{
DefaultServiceVersion = "2011-08-18",
Logging=existingprops.Logging,
Metrics=existingprops.Metrics,
});
@chandermani
chandermani / AutofacIntegration
Created December 2, 2012 07:44
Autofac integration ASP.Net MVC, WebAPI
private void RegisterIOC()
{
var builder = new ContainerBuilder();
builder.RegisterControllers(typeof(MvcApplication).Assembly);
builder.RegisterApiControllers(typeof(MvcApplication).Assembly);
AutofacBootstrap.Init(builder);
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
GlobalConfiguration.Configuration.DependencyResolver = new Autofac.Integration.WebApi.AutofacWebApiDependencyResolver(container);
}
@chandermani
chandermani / Autofacbootstrap.cs
Created December 2, 2012 07:48
Autofac Bootstrap template
public class AutofacBootstrap
{
internal static void Init(ContainerBuilder builder)
{
}
}
function SomeCtrl($scope) {
$scope.countries = ['can', 'usa', 'fra', 'jap'];
$scope.user = {name: "Evil Trout"};
$scope.age = 34;
// Our template now can render {{age}}, {{user.name}} and a list of countries!
}
<div id='userData'>
<div id='sectionParticulars' ng-include="'particularsTemplate'" ng-init='model=model'></div>
<div id='sectionAddress' ng-include="'addressTemplate'" ng-init='model=model.address'></div>
<div id='sectionDepedents' ng-include="'dependentTemplate'" ng-init='model=model.dependents'></div>
</div>
<script type="text/ng-template" class="template" id="particularsTemplate">
<!-- HTML related to user particulars-->
</script>
.directive('myDirective', function () {
return {
restrict: 'E',
scope: {
model: '='
},
// The linking function will add behavior to the template
link: function (scope, element, attrs) {
}
};
@chandermani
chandermani / web.config
Created January 22, 2014 16:04
ASP.Net Identity - Google OpenId redirect endpoint.
<location path="signin-google">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
$scope.foo = $http({method: 'GET', url: '/someUrl'});
<!--In HTML this works-->
<div>{{foo}}</div>