This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CountdownTagLib { | |
| static namespace = "ct" | |
| def down = { args -> | |
| out << """ | |
| <span id='conf-countdown'></span> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/jquery-countdown/1.6.1/jquery.countdown.min.js"></script> | |
| <script> | |
| (function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.danveloper.springboot | |
| import org.springframework.beans.factory.annotation.Autowired | |
| import org.springframework.boot.SpringApplication | |
| import org.springframework.boot.autoconfigure.EnableAutoConfiguration | |
| import org.springframework.context.ApplicationContext | |
| import org.springframework.context.annotation.Bean | |
| import org.springframework.context.annotation.Configuration | |
| import org.springframework.integration.dsl.groovy.IntegrationContext | |
| import org.springframework.integration.dsl.groovy.builder.AbstractIntegrationBuilderModuleSupport |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Main { | |
| static void main(args) { | |
| def glassfish = new GlassFishProperties().with { | |
| setPort "http-listener", 8080 | |
| GlassFishRuntime.bootstrap().newGlassFish(it).with { | |
| start() | |
| it | |
| } | |
| } | |
| glassfish.commandRunner.run "deploy", args?.getAt(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apply plugin: 'groovy' | |
| apply plugin: 'idea' | |
| repositories { | |
| flatDir { dirs 'lib' } | |
| maven { url "https://maven.java.net/content/repositories/releases" } | |
| mavenCentral() | |
| } | |
| sourceCompatibility = '1.8' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| buildscript { | |
| repositories { | |
| mavenCentral() | |
| maven { url 'http://repo.grails.org/grails/repo' } | |
| } | |
| dependencies { | |
| classpath "org.grails:grails-gradle-plugin:2.0.0-SNAPSHOT" | |
| } | |
| } | |
| repositories { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def forkTests = System.properties['grails.project.fork.test'] ? Boolean.getBoolean("grails.project.fork.test") : true | |
| grails.project.fork = [ | |
| test: forkTests ? [maxMemory: 1024, minMemory: 64, debug: false, maxPerm: 768, daemon: true] : false, | |
| run: [maxMemory: 1024, minMemory: 64, debug: false, maxPerm: 768, forkReserve: false], | |
| war: [maxMemory: 1024, minMemory: 64, debug: false, maxPerm: 768, forkReserve: false], | |
| console: [maxMemory: 1024, minMemory: 64, debug: false, maxPerm: 768] | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Grab("io.ratpack:ratpack-rx:0.9.1") | |
| import ratpack.launch.* | |
| import ratpack.rx.internal.* | |
| def cfg = LaunchConfigBuilder.baseDir(new File("/tmp")).build() | |
| def rx = new DefaultRxBackground(cfg.background) | |
| def list = ['fee', 'fie', 'fo', 'fum'] | |
| def str = "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface WebFlowScope { | |
| static final Map scopeMap = new HashMap(); | |
| Object getAttribute(Object key); | |
| default public Object put(Object key, Object val) { | |
| scopeMap.put(key, val); | |
| return getAttribute(key); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Reference to ArrayList type | |
| var List = Java.type("java.util.ArrayList"); | |
| // An interface that provides default implementations for java.util.function.{Consumer,Function} | |
| var ConsumingFunction = Java.type("midwestjs.nashorn.ConsumingFunction"); | |
| // Convert appropriately | |
| function toFunc(fn) { | |
| return new ConsumingFunction() { | |
| apply: function(a) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @RequestMapping(value = "/{id}", method = RequestMethod.PUT) | |
| public HttpEntity update(@PathVariable String id, HttpServletRequest request) throws IOException { | |
| ProductDetail existing = find(id); | |
| ProductDetail updated = objectMapper.readerForUpdating(existing).readValue(request.getReader()); | |
| MutablePropertyValues propertyValues = new MutablePropertyValues(); | |
| propertyValues.add("productId", updated.getProductId()); | |
| propertyValues.add("productName", updated.getProductName()); | |
| propertyValues.add("shortDescription", updated.getShortDescription()); | |
| propertyValues.add("longDescription", updated.getLongDescription()); |