This file contains 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
#!/usr/bin/env bash | |
# Usage: | |
# | |
# - Run something: ./$ npm --version | |
# - Setup something: Add a suitable `prepare` script to your `package.json`, e.g. | |
# | |
# "scripts": { | |
# "prepare": "npm i -g @zeit/ncc" | |
# } |
This file contains 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
FROM registry.access.redhat.com/ubi7/ubi:latest AS build | |
RUN yum -y install --disableplugin=subscription-manager \ | |
java-11-openjdk | |
ARG kotlin_version=1.3.72 | |
RUN curl -LO https://github.com/JetBrains/kotlin/releases/download/v${kotlin_version}/kotlin-native-linux-${kotlin_version}.tar.gz \ | |
&& tar -xzf kotlin-native-linux-${kotlin_version}.tar.gz \ | |
&& rm kotlin-native-linux-${kotlin_version}.tar.gz |
This file contains 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
import com.google.common.base.Preconditions; | |
import javax.annotation.Nonnull; | |
import java.util.Iterator; | |
import java.util.Optional; | |
import java.util.function.Supplier; | |
import java.util.stream.Stream; | |
public class StreamUtils { | |
/** |
This file contains 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
#!/usr/bin/env bash | |
# Following https://discuss.gradle.org/t/gradle-with-self-signed-certificate/23036/9 | |
# Script assumes it's located in a subdirectory one level below the project root. | |
set -ue | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
cacerts_pwd="changeit" # JDK default |
This file contains 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
#!/usr/bin/env ruby | |
participants = [ | |
{ :name => "Santa", :email => "[email protected]" }, | |
{ :name => "Rudolf", :email => "[email protected]" }, | |
{ :name => "Ruprecht", :email => "[email protected]" } | |
] | |
def assign_gifts(folks) | |
perm = (0...folks.size).to_a.shuffle |
This file contains 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
gem 'json-schema' | |
require 'json-schema' | |
schema = <<~SCHEMA | |
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"title": "A test schema", | |
"type": "object", | |
"oneOf": [ | |
{ |
This file contains 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
import java.lang.RuntimeException | |
inline fun guard(predicate: Boolean, orElse: () -> Nothing) { | |
contract { | |
returns() implies predicate | |
callsInPlace(orElse, InvocationKind.AT_MOST_ONCE) // probably redundant | |
} | |
if (!predicate) { | |
orElse() |
This file contains 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
pipeline { | |
agent any | |
environment { | |
UPSOURCE_URL = "http://your.upsource" | |
UPSOURCE_PROJECT = "your-project" | |
UPSOURCE_AUTH = credentials('upsource-auth') | |
// ^^ set this up as "secret text" credential in Jenkins; | |
// use the authentication token from Upsource project settings > integration | |
} |
This file contains 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
{ | |
"b": { | |
"c": { | |
"foo": "bar" | |
} | |
} | |
} |
This file contains 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
fileprivate let badChars = CharacterSet.alphanumerics.inverted | |
extension String { | |
var uppercasingFirst: String { | |
return prefix(1).uppercased() + dropFirst() | |
} | |
var lowercasingFirst: String { | |
return prefix(1).lowercased() + dropFirst() | |
} |