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 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 { |
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 |
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 () { |
View FindAllHelper.groovy
import com.github.jknack.handlebars.Context | |
import com.github.jknack.handlebars.Helper | |
import com.github.jknack.handlebars.Options | |
/** | |
* filters a list and adds a variable to the context | |
* | |
* options: | |
* - assignTo: name of the variable to add to the context | |
* - field: (optional) filter by "trueness" of the given property (this is default) |
View rx.Observable.chaining.example.groovy
@Grab(group='io.reactivex', module='rxjava-reactive-streams', version='0.5.0') | |
import rx.Observable | |
def in1 = Observable.from([1, 3, 5]).map { a -> a - 1 } | |
def in2 = Observable.from([2, 4, 6]).map { a -> a - 1 } | |
def in3 = Observable.error(new Exception("BAM!")) | |
def sumTimes2 = Observable.zip(in1, in2) { a, b -> | |
a + b | |
}.map { a -> |
View BetterBouquetDsl.groovy
// our configuration model | |
class BouquetConfiguration extends ArrayList<String> { | |
int howMany(String flower) { | |
return this.count { it == flower } | |
} | |
String toString() { | |
return "Bouquet: " + flowers.toString() | |
} |
View FloristDsl.groovy
class BouquetConfiguration extends ArrayList<String> { | |
int howMany(String flower) { | |
return this.count { it == flower } | |
} | |
String toString() { | |
return "Bouquet: " + flowers.toString() | |
} | |
} |
NewerOlder