Skip to content

Instantly share code, notes, and snippets.

Maarten Balliauw maartenba

Block or report user

Report or block maartenba

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
@maartenba
maartenba / CachedQueryable.cs
Created Mar 30, 2012
A fresh draft of CachedQueryable<T>
View CachedQueryable.cs
class Program
{
static void Main(string[] args)
{
List<Person> source = new List<Person>();
source.Add(new Person { Id = 1, Name = "Maarten" });
source.Add(new Person { Id = 2, Name = "Xavier" });
var cache = new List<Person>();
@maartenba
maartenba / CloudBlobExtensions.cs
Last active Oct 12, 2015
Some common ICloudBlob extension methods
View CloudBlobExtensions.cs
public static class CloudBlobExtensions
{
/// <summary>
/// Uploads a string of text to a block blob.
/// </summary>
/// <param name="content">The text to upload, encoded as a UTF-8 string.</param>
public static void UploadText(this ICloudBlob blob, string content)
{
UploadText(blob, content, Encoding.UTF8, null);
}
@maartenba
maartenba / cakeunit4phpstorm.php
Last active Aug 2, 2017
CakePHP2 PHPUnit Runner for PHPStorm
View cakeunit4phpstorm.php
<?php
// Clean argument values
$phpStormRunner = null;
$cleanedArgv = array();
foreach ($_SERVER['argv'] as $key => $value) {
if (strpos($value, 'ide-phpunit.php') === false) {
$cleanedArgv[] = $value;
} else {
$phpStormRunner = $value;
}
@maartenba
maartenba / azure.xml
Created Mar 1, 2013
(not completed) Windows Azure CLI tools autocompletion for PhpStorm
View azure.xml
<?xml version="1.0" encoding="UTF-8"?>
<framework xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schemas/frameworkDescriptionVersion1.1.3.xsd" name="azure" invoke="C:\Program Files (x86)\Microsoft SDKs\Windows Azure\CLI\0.6.9\wbin\azure.cmd" alias="azure" enabled="true" version="2">
<help><![CDATA[Windows Azure: Microsoft's Cloud Platform]]></help>
<command>
<name>help</name>
<params>command</params>
<help>Display help for a givencommand</help>
</command>
<command>
<name>portal</name>
@maartenba
maartenba / autoload.php
Created Jun 10, 2013
Deployment script for Windows Azure Web SItes running PHPUnit tests
View autoload.php
#!/bin/bash
# ----------------------
# KUDU Deployment Script
# ----------------------
# Helpers
# -------
exitWithMessageOnError () {
View BankAccount.php
<?php
class BankAccount {
/** @var int */
protected $_balance;
function __construct()
{
$this->_balance = 0;
}
View cdn.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maartenba
maartenba / Tessel syntax description for WebStorm Command Line Tools
Created Jul 30, 2014
Tessel syntax description for WebStorm Command Line Tools. Copy to C:\Users\<your username>\.WebStorm8\config\commandlinetools\Custom_tessel.xml.
View Tessel syntax description for WebStorm Command Line Tools
<?xml version="1.0" encoding="UTF-8"?>
<framework xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schemas/frameworkDescriptionVersion1.1.3.xsd"
name="Custom_tessel" invoke="C:\Users\Maarten\AppData\Roaming\npm\tessel.cmd" alias="tessel" enabled="true" version="2">
<help><![CDATA[tessel command line]]></help>
<command>
<name>--help</name>
<help><![CDATA[
<h2>Display available commands</h2>
]]></help>
</command>
@maartenba
maartenba / DomainTemplateRoute - GetVirtualPath
Last active Oct 30, 2019
ASP.NET MVC 6 / ASP.NET 5 Domain Routing + Tenant Middleware
View DomainTemplateRoute - GetVirtualPath
public string GetVirtualPath(VirtualPathContext context)
{
foreach (var matcherParameter in _matcher.Template.Parameters)
{
context.Values.Remove(matcherParameter.Name); // make sure none of the domain-placeholders are appended as query string parameters
}
return _innerRoute.GetVirtualPath(context);
}
@maartenba
maartenba / KeyVaultConfigSystem.cs
Created May 31, 2016
Override .NET's source for AppSettings (hacky, don't use this at home)
View KeyVaultConfigSystem.cs
public sealed class KeyVaultConfigSystem
: IInternalConfigSystem
{
private const string AppSettingsKey = "appSettings";
private readonly IInternalConfigSystem _internalConfigSystem;
private object _appSettings;
private KeyVaultConfigSystem(IInternalConfigSystem internalConfigSystem)
{
You can’t perform that action at this time.