Skip to content

Instantly share code, notes, and snippets.

View carolynvs's full-sized avatar

Carolyn Van Slyck carolynvs

View GitHub Profile

Keybase proof

I hereby claim:

  • I am carolynvs on github.
  • I am carolynvs (https://keybase.io/carolynvs) on keybase.
  • I have a public key whose fingerprint is D31E 7624 60E3 13EA 9780 1E16 33EE CC2F FF11 A333

To claim this, I am signing this object:

@carolynvs
carolynvs / project.json
Last active August 29, 2015 14:06
Sample project.json
{
"dependencies": {
"AutoMapper": "2.2.1",
"MyProject": ""
},
"frameworks": {
"net45": {}
},
"commands": {
"custom-command": "My.Custom.Package --arg1 some-value"
@carolynvs
carolynvs / project.json
Last active August 29, 2015 14:26
nuget wildcard
{
"dependencies":
{
"Newtonsoft.Json": "6.*",
"Microsoft.AspNet.Mvc": "6.0.0-*"
},
"frameworks":
{
"net45": {}
}
@carolynvs
carolynvs / AutoConvertToUtcDataContext.cs
Created August 13, 2012 23:27
Utility for dynamically converting all DateTime properties on an object to UTC
using System;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.ModelConfiguration;
using System.Data.Objects;
using System.Linq;
using Carolynvs.Model; // Contains Carolynvs.UtcDateTimeConverter which provides UtcDateTimeConverter.Convert(object model)
namespace Carolynvs.DAL
@carolynvs
carolynvs / Carolynvs.ObjectExtensions.cs
Created August 13, 2012 23:19
Extension methods which allow dynamically getting and setting property values
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
namespace Carolynvs.Extensions
{
/// <summary>
/// Extension methods for the Object type
/// </summary>
public static class ObjectExtensions
@carolynvs
carolynvs / EntityFrameworkGenericMethod.cs
Created December 11, 2012 02:45
Using Generic Methods in Entity Framework Queries
public static IQueryable<T> FilterByFooBar<T>(this IQueryable<T> items)
where T : class, IFooBar
{
return items.Where(x => x.IsFooBar);
}
@carolynvs
carolynvs / InitializeKnockoutObservable.js
Last active October 13, 2015 22:18
Initializing Knockout.js Observables
var valueType = true;
var oValueType = new ko.observable(valueType);
oValueType(false);
// valueType is unchanged
var array = [1, 2, 3];
var oArray = new ko.observableArray(array);
oArray.remove(1);
// array is modified, now equals [2, 3]
@carolynvs
carolynvs / SampleRouteTest.cs
Last active December 10, 2015 17:58
How to test a ASP.NET Web API route using my contribution to WebApiContrib, RouteTestingExtensions.
using System.Web.Routing;
using WebApiContrib.Testing;
namespace FooBar
{
[TestFixture]
public void RouteFixture
{
[SetUp]
public void Setup()
@carolynvs
carolynvs / RequireHttpAttribute.cs
Last active December 11, 2015 06:18
RequireHttp attribute allows redirecting back to HTTP after visiting a secured page. Enables mixing secured and unsecured pages in ASP.NET MVC.
/// <summary>
/// Forces a secured (HTTPS) request to be resent over HTTP
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class RequireHttpAttribute : FilterAttribute, IAuthorizationFilter
{
public virtual void OnAuthorization(AuthorizationContext filterContext)
{
if(filterContext == null)
{
  1. On Rackspace Public Cloud, create an 8GB General Server with Ubuntu 14.04 PVHM.
  2. SSH in as root. If you are really cool, use tmux at this time.
  3. Install OpenStack Liberty
    bash <(curl -s https://raw.githubusercontent.com/openstack/openstack-ansible/liberty/scripts/run-aio-build.sh)
    
  4. Once complete, you can find the admin password in /root/openrc. Save it for later to log into Horizon.
  5. Fix the neutron endpoint to work with the SDK:
  6. lxc-ls | grep utility.
  7. lxc-attach -n aio1_utility_container-XXX. Replace XXX with the name you found in the last step.