Skip to content

Instantly share code, notes, and snippets.

View thinkclay's full-sized avatar

Clay Unicorn thinkclay

View GitHub Profile
@thinkclay
thinkclay / object-to-json.ftl
Last active January 12, 2020 00:08
Khoros/Freemarker utility macro for converting objects to JSON
<#macro objectToJson object, key = "unknown">
<@compress single_line=true>
<#if object?is_method>
${key}: "is_method"
<#elseif object?is_hash || object?is_hash_ex>
<#assign first="true">
{
<#list object as key, val>
<#if first="false">,</#if>
<#assign value><@objectToJson object=val!"null" key=key /></#assign>
@thinkclay
thinkclay / debugger.ftl
Last active August 9, 2020 06:22
Debugging in Khoros/Freemarker
<#ftl strip_text=true />
<#---
@homepage https://github.com/ratherblue/freemarker-debugger/
@license MIT
@version 1.0
@name freemarker-debugger
@description Macros and functions used to generate a tabular view of the .locals, .main, and .data model.
@see http://freemarker.org/docs/ref_specvar.html
@namespace debugger
@thinkclay
thinkclay / FooService.swift
Last active May 12, 2020 17:26
Swift iOS Networking Service
import Foundation
struct VOService {
public var baseUrl: String
static let shared = VOService(mode: .production)
init(mode: AppMode) {
switch (mode) {
@thinkclay
thinkclay / Restricted.tsx
Created June 21, 2020 16:25
Restriction HOC
/** @jsx createElement **/
import { createElement, FC, Fragment } from 'react'
import { connect } from 'react-redux'
import { RootState } from '@/models/app'
import { Auth, Roles, roleOptions } from '@/models/auth'
interface Props {
children: React.ReactNode
role?: Roles