Skip to content

Instantly share code, notes, and snippets.

View acreeger's full-sized avatar

Adam Creeger acreeger

  • Engineering Manager, Facebook
  • New York, NY
View GitHub Profile
using Microsoft.CommerceServer.Catalog;
using Microsoft.CommerceServer.Runtime.Profiles;
namespace Enticify.CommerceServer.Tests.Scenarios
{
public class PromoInfoSourceApi
{
public void GetPromoInfoForProductAndDoSomething(Product csProduct, Profile csUserProfile)
{
var promotionQueryService = new PromotionQueryService();
@acreeger
acreeger / Spock-Tests-for-truncate-tag.groovy
Created January 6, 2012 20:25 — forked from RGBz/truncate-abbr
Grails truncate tag with abbr
def "truncate works for text longer than max length"() {
setup:
def fullText = ("D" * 2) + "&" + ("D" * 12)
def maxLength = "10"
when:
tagLib.truncate(maxlength:maxLength, {fullText})
then:
tagLib.out.toString() == createdTruncatedAbbr(fullText,maxLength)
@acreeger
acreeger / truncate-abbr
Created January 6, 2012 20:25 — forked from RGBz/truncate-abbr
Grails truncate tag with abbr
def truncate = { attrs, body ->
if (body().length() > attrs.maxlength.toInteger()) {
out << """<abbr title="${body()}">${body()[0..attrs.maxlength.toInteger() - 1]}...</abbr>"""
} else {
out << body()
}
}