Skip to content

Instantly share code, notes, and snippets.

View droyad's full-sized avatar

Robert Wagner droyad

View GitHub Profile
.signal-bar {
background-color: fuchsia
}
.stream-view .content
{
background-color: peachpuff
}
.masthead
{
background-color: greenyellow;
@droyad
droyad / gist:c2e7ea40a6a3c3abd0a3
Last active December 2, 2015 05:00
Powershell script to install node and NPM
$nodeVersion = "4.0.0"
Invoke-WebRequest "https://nodejs.org/download/release/v$nodeVersion/node-v$nodeVersion-x64.msi" -OutFile 'node.msi'
# If Invoke-WebRequest is not found on your version of PS:
#
# $request = [System.Net.WebRequest]::Create("https://nodejs.org/download/release/v$nodeVersion/node-v$nodeVersion-x64.msi")
# [System.Net.WebResponse]$response = $request.GetResponse()
# $file = [System.IO.File]::OpenWrite("node.msi")
# $response.GetResponseStream().CopyTo($file)
# $file.Close()
@droyad
droyad / gist:2891df7c221c897a8b8c
Created October 6, 2015 01:03
Enum Extensions
public static class EnumExtensions
{
public static string ToDescription(this Enum enumValue)
{
if (enumValue == null)
return null;
var memInfo = enumValue.GetType().GetMember(enumValue.ToString());
var description = (DescriptionAttribute)memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false).FirstOrDefault();
@droyad
droyad / gist:23090df50ade11f63bb2
Created October 6, 2015 01:03
Config Injector Enum Value parser
public class EnumValueParser : IValueParser
{
public bool CanParse(Type settingValueType)
{
return settingValueType.IsEnum;
}
public object Parse(Type settingValueType, string settingValueString)
{
return settingValueString.ToEnum(settingValueType);
@droyad
droyad / gist:46f50cbde8dd9b9b276b
Last active September 17, 2015 06:12
Service Bus Installation
Local Development Installation
1. Fix a framework bug (from http://stackoverflow.com/a/30733654) before anything else
a. (NHX52000) can be replaced by any machine with VS 2015 on it, like your machine. Only use the UNC as it's easier for the server instructions.
b. Copy the DLL to the right to c:\temp
c. From an elevated command prompt, run
"\\nhx52000\c$\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\sn.exe" -Vr c:\temp\Microsoft.Cloud.Common.AzureStorage.dll
d. "\\nhx52000\c$\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\gacutil" /i c:\temp\Microsoft.Cloud.Common.AzureStorage.dll
2. Run the web platform installer (or on a server use the offline mode
a. Select
@droyad
droyad / gist:906f6c4f1c1157548f03
Created September 17, 2015 04:55
Selenium Wait
public static void WaitForCgBusyCompletion(this BasePage page)
{
HostEx.WaitUntil(() => page.FindElements(By.ClassName("cg-busy"), TimeSpan.FromMilliseconds(100)).None(e => e.Displayed), TimeSpan.FromMinutes(1));
Thread.Sleep(TimeSpan.FromMilliseconds(100));
}
public static void WaitUntil<T>(this T page, Func<T, bool> condition, TimeSpan? timeout = null) where T : Page
{
HostEx.WaitUntil(() => condition(page), timeout);
}
void Main()
{
var items = new [] {
new[] {"A", "B"},
new[] {"1", "2", "3"},
new[] {"*", "+"}
};
//items.Aggregate((memo, i) => memo.SelectMany (m => i.Concat(new[]{ m}).ToArray()).ToArray()).Dump();
@droyad
droyad / gist:30097e1f8c02df781ac2
Created August 10, 2015 07:35
Test Autofac registrations by inspection
public abstract class ContainerTestsBase
{
private IContainer _container;
private HashSet<Type> _registeredServices;
readonly Autofac.Core.Activators.Reflection.DefaultConstructorFinder _ctorFinder = new Autofac.Core.Activators.Reflection.DefaultConstructorFinder();
private HashSet<Type> _genericServices;
private HashSet<Type> _registeredConcretions;
[TestFixtureSetUp]
@droyad
droyad / gist:578e39aa3f2d25f24643
Created July 28, 2015 06:00
AutofacNancyBootstrapper
public class NancyBootstrapper : AutofacNancyBootstrapper
{
private readonly ILifetimeScope _container;
public NancyBootstrapper(ILifetimeScope container)
{
_container = container;
StaticConfiguration.DisableErrorTraces = _container.Resolve<EnvironmentNameSetting>().IsProduction;
ApplicationPipelines.OnError.AddItemToStartOfPipeline((context, ex) =>
{
@droyad
droyad / 0_reuse_code.js
Last active August 29, 2015 14:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console