Skip to content

Instantly share code, notes, and snippets.

View rainmaker2k's full-sized avatar

Kah Tang rainmaker2k

View GitHub Profile
@rainmaker2k
rainmaker2k / SampleRazorSimple
Last active December 15, 2015 01:59
Simple DD4T Razor Example
@using DD4T.Mvc.Html;
@using Sample.Web.Mvc.HtmlHelpers;
@model DD4T.ContentModel.Component
@{
Layout = "";
}
<h3>Example</h3>
@rainmaker2k
rainmaker2k / SampleRazorComplex
Created March 17, 2013 22:47
A little more complex piece of DD4T Razor view
@using DD4T.Mvc.Html;
@using Sample.Web.Mvc.HtmlHelpers;
@using DD4T.Mvc;
@model DD4T.ContentModel.Component
@{
Layout = "";
var linkFactory = FactoryService.LinkFactory;
var componentFactory = FactoryService.ComponentFactory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DD4T.ContentModel.Factories;
using DD4T.ContentModel.Exceptions;
namespace Sample.Corporate.Mapping.Tridion
{
public class ModelFactory: IModelFactory
@rainmaker2k
rainmaker2k / BuilderFactory.cs
Created March 19, 2013 20:39
Sample BuilderFactory
using System.Configuration;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;
namespace Sample.Corporate.Mapping.Tridion
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@rainmaker2k
rainmaker2k / GeneralBuilder.cs
Created March 19, 2013 20:44
Sample of a Builder that constructs a GeneralDetail ViewModel from an IComponentPresentation
namespace Sample.Corporate.Mapping.Tridion.Builders
{
using Sample.Corporate.Models;
using DD4T.ContentModel;
public class GeneralBuilder : BuilderBase
{
public GeneralDetail Create(IComponentPresentation componentPresentation)
{
var fields = componentPresentation.Component.Fields;
@rainmaker2k
rainmaker2k / GeneralDetail.cshtml
Created March 19, 2013 20:53
GeneralDetail view
@using Sample.Corporate.Models;
@model GeneralDetail
<h3>
@Model.Heading
</h3>
@foreach (var para in Model.Paragraphs)
{
<div class="block_level">
<div class="section_title verlagBlack green uppercased">
@para.SubTitle
@rainmaker2k
rainmaker2k / new_gist_file
Created August 8, 2013 19:41
Callback repeat pattern
(function (){
var MAXTIMES = 10;
function add(value, callback) {
console.log('Value: ' + value);
callback(null);
}
function adder(i, doneCallback) {
@rainmaker2k
rainmaker2k / upload_env_to_ssm.sh
Last active February 14, 2023 13:25
Put all key/value pairs into AWS SSM Parameter store
#!/bin/bash
SLIGRONLCDKENV=$(jq -r 'keys[] as $k | "\($k)=\(.[$k])"' env.json)
while read -r line; do
key=${line%=*}
val=${line#*=}
aws ssm put-parameter --name CDK_$key --value $val --type String 2>&1 > /dev/null
done <<< $SLIGRONLCDKENV