Skip to content

Instantly share code, notes, and snippets.

View EricRohlfs's full-sized avatar

Eric Rohlfs EricRohlfs

View GitHub Profile
@EricRohlfs
EricRohlfs / LastInWinsReplicationConflictResolver.cs
Created August 16, 2012 02:00 — forked from jtbennett/LastInWinsReplicationConflictResolver.cs
RavenDB LastInWinsReplicationConflictResolver
using System;
using System.Linq;
using NLog;
using Raven.Abstractions.Data;
using Raven.Bundles.Replication;
using Raven.Bundles.Replication.Plugins;
using Raven.Json.Linq;
namespace MyRavenReplicationBundle
{
'use strict';
(function() {
var mod = angular.module("App.services", []);
//register other services here...
/* pubsub - based on https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js*/
mod.factory('pubsub', function() {
var cache = {};
# force HTTP to HTTPS - /etc/nginx/conf.d/nonssl.conf
server {
listen 80;
server_name jira.example.com;
access_log off;
return 301 https://$server_name$request_uri;
}
# /etc/nginx/conf.d/jira.conf
server {
@EricRohlfs
EricRohlfs / gist:64bb6374e52fbdcc3047
Created May 7, 2015 20:42
Unit Testing Invalid Model State in WebApi2
[TestMethod]
public void WhenModelStateIsInvalidDoNotSave()
{
var mockRepo = new Mock<IProductRepo>();
mockRepo.Setup(x=>x.Save(It.IsAny<Product>());
var ctrl = new ProductController(mockRepo.Object);
ctrl.ModelState.AddModelError("SomeRandomProperty","SomeRandomProperty was not valid");
var actual = ctrl.Post(new Product());
# ---------- Main Vars to Change-----------------
$contentPath = 'C:\MyApp\content'
# find the file at example : C:\Users\me\AppData\Local\Temp on my computer
$OutPath = "$env:temp\SharePointProjectItem.spdata.fragment.xml"
# --------- End Main Vars to Change------------
# Code Summary
(function () {
/**
* Gist by @EricRohlfs for embeding yammer in an AngularJs SPA.
* Assumes you are using open graph and ng-route.
* Steps:
* 1. include the yammer api script as per their documentation
* <script type="text/javascript" src="https://assets.yammer.com/assets/platform_embed.js"></script>
* 2. Add the directives <yammer-embed/> or <yammer-follow/> to your page.
* 3. in your route config add the openGraph property for each route
# Downloads all the git projects from a Microsoft Visual Studio Team Services (VSTS) account.
# Helpful if a team has many git repositories.
# change these
$project = "myProject"
$whereToSaveRoot = "d:\myProject\"
# application start
$username = Read-Host -Prompt 'UserName from VSTS Alt Credentials'
# PowerShell script to publish all the nuget packages in a project to VSTS Package server
$Dir = get-childitem D:\_delete\blah\WebApplication4 -recurse
# $Dir |get-member
$List = $Dir | where {$_.extension -eq ".nupkg"}
$List | format-table name
$List | ForEach-Object{
$tempPath = Join-Path $_.Directory $_.name
D:\nuget.exe push -Source "MyNugetServerNameOrUrl" -ApiKey VSTS $tempPath
}
# not really complete, but does keep the first few digits in a sharedassembly.cs file script.
##-----------------------------------------------------------------------
## <copyright file="ApplyVersionToAssemblies.ps1">(c) http://TfsBuildExtensions.codeplex.com/. This source is subject to the Microsoft Permissive License. See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. All other rights reserved.</copyright>
##-----------------------------------------------------------------------
# Look for a 0.0.0.0 pattern in the build number.
# If found use it to version the assemblies.
#
# For example, if the 'Build number format' build process parameter
# $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
# then your build numbers come out like this:
const mockCommit = function (mutations, state) {
return function (type, payload) {
mutations[type](state, payload)
}
}
// how to do async unit test for vuex without creating a full store.
describe('inFlight vuex', () => {
let state
let mutations