Skip to content

Instantly share code, notes, and snippets.

Christoph Dähne christoph-daehne

Block or report user

Report or block christoph-daehne

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View BetterBouquetDsl.groovy
// our configuration model
class BouquetConfiguration extends ArrayList<String> {
int howMany(String flower) {
return this.count { it == flower }
}
String toString() {
return "Bouquet: " + this.toString()
}
View FloristDsl.groovy
class BouquetConfiguration extends ArrayList<String> {
int howMany(String flower) {
return this.count { it == flower }
}
String toString() {
return "Bouquet: " + this.toString()
}
}
View BetterBouquetDsl.groovy
// our configuration model
class BouquetConfiguration extends ArrayList<String> {
int howMany(String flower) {
return this.count { it == flower }
}
String toString() {
return "Bouquet: " + this.toString()
}
@christoph-daehne
christoph-daehne / CorsFilter.kt
Created Jul 3, 2017
Set CORS Headers in Spring Boot Kotlin project with WebFlux and Reactor
View CorsFilter.kt
import org.springframework.http.HttpMethod
import org.springframework.http.HttpStatus
import org.springframework.stereotype.Component
import org.springframework.web.server.ServerWebExchange
import org.springframework.web.server.WebFilter
import org.springframework.web.server.WebFilterChain
import reactor.core.publisher.Mono
@Component
class CorsFilter : WebFilter {
@christoph-daehne
christoph-daehne / CorsComponent.php
Last active Jul 4, 2017
Enable CORS in a Flow Framework Application
View CorsComponent.php
<?php
namespace Your\Package\Name\Http;
use Neos\Flow\Http\Component\ComponentChain;
use Neos\Flow\Http\Component\ComponentContext;
use Neos\Flow\Http\Component\ComponentInterface;
/**
* !!! be aware that this component enables CORS for the entire application !!!
View ZipUtils.java
import java.io.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class ZipUtils {
/**
* @param source zip stream
* @param target target directory
* @throws IOException extraction failed
@christoph-daehne
christoph-daehne / HighlightedHelloWorldDsl.groovy
Last active Oct 20, 2016
Highlighted Groovy DSL example: Hello World
View HighlightedHelloWorldDsl.groovy
class HelloWorldService {
void printHelloWorld() {
println("Hello World")
}
}
class HelloWorldScript {
// by annotating the parameter we gain syntax highlighting and auto-completion
static void execute(@DelegatesTo(strategy = Closure.DELEGATE_FIRST, value = HelloWorldService) Closure script) {
script.resolveStrategy = Closure.DELEGATE_FIRST
View usage-findAll.hbs
{{findAll persons field="isFriend" assignTo="friends"}}
{{#sort friends sortBy="name" assignTo="sorted"}}
{{#each sorted}}
{{/each}}
{{/sort}}
{{/findAll}}
View usage-x-sort-by.hbs
{{x-sort-by list=friends property="name" as |sorted|}}
{{#each sorted as |friend|}}
{{/each}}
{{/x-sort-by}}
View x-sort-by.js
import Ember from 'ember';
/**
* use "{{yield sorted}}" as handlebars template
*/
export default Ember.Component.extend({
list: undefined,
property: undefined,
sorted: function () {
You can’t perform that action at this time.