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
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 |
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
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 |
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
exports.plugins = [ | |
{ | |
resolve: `gatsby-source-graphql`, | |
options: { | |
typeName: `WordPressNL`, | |
fieldName: `wordpressNL`, | |
url: `example.com/graphql` | |
} | |
}, | |
{ |
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
#!/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 |
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 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 } |
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
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) })) |
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 BeamExamples2 { | |
public fun process(input: PCollection<Person>): PCollection<String> { | |
return input.filter("Filter by age") { it.age >= 18 } | |
.map("Map to first name") { it.firstName } | |
} | |
} |
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 BeamExamples { | |
public fun filterByAge(input: PCollection<Person>, age: Int) | |
= input.apply("Filter by age", Filter.by(SerializableFunction<Person, Boolean> { it.age >= age }) | |
} |
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 BeamExamples { | |
public PCollection<Person> filterByAge(PCollection<Person> input, int age) { | |
return input.apply("Filter by age", Filter.by(p -> p.getAge() >= age)); | |
} | |
} |
NewerOlder