Skip to content

Instantly share code, notes, and snippets.

View MikeLarned's full-sized avatar

Mike Larned MikeLarned

View GitHub Profile
@MikeLarned
MikeLarned / gist:8fe8309636ed165838c9
Created June 10, 2014 19:18
NHibernate ModifiedTimeStampListener
using System;
using System.Web;
using NHibernate.Event;
using NHibernate.Persister.Entity;
namespace MyProject.Infrastructure.NHibernate.Listeners
{
public class ModifiedTimeStampListener : IPreUpdateEventListener, IPreInsertEventListener
{
public bool OnPreUpdate(PreUpdateEvent @event)
@MikeLarned
MikeLarned / gist:8544572
Created January 21, 2014 17:44
SimulateClick.js
function simulatedClick(target, options) {
var event = target.ownerDocument.createEvent('MouseEvents'),
options = options || {};
//Set your default options to the right of ||
var opts = {
type: options.type || 'click',
canBubble:options.canBubble || true,
cancelable:options.cancelable || true,
@MikeLarned
MikeLarned / gist:8175744
Created December 29, 2013 22:56
Windows8BoxStarter
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
cinst fiddler4
cinst git-credential-winstore
cinst console-devel
cinst sublimetext2
cinst poshgit
cinst dotpeek
@MikeLarned
MikeLarned / ServiceConfigration.Cloud.csfg
Created February 19, 2013 15:50
Example ServiceConfigration.Cloud.csfg
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="MyApp.CloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="3" osVersion="*" schemaVersion="2012-10.1.8">
<Role name="MyApp.Web">
<Instances count="2" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=test;AccountKey=<KEY INFO>" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="<REMOTE DESKTOP USERNAME>" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="<ENCRYPTED PASSWORD>" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="<EXPIRE DATE>" />
@MikeLarned
MikeLarned / ServiceDefinition.csdef
Created February 19, 2013 15:24
ServiceDefinition.csdef
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="MyApp.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-10.1.8">
<WebRole name="MyApp.Web" vmsize="Small">
<Sites>
<Site name="Web" physicalDirectory="../../Publish/MyApp.Web/">
<VirtualApplication name="api" physicalDirectory="../../Publish/MyApp.Api/" />
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
@MikeLarned
MikeLarned / ImportAzureCmdlet.ps
Created February 15, 2013 15:30
ImportAzureCmdlet
Import-Module "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1"
Get-AzureSubscription
@MikeLarned
MikeLarned / azurecertificategeneration
Created February 11, 2013 15:51
Azure PowerShell Certificate Generation
cd c:\temp
makecert -sky exchange -r -n "CN=<certname>" -pe -a sha1 -len 2048 -ss MY "<certname>.cer"
@MikeLarned
MikeLarned / ImportPublishSettings
Last active December 12, 2015 09:58
Import PublishSettings for Azure
Get-AzurePublishSettingsFile
Import-AzurePublishSettingsFile <mysettings>.publishsettings
@MikeLarned
MikeLarned / gist:4755022
Last active December 12, 2015 09:58
Set Remote-Execution Policy
Set-ExecutionPolicy RemoteSigned
Import-Module "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1"
using System;
namespace ExampleTemplateGenerator
{
class Program
{
static void Main(string[] args)
{
var entity = new Entity("User", "MyAppAssembly");
var result = entity.TransformText();