Skip to content

Instantly share code, notes, and snippets.

View tonyerskine's full-sized avatar

Tony Erskine tonyerskine

View GitHub Profile
{
"date": "2021-10-13T14:13:28Z",
"cost": 12.34,
"mealsByPerson": [
{
"Tom": {
"meat": "bacon",
"eggs": "scrambled",
"side": "hashbrowns"
}
@tonyerskine
tonyerskine / ToMap.groovy
Created December 9, 2019 18:09
Groovy/Grails ToMap Trait: Convert POGO to Map
/**
* This Trait adds a ToMap(..) methods to a POGO, which convert the object to a Map<String, Object>
* ignoring extraneous fields such as synthetic, static, grails domain classes, and collections.
* It is designed to be used preprocess Grails domain object proir to converting to JSON. However,
* it does not require Grails to work.
*/
import groovy.transform.InheritConstructors
import org.codehaus.groovy.grails.commons.DomainClassArtefactHandler
import org.springframework.validation.Errors
@tonyerskine
tonyerskine / User Input View.xml
Last active January 29, 2017 05:22
Odoo Survey User Input Line Combined Answer Field
<?xml version="1.0"?>
<form string="Survey User inputs" create="false">
<header>
<button name="action_survey_resend" string="Send Invitation Again" type="object" class="oe_highlight" attrs="{'invisible': ['|', ('type','=','manually'), ('state', '=', 'done')]}"/>
<button name="action_view_answers" states="done" string="Print These Answers" type="object" class="oe_highlight"/>
<button name="action_survey_results" string="View Results" type="object"/>
<field name="state" widget="statusbar"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box"/>
@tonyerskine
tonyerskine / README.MD
Last active February 22, 2024 13:14
Windows Script to Convert Excel Files to CSV

Instructions

  1. Copy both files into the directory containing the files you want converted
  2. Run excel-to-csv.bat

Note: This script requires Excel to be installed.

@tonyerskine
tonyerskine / RestfulLinkGeneratorTrait.groovy
Last active December 15, 2016 23:15
Grails Restful Link Generator
import grails.web.mapping.LinkGenerator
/**
* Copyright (c) 2016 SharpTop Software, LLC
*/
trait RestfulLinkGeneratorTrait {
LinkGenerator grailsLinkGenerator
String generateLink(Map map) {
@tonyerskine
tonyerskine / HTML returned for book | index
Created August 3, 2016 03:50
Grails 3.1.9 Layout Bug
<html>
<head>
<title>Book List</title>
<meta name="layout" content="main"/>
</head>