Skip to content

Instantly share code, notes, and snippets.

Kamran Ayub kamranayub

Block or report user

Report or block kamranayub

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kamranayub / ko.extendes.urlSync.js
Created May 11, 2015
Knockout Extender: URLSync - syncs observable value with URL hash
View ko.extendes.urlSync.js
* An extender that syncs the observable with the address
* bar (using hash fragment). Will load from URL hash or
* querystring (at time of creation) and will
* update hash when observable changes.
* Options: string|object
* String: Query parameter key to get/set
* Object:
* - param - Query parameter key to get/set
kamranayub / ko.bindingReport.js
Last active Jan 29, 2019
Knockout.js Binding Performance Reporter
View ko.bindingReport.js
* Performance reporting for Knockout binding handlers
* Usage: Include after all bindings are declared, view console for results.
(function () {
var report = [];
var lastReport = 0;
var debounceWait = 500;
kamranayub / Transforms.xml
Created Feb 26, 2012
MSBuild Inline Task to Transform a Hierarchy of XML Files using XDT Transforms
View Transforms.xml
<!-- This task takes in a XDT transform file and transforms it, following any inheritance chain.
There should be at least one base transform for this to work; otherwise just use Microsoft's
regular TransformXml task. -->
TaskDirectory="path/to/directory/of/Microsoft.Web.Publishing.Tasks" />
kamranayub / makefile
Last active Aug 1, 2017
Makefile for using ansible-playbook to do syntax checking for YAML playbooks
View makefile
# Collect top-level YAML files under plays/ folder
# e.g. plays/upgrade_ansible_tower/upgrade_ansible_tower.yml
# These should only be Ansible playbook files
# i.e. store includes in child includes/ dir
playbooks := $(wildcard plays/*/*.yml)
# Check YAML syntax using ansible-playbook
syntax: $(playbooks)
@GREEN='\033[0;32m'; \
NC='\033[0m'; \
kamranayub / Get-TfsGitLfsFile.ps1
Created Jun 15, 2017
Download Git LFS file from TFS/VSTS
View Get-TfsGitLfsFile.ps1
Downloads a blob item from TFS Git LFS
This script performs a 4-step process to download a LFS-hosted file from TFS. It fetches the item metadata
then downloads the LFS pointer. After it validates the pointer file, it preps a LFS batch download and finally
downloads the file to the specified OutFile. You can use this cmdlet in a pipeline as it passes a Get-Item call
at the end.
kamranayub / Generate-OfflineManifest.ps1
Last active Sep 21, 2016
PowerShell script to build an HTML5 application manifest file
View Generate-OfflineManifest.ps1
Generates an HTML5 offline app cache manifest file
Generates an offline app cache manifest file according to file paths specified
and outputs with MD5 checksums so manifest only changes when dependent files change.
kamranayub / DataContext.js
Created Apr 24, 2013
A working ASP.NET Web API MVC 4 Anti-Forgery approach that also works on cloud hosts like AppHarbor. See:
View DataContext.js
var options = {};
// jQuery options
// options.url = foo;
// CSRF Token
var csrfToken = $("input[name='__RequestVerificationToken']").val();
if (csrfToken) {
options.headers = {
View CassetteConfiguration.cs
namespace Website {
/// <summary>
/// Configures Cassette IoC
/// </summary>
public class CassetteContainerConfiguration : IConfiguration<TinyIoCContainer>
public void Configure(TinyIoCContainer container)
kamranayub / Pkcs12ProtectedConfigurationProvider.cs
Created Feb 21, 2016
A modified PKCS12 provider that can use CurrentUser or LocalMachine store.
View Pkcs12ProtectedConfigurationProvider.cs
Microsoft Limited Permissive License (Ms-LPL)
This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
1. Definitions
The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the same meaning here as under U.S. copyright law.
A “contribution” is the original software, or any additions or changes to the software.
A “contributor” is any person that distributes its contribution under this license.
kamranayub / ConfigSecretsProvider.cs
Created Feb 24, 2016
Secrets provider interface
View ConfigSecretsProvider.cs
public class ConfigSecretsProvider : ISecretsProvider
private readonly NameValueCollection _secretCollection;
public ConfigSecretsProvider() {
_secretCollection = ConfigurationManager.GetSection("appSecrets") as NameValueCollection;
public string GetSecret(string key) {
return Environment.GetEnvironmentVariable(key) ?? _secretCollection[key];
You can’t perform that action at this time.