Skip to content

Instantly share code, notes, and snippets.

Avatar

Charles Ouellet couellet

View GitHub Profile
View test.js
var copyAttribute = function (attr, source, target, altAttr) {
if (!!altAttr && !!source.data(altAttr)) {
target.data(attr, source.data(altAttr));
}
else {
target.data(attr, source.data(attr));
}
};
var setSnipAttributes = function (item) {
View snipcart.cs
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using RestSharp;
using RestSharp.Authenticators;
/*
You will need to install these two NuGet packages:
Install-Package RestSharp
Install-Package Newtonsoft.Json
@couellet
couellet / gist:5864798
Last active Dec 18, 2015
Generate links with AttributeRouting for WebApi
View gist:5864798
public class OrdersController : ApiController
{
// RouteName parameter is mandatory to generate URLs.
[GET("api/orders/{orderId}/items", RouteName = "GetOrderItems")]
public HttpResponseMessage GetOrderItems(int orderId)
{
var myUrl = Url.Link("GetOrderItems", new { orderId = orderId });
return Request.CreateResponse(HttpStatusCode.OK);
}
View EntityFrameworkSession
public abstract class Entity
{
public int Id {get;set;}
}
public class EntityFrameworkSession : ISession
{
private readonly DbContext context;
public EntityFrameworkSession(DbContext context)
You can’t perform that action at this time.