Skip to content

Instantly share code, notes, and snippets.

View robertmclaws's full-sized avatar

Robert McLaws robertmclaws

View GitHub Profile
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
<Configurations>Debug;Release;WEB-DEV;WEB-PROD</Configurations>
</PropertyGroup>
@robertmclaws
robertmclaws / BindingRedirectFixer.cs
Created August 20, 2017 16:50
Sorts AssemblyBindingRedirects and Removes Duplicates
// ===========================================
// Fix AssemblyBindingRedirects
// Prototype by Robert McLaws (@robertmclaws)
// Last Updated 20 Aug 2017
// ===========================================
//RWM: Set these to your specific project.
var projectFolder = @"D:\GitHub\SomeSolution\src\SomeProject";
const string configFile = "app.config";
@robertmclaws
robertmclaws / PackagesUpgrader.cs
Last active August 20, 2017 02:08
Upgrades packages.config to VS2017's PackageReferences
// ===========================================
// Kill Packages.config With 🔥🔥🔥
// Prototype by Robert McLaws (@robertmclaws)
// Last Updated 19 Aug 2017
// ===========================================
//RWM: Set these to your specific project.
var projectFolder = @"D:\GitHub\SomeCoolApp\src\SomeProject";
var projectFile = @"SomeProject.csproj";
@robertmclaws
robertmclaws / kendo.bootstrap-integrated.less
Created April 9, 2015 15:04
Simpler way to integrate Kendo and Bootstrap
/*
* Kendo UI Complete v2013.1.529 (http://kendoui.com)
* Copyright 2013 Telerik AD. All rights reserved.
*
* Kendo UI Complete commercial licenses may be obtained at
* https://www.kendoui.com/purchase/license-agreement/kendo-ui-complete-commercial.aspx
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
@import "../Bootstrap/variables.less";
@robertmclaws
robertmclaws / Auth0LockUtilities.js
Created April 5, 2015 20:04
How to use Auth0 Lock with .NET
function signin(returnUrl?: string, targetId?: string, showChrome: boolean = true) {
//RWM: We declare a new version every time because the old one gets disposed.
var lock = new Auth0Lock(auth0ClientId, auth0Domain);
lock.showSignin({
callbackURL: window.location.origin + "/signin-auth0",
authParams: {
state: returnUrl !== "" ? "ru=" + returnUrl : null,
scope: "openid profile"
},
container: targetId,
@robertmclaws
robertmclaws / Auth0.cs
Created February 15, 2015 03:48
Auth0 Rule Models
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace AdvancedREI.Project.Areas.External.Models
{
[DataContract]
public class Identity
{
@robertmclaws
robertmclaws / Program.cs
Last active August 29, 2015 14:06
Our current WebJobs method signature
public static void ProcessQueueMessage([QueueTrigger("events")] byte[] messageEnvelope)
{
var message = messageEnvelope.Deserialize<string>());
Trace.WriteLine(message).
}
public static T Deserialize<T>(this byte[] data) where T : class
{
if (data == null)
{
@robertmclaws
robertmclaws / table.read.js
Created January 31, 2014 17:44
Example of outputting the Mobile Services query object to SQL for use in custom queries.
function read(query, user, request) {
query.toSql = function() {
var result = "";
var queryComponents = query.getComponents();
//RWM: Reflection component for getting the sort order.
if (queryComponents.ordering != null) {
queryComponents.ordering.getProperties = function() {
var properties = [];
for (var prop in this) {
@robertmclaws
robertmclaws / [yourmobileservicesschema].[GetAvgRatingForPicture].sql
Last active January 3, 2016 04:29
Computed Columns in Azure Mobile Services
CREATE FUNCTION [yourmobileservicesschema].[GetAvgRatingForPicture](@pictureId bigint)
RETURNS int
AS
BEGIN
DECLARE @r decimal(3,2)
select @r = AVG(rating) from PictureRatings where picture_id = @pictureId
RETURN @r
END
@robertmclaws
robertmclaws / App.xaml.cs
Last active January 12, 2017 03:25
Windows Phone 8 In-App Purchase End-to-End Example using Telerik Windows Phone Controls
public partial class App : Application
{
public static ListingInformation MarketplaceListing { get; set; }
//RWM: The rest of your startup code goes here...
}