Skip to content

Instantly share code, notes, and snippets.

View sanderploegsma's full-sized avatar

Sander Ploegsma sanderploegsma

View GitHub Profile
inline fun <T> PCollection<T>.filter(name: String = "Filter", crossinline predicate: (T) -> Boolean): PCollection<T>
= this.apply(name, Filter.by(SerializableFunction<T, Boolean> { predicate(it) }))
inline fun <T, R> PCollection<T>.map(name: String = "Map", crossinline apply: (T) -> R): PCollection<R>
= this.apply(name, MapElements.into(object : TypeDescriptor<R>(){}).via({ apply(it) }))
class PCollectionUtilsTest {
@get:Rule
private val pipeline : TestPipeline = TestPipeline.create()
@Test
fun `PCollection - filter should correctly filter items`() {
val input = pipeline.apply(Create.of(1, 2, 3, 4, 5))
val output = input.filter { it > 3 }
#!/bin/sh
CLUSTER_CONFIG="/data/nodes.conf"
if [ -f ${CLUSTER_CONFIG} ]; then
if [ -z "${POD_IP}" ]; then
echo "Unable to determine Pod IP address!"
exit 1
fi
echo "Updating my IP to ${POD_IP} in ${CLUSTER_CONFIG}"
sed -i.bak -e '/myself/ s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/${POD_IP}/' ${CLUSTER_CONFIG}
fi
exports.plugins = [
{
resolve: `gatsby-source-graphql`,
options: {
typeName: `WordPressNL`,
fieldName: `wordpressNL`,
url: `example.com/graphql`
}
},
{
const path = require("path");
const pageTemplate = path.resolve("gatsby-page-template.js");
const pagesQuery = `
query Pages($language: String!) {
wordpress(language: $language) {
pages {
nodes {
id
slug
function fish_prompt
set last_status $status
if test $last_status -eq 0
set_color green
else
set_color red
end
echo -n '=> '
set_color normal