text:
# protokt

[![CircleCI](https://circleci.com/gh/open-toast/protokt.svg?style=svg)](https://circleci.com/gh/open-toast/protokt)
[![Maven Central](https://img.shields.io/maven-central/v/com.toasttab.protokt/protokt-runtime)](https://search.maven.org/artifact/com.toasttab.protokt/protokt-codegen)
[![Gradle Portal](https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/com/toasttab/protokt/protokt-gradle-plugin/maven-metadata.xml.svg?label=gradle-portal&color=yellowgreen)](https://plugins.gradle.org/plugin/com.toasttab.protokt)

Protocol Buffer compiler and runtime for Kotlin.

Supports only version 3 of the Protocol Buffers language.

* [Overview](#overview)
  + [Features](#features)
  + [Not yet implemented](#not-yet-implemented)
  + [Compatibility](#compatibility)
* [Usage](#usage)
  + [Gradle](#gradle)
  + [Generated Code](#generated-code)
* [Runtime Notes](#runtime-notes)
  + [Package](#package)
  + [Message](#message)
  + [Enums](#enums)
    - [Representation](#representation)
    - [Naming](#naming)
  + [Other Notes](#other-notes)
* [Extensions](#extensions)
  + [Wrapper Types](#wrapper-types)
  + [Non-null fields](#non-null-fields)
  + [Interface implementation](#interface-implementation)
    - [Messages](#messages)
    - [Oneof Fields](#oneof-fields)
  + [BytesSlice](#bytesslice)
* [gRPC code generation](#grpc-code-generation)
  + [Generated gRPC code](#generated-grpc-code)
  + [Integrating with gRPC's Java API](#integrating-with-grpcs-java-api)
  + [Integrating with gRPC's Kotlin API](#integrating-with-grpcs-kotlin-api)
* [IntelliJ integration](#intellij-integration)
* [Command line code generation](#command-line-code-generation)
* [Contribution](#contribution)
* [Acknowledgements](#acknowledgements)
  + [Authors](#authors)

## Overview

### Features
- Idiomatic and concise [Kotlin builder DSL](#generated-code)
- Protokt-specific options: [non-null types](#non-null-fields),
[wrapper types](#wrapper-types),
[interface implementation](#interface-implementation),
and more
- Representation of the well-known types as Kotlin nullable types: `StringValue`
is represented as `String?`, etc.
- Built on Protobuf's Java library: usage of CodedInputStream and
CodedOutputStream for best performance
- gRPC [method descriptor and service descriptor generation](#grpc-code-generation)
for use with [grpc-java](#integrating-with-grpcs-java-api) or
[grpc-kotlin](#integrating-with-grpcs-kotlin-api) (see examples  in [examples](examples))

### Not yet implemented

- Kotlin/Native support
- Kotlin/JS support
- Protobuf JSON support

### Compatibility

The Gradle plugin requires Java 8+ and Gradle 5.6+. It runs on recent versions of
MacOS, Linux, and Windows.

The runtime and generated code are compatible with Kotlin 1.4+, Java 8+, and Android 4.4+.

## Usage

See examples in [testing](testing).

### Gradle

```groovy
plugins {
  id "com.toasttab.protokt" version "<version>"
}
```
or

```groovy
buildscript {
  dependencies {
    classpath 'com.toasttab.protokt:protokt-gradle-plugin:<version>'
  }
}

apply plugin: 'com.toasttab.protokt'
```

This will automatically download and install protokt, apply the Google protobuf
plugin, and configure all the necessary boilerplate. By default it will also add
`protokt-core` to the `api` scope of the project. You must explicitly choose to
depend on `protobuf-java` or `protobuf-javalite`:

```groovy
dependencies {
  'com.google.protobuf:protobuf-java:<version>'
}
```

or

```groovy
dependencies {
  'com.google.protobuf:protobuf-javalite:<version>'
}
```

If your project is pure Kotlin you may run into the following error:

```
Execution failed for task ':compileJava'.
> error: no source files
```

To work around it, disable all `JavaCompile` tasks in the project:

```groovy
tasks.withType(JavaCompile) {
  enabled = false
}
```

or:

```groovy
compileJava.enabled = false
```

### Generated Code

Generated code is placed in `<buildDir>/generated-sources/<sourceSet.name>/protokt`.

A simple example:

```protobuf
syntax = "proto3";

package toasttab.protokt.sample;

message Sample {
  string sample_field = 1;
}
```

will produce:

```kotlin
/*
 * Generated by protokt version <version>. Do not modify.
 * Source: toasttab/protokt/sample/sample.proto
 */

package toasttab.protokt.sample

import com.toasttab.protokt.rt.KtDeserializer
import com.toasttab.protokt.rt.KtGeneratedMessage
import com.toasttab.protokt.rt.KtMessage
import com.toasttab.protokt.rt.KtMessageDeserializer
import com.toasttab.protokt.rt.KtMessageSerializer
import com.toasttab.protokt.rt.Tag
import com.toasttab.protokt.rt.UnknownFieldSet
import com.toasttab.protokt.rt.sizeof

@KtGeneratedMessage("toasttab.protokt.sample.Sample")
class Sample
private constructor(
    val sampleField: String,
    val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : KtMessage {
    override val messageSize by lazy { messageSize() }

    override fun serialize(serializer: KtMessageSerializer) {
        if (sampleField.isNotEmpty()) {
            serializer.write(Tag(10)).write(sampleField)
        }
        serializer.writeUnknown(unknownFields)
    }

    private fun messageSize(): Int {
        var res = 0
        if (sampleField.isNotEmpty()) {
            res += sizeof(Tag(1)) + sizeof(sampleField)
        }
        res += unknownFields.size()
        return res
    }

    override fun equals(other: Any?): Boolean =
        other is Sample &&
            other.sampleField == sampleField &&
            other.unknownFields == unknownFields

    override fun hashCode(): Int {
        var result = unknownFields.hashCode()
        result = 31 * result + sampleField.hashCode()
        return result
    }

    override fun toString(): String =
        "Sample(" +
            "sampleField=$sampleField, " +
            "unknownFields=$unknownFields)"

    fun copy(dsl: SampleDsl.() -> Unit) =
        Sample {
            sampleField =<EMAIL_ADDRESS>            unknownFields =<EMAIL_ADDRESS>            dsl()
        }

    class SampleDsl {
        var sampleField = ""
        var unknownFields = UnknownFieldSet.empty()

        fun build() =
            Sample(
                sampleField,
                unknownFields
            )
    }

    companion object Deserializer : KtDeserializer<Sample>, (SampleDsl.() -> Unit) -> Sample {
        override fun deserialize(deserializer: KtMessageDeserializer): Sample {
            var sampleField = ""
            var unknownFields: UnknownFieldSet.Builder? = null

            while (true) {
                when (deserializer.readTag()) {
                    0 ->
                        return Sample(
                            sampleField,
                            UnknownFieldSet.from(unknownFields)
                        )
                    10 -> sampleField =
                        deserializer.readString()
                    else -> unknownFields =
                        (unknownFields ?: UnknownFieldSet.Builder()).also {
                            it.add(deserializer.readUnknown())
                        }
                }
            }
        }

        override fun invoke(dsl: SampleDsl.() -> Unit) =
            SampleDsl().apply(dsl).build()
    }
}
```

Construct your protokt object like so:

```kotlin
Sample {
    sampleField = "some-string"
}
```

Why not expose a public constructor or use a data class? One of the design goals
of protocol buffers is that protobuf definitions can be modified in
backwards-compatible ways without breaking wire or API compatibility of existing
code. Using a DSL to construct the object emulates named arguments and allows
shuffling of protobuf fields within a definition without breaking code as would
happen for a standard constructor or method call.

The canonical `copy` method on data classes is emulated via a generated `copy`
method:

```kotlin
val sample = Sample { sampleField = "some-string" }

val sample2 = sample.copy { sampleField = "some-other-string" }
```

Assigning a Map or List in the DSL makes a copy of that collection to prevent
any escaping mutability of the provided collection. The Java protobuf
implementation takes a similar approach; it only exposes mutation methods on the
builder and not assignment. Mutating the builder does a similar copy operation.

## Runtime Notes

### Package

By default, the Kotlin package of a generated file is the same as the protobuf
package. Second in precedence is the declared `java_package` option, which can
be disabled by setting the `respectJavaPackage` property to `false` in the
Gradle configuration block:

```groovy
protokt {
  respectJavaPackage = false
}
```

Disabling this option at the code-generator level can be helpful when migrating
a codebase already using third-party protobuf with the `java_package` option in
use to prevent duplicate class issues.

Highest precedence is given to the `(protokt.file).kotlin_package` option:

```protobuf
syntax = "proto3";

import "protokt/protokt.proto";

package example;

option (protokt.file).kotlin_package = "com.example";

...
```

### Message

Each protokt message implements the `KtMessage` interface. `KtMessage` defines
the `serialize()` method and its overloads which can serialize to a byte array,
a `KtMessageSerializer`, or an `OutputStream`.

Each protokt message has a companion object `Deserializer` that implements the
`KtDeserializer` interface, which provides the `deserialize()` method and its
overloads to construct an instance of the message from a byte array, a Java
InputStream, or others.

### Enums

#### Representation

Protokt represents enum fields as sealed classes with an integer value and name.
Protobuf enums cannot be represented as Kotlin enum classes since Kotlin enum
classes are closed and cannot represent unknown values. The Protocol Buffers
specification requires that unknown enum values are preserved for
reserialization, so this compromise enables exhaustive case switching while
allowing representation of unknown values.

```kotlin
sealed class PhoneType(
    override val value: Int,
    override val name: String
) : KtEnum() {
    object MOBILE : PhoneType(0, "MOBILE")

    object HOME : PhoneType(1, "HOME")

    object WORK : PhoneType(2, "WORK")

    class UNRECOGNIZED(value: Int) : PhoneType(value, "UNRECOGNIZED")

    companion object Deserializer : KtEnumDeserializer<PhoneType> {
        override fun from(value: Int) =
            when (value) {
                0 -> MOBILE
                1 -> HOME
                2 -> WORK
                else -> UNRECOGNIZED(value)
            }
    }
}
```

#### Naming

To keep enums ergonomic while promoting protobuf best practices, enums that have
all values
[prefixed with the enum type name](https://developers.google.com/protocol-buffers/docs/style#enums)
will have that prefix stripped in their Kotlin representations.

### Other Notes

- `optimize_for` is ignored.
- `repeated` fields are represented as Lists.
- `map` fields are represented as Maps.
- `oneof` fields are represented as subtypes of a sealed base class with a
single property.
- `bytes` fields are wrapped in the protokt `Bytes` class to ensure immutability
akin to `protobuf-java`'s `ByteString`.
- Protokt implements proto3's `optional`.

## Extensions

See examples of each option in the [options](testing/options/src/main/proto)
project. All protokt-specific options require importing `protokt/protokt.proto`
in the protocol file.

### Wrapper Types

Sometimes a field on a protobuf message corresponds to a concrete nonprimitive
type. In standard protobuf the user would be responsible for this extra
transformation, but the protokt wrapper type option allows specification of a
converter that will automatically encode and decode custom types to protobuf
types. Some standard types are implemented in [extensions](extensions).

Wrap a field by invoking the `(protokt.property).wrap` option:

```protobuf
message WrapperMessage {
  google.protobuf.Timestamp instant = 1 [
    (protokt.property).wrap = "java.time.Instant"
  ];
}
```

Converters implement the
[Converter](extensions/protokt-extensions-api/src/main/kotlin/com/toasttab/protokt/ext/Converter.kt)
interface:

```kotlin
interface Converter<S : Any, T : Any> {
    val wrapper: KClass<S>

    val wrapped: KClass<T>

    fun wrap(unwrapped: T): S

    fun unwrap(wrapped: S): T
}
```

and protokt will reference the converter's methods to wrap and unwrap from
protobuf primitives:

```kotlin
object InstantConverter : Converter<Instant, Timestamp> {
    override val wrapper = Instant::class

    override val wrapped = Timestamp::class

    override fun wrap(unwrapped: Timestamp): Instant =
        Instant.ofEpochSecond(unwrapped.seconds, unwrapped.nanos.toLong())

    override fun unwrap(wrapped: Instant) =
        Timestamp {
            seconds = wrapped.epochSecond
            nanos = wrapped.nano
        }
}
```

```kotlin
class WrapperModel
private constructor(
    val instant: Instant?,
    ...
) : KtMessage {
    ...
    override fun serialize(serializer: KtMessageSerializer) {
        if (instant != null) {
            serializer.write(Tag(42)).write(InstantConverter.unwrap(instant))
        }
        ...
    }

    override fun deserialize(deserializer: KtMessageDeserializer): WrapperModel {
        var instant: Instant? = null
        ...
        while (true) {
            when (deserializer.readTag()) {
                0 ->
                    return WrapperModel(
                        instant,
                        ...
                    )
                8 -> instant =
                    InstantConverter.wrap(deserializer.readMessage(Timestamp))
                ...
            }
        }
    }
}
```

Each converter must be registered in a
`META-INF/services/com.toasttab.protokt.ext.Converter`
classpath resource following the standard `ServiceLoader` convention. For
example, Google's [AutoService](https://github.com/google/auto/tree/master/service)
can register converters with an annotation:

```kotlin
@AutoService(Converter::class)
object InstantConverter : Converter<Instant, Timestamp> { ... }
```

Converters can also implement the `OptimizedSizeofConverter` interface adding
`sizeof()`, which allows them to optimize the calculation of the wrapper's size
rather than unwrap the object twice. For example, a UUID is always 16 bytes:

```kotlin
object UuidConverter : OptimizedSizeofConverter<UUID, ByteArray> {
    override val wrapper = UUID::class

    override val wrapped = ByteArray::class

    private val sizeofProxy = ByteArray(16)

    override fun sizeof(wrapped: UUID) =
        sizeof(sizeofProxy)

    override fun wrap(unwrapped: ByteArray): UUID {
        require(unwrapped.size == 16) {
            "UUID source must have size 16; had ${unwrapped.size}"
        }

        return ByteBuffer.wrap(unwrapped)
            .run { UUID(long, long) }
    }

    override fun unwrap(wrapped: UUID): ByteArray =
        ByteBuffer.allocate(16)
            .putLong(wrapped.mostSignificantBits)
            .putLong(wrapped.leastSignificantBits)
            .array()
}
```

Rather than convert a UUID to a byte array both for size calculation and for
serialization (which is what a naïve implementation would do), UuidConverter
always returns the size of a constant 16-byte array.

If the wrapper type is in the same package as the generated protobuf message,
then it does not need a fully-qualified name. Custom wrapper type converters can
be in the same project as protobuf types that reference them. In order to use any
wrapper type defined in `extensions`, the project must be included as a
dependency:

```groovy
dependencies {
  protoktExtensions 'com.toasttab.protokt:protokt-extensions:<version>'
}
```

Wrapper types that wrap protobuf messages are nullable. For example,
`java.time.Instant` wraps the well-known type `google.protobuf.Timestamp`. They
can be made non-nullable by using the non-null option described below.

Wrapper types that wrap protobuf primitives, for example `java.util.UUID`
which wraps `bytes`, are not nullable and may present malformed inputs to
converters when absent in deserialization. It is up to the converter to
determine what behavior should be in these cases. To represent nullable
primitive wrappers use well-known types or Proto3's `optional`. For example for
a nullable UUID:

```protobuf
google.protobuf.BytesValue uuid = 1 [
  (protokt.property).wrap = "java.util.UUID"
];

// or:
optional bytes optional_uuid = 2 [
  (protokt.property).wrap = "java.util.UUID"
];
```

Wrapper types can be repeated:

```protobuf
repeated bytes uuid = 1 [
  (protokt.property).wrap = "java.util.UUID"
];
```

And they can also be used for map keys and values:
```protobuf
map<string, protokt.ext.InetSocketAddress> map_string_socket_address = 1 [
  (protokt.property).key_wrap = "StringBox",
  (protokt.property).value_wrap = "java.net.InetSocketAddress"
];
```

Wrapper types should be immutable. If a wrapper type is defined in the same
package as generated protobuf message that uses it, then it does not need to
be referenced by its fully-qualified name and instead can be referenced by its
simple name, as done with `StringBox` in the map example above.

_N.b. Well-known type nullability is implemented with
[predefined wrapper types](protokt-core/src/main/kotlin/com/toasttab/protokt)
for each message defined in
[wrappers.proto](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/wrappers.proto)._

### Non-null fields
If a message has no meaning whatsoever when a particular non-scalar field is
missing, you can emulate proto2's `required` key word by using the
`(protokt.property).non_null` option:

```protobuf
message Sample {}

message NonNullSampleMessage {
  Sample non_null_sample = 1 [
    (protokt.property).non_null = true
  ];
}
```

Generated code will not have a nullable type, so the field can be referenced
without using Kotlin's `!!`.

Oneof fields can also be declared non-null:

```protobuf
message NonNullSampleMessage {
  oneof non_null_oneof {
    option (protokt.oneof).non_null = true;

    string message = 1;
  }
}
```

Note that deserialization of a message with a non-nullable field will fail if the
message being decoded does not contain an instance of the required field.

### Interface implementation

#### Messages

To avoid the need to create domain-specific objects from protobuf messages you
can declare that a protobuf message implements a custom interface with
properties and default methods.

```kotlin
package com.protokt.sample

interface Model {
    val id: String
}
```

```protobuf
package com.protokt.sample;

message ImplementsSampleMessage {
  option (protokt.class).implements = "Model";

  string id = 1;
}
```

Like wrapper types, if the implemented interface is in the same package as the
generated protobuf message that uses it, then it does not need to be referenced
by its fully-qualified name. Implemented interfaces cannot be used by protobuf
messages in the same project that defines them; the dependency must be declared
with `protoktExtensions` in `build.gradle`:

```groovy
dependencies {
  protoktExtensions project(':api-project')
}
```

Messages can also implement interfaces by delegation to one of their fields;
in this case the delegated interface need not live in a separate project, as
protokt requires no inspection of it:

```protobuf
message ImplementsWithDelegate {
  option (protokt.class).implements = "Model2 by modelTwo";

  ImplementsModel2 model_two = 1 [
    (protokt.property).non_null = true
  ];
}
```

Note that the `by` clause references the field by its lower camel case name.

#### Oneof Fields

Oneof fields can declare that they implement an interface with the
`(protokt.oneof).implements` option. Each possible field type of the oneof must
also implement the interface. This allows access of common properties without a
`when` statement that always ultimately extracts the same property.

Suppose you have a domain object MyObjectWithConfig that has a non-null configuration
that specifies a third-party server for communication. For flexibility, this
configuration will be modifiable by the server and versioned by a simple integer.
To hasten subsequent loading of the configuration, a client may save a resolved
version of the configuration with the same version and an additional field
storing an InetAddress representing the location of the server. Since the
server address may change over time, the client-resolved version of the config will
retain a copy of the original server copy. We can model this domain with protokt:

Given the Config interface:

```kotlin
package com.toasttab.example

interface Config {
    val version: Int
}
```

And protobuf definitions:

```protobuf
syntax = "proto3";

package com.toasttab.example;

import "protokt/protokt.proto";

message MyObjectWithConfig {
  bytes id = 1 [
    (protokt.property).wrap = "java.util.UUID"
  ];

  oneof Config {
    option (protokt.oneof).non_null = true;
    option (protokt.oneof).implements = "Config";

    ServerSpecified server_specified = 2;
    ClientResolved client_resolved = 3;
  }
}

message ServerSpecified {
  option (protokt.class).implements = "Config";

  int32 version = 1;

  string server_registry = 2;
  string server_name = 3;
}

message ClientResolved {
  option (protokt.class).implements = "Config by config";

  ServerSpecified config = 1 [
    (protokt.property).non_null = true
  ];

  bytes last_known_address = 2 [
    (protokt.property).wrap = "java.net.InetAddress"
  ];
}
```

Protokt will generate:

```kotlin
@KtGeneratedMessage("com.toasttab.example.MyObjectWithConfig")
class MyObjectWithConfig
private constructor(
    val id: UUID,
    val config: Config,
    val unknown: Map<Int, Unknown> = emptyMap()
) : KtMessage {
    sealed class Config : com.toasttab.example.Config {
        data class ServerSpecified(
            val serverSpecified: com.toasttab.example.ServerSpecified
        ) : Config(), com.toasttab.example.Config by serverSpecified

        data class ClientResolved(
            val clientResolved: com.toasttab.example.ClientResolved
        ) : Config(), com.toasttab.example.Config by clientResolved
    }

    ...
}

@KtGeneratedMessage("com.toasttab.example.ServerSpecified")
class ServerSpecified
private constructor(
    override val version: Int,
    val serverRegistry: String,
    val serverName: String,
    val unknown: Map<Int, Unknown> = emptyMap()
) : KtMessage, Config {

    ...
}

@KtGeneratedMessage("com.toasttab.example.ClientResolved")
class ClientResolved
private constructor(
    val config: ServerSpecified,
    val lastKnownAddress: InetAddress,
    val unknown: Map<Int, Unknown> = emptyMap()
) : KtMessage, Config by config {

    ...
}
```

A MyObjectWithConfig.Config instance can be queried for its version without
accessing the property via a `when` expression:

```kotlin
fun printVersion(config: MyObjectWithConfig.Config) {
    println(config.version)
}
```

### BytesSlice

When reading messages that contain other serialized messages as `bytes` fields,
protokt can keep a reference to the originating byte array to prevent a large
copy operation on deserialization. This can be desirable when the wrapping
message is short-lived or a thin metadata shim and doesn't include much memory
overhead:

```protobuf
message SliceModel {
  int64 version = 1;

  bytes encoded_message = 2 [
    (protokt.property).bytes_slice = true
  ];
}
```

## gRPC code generation

Protokt will generate code for gRPC method and service descriptors when the
`generateGrpc` option is enabled:

```groovy
protokt {
  generateGrpc = true
}
```

Protokt will _only_ generate gRPC code with the `onlyGenerateGrpc` option:

```groovy
protokt {
  onlyGenerateGrpc = true
}
```

Protokt does not yet generate full client and server stubs. It does generate the
components necessary to integrate with gRPC's Java and Kotlin APIs.

### Generated gRPC code

Consider gRPC's canonical Health service:

```protobuf
syntax = "proto3";

package grpc.health.v1;

message HealthCheckRequest {
  string service = 1;
}

message HealthCheckResponse {
  enum ServingStatus {
    UNKNOWN = 0;
    SERVING = 1;
    NOT_SERVING = 2;
  }
  ServingStatus status = 1;
}

service Health {
  rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
}
```

In addition to the request and response types, protokt will generate a service
descriptor and method descriptors for each method on the service:

```kotlin
object HealthGrpc {
    const val SERVICE_NAME = "grpc.health.v1.Health"

    val serviceDescriptor: ServiceDescriptor by lazy {
        ServiceDescriptor.newBuilder(SERVICE_NAME)
            .addMethod(checkMethod)
            .build()
    }

    val checkMethod: MethodDescriptor<HealthCheckRequest, HealthCheckResponse> by lazy {
        MethodDescriptor.newBuilder<HealthCheckRequest, HealthCheckResponse>()
            .setType(MethodType.UNARY)
            .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Check"))
            .setRequestMarshaller(KtMarshaller(HealthCheckRequest))
            .setResponseMarshaller(KtMarshaller(HealthCheckResponse))
            .build()
    }
}
```

Both grpc-java and grpc-kotlin expose server stubs for implementation via
abstract classes. Since protokt does not generate full stubs, it does not
dictate implementation approach. An additional style of implementation via
constructor-injected method implementations is included in the examples below.
These two implementation styles can emulate each other, so the choice of which
to use is perhaps a matter of taste.

### Integrating with gRPC's Java API

A gRPC service using grpc-java (and therefore using StreamObservers for
asynchronous communication):

```kotlin
typealias CheckMethod = UnaryMethod<HealthCheckRequest, HealthCheckResponse>

class HealthCheckService(
    private val check: CheckMethod
) : BindableService {
    override fun bindService() =
        ServerServiceDefinition.builder(HealthGrpc.serviceDescriptor)
            .addMethod(HealthGrpc.checkMethod, asyncUnaryCall(check))
            .build()
}
```

Or for the abstract class flavor:

```kotlin
abstract class HealthCheckService : BindableService {
    override fun bindService() =
        ServerServiceDefinition.builder(serviceDescriptor)
            .addMethod(checkMethod, asyncUnaryCall(::check))
            .build()

    open fun check(
        request: HealthCheckRequest,
        responseObserver: StreamObserver<HealthCheckResponse>
    ): Unit =
        throw UNIMPLEMENTED.asException()
}
```

Calling methods from a client:

```kotlin
fun checkHealth(): HealthCheckResponse =
    ClientCalls.blockingUnaryCall(
        channel.newCall(HealthGrpc.checkMethod, CallOptions.DEFAULT),
        HealthCheckRequest { service = "foo" }
    )
```

### Integrating with gRPC's Kotlin API

To use the coroutine-based implementations provided by grpc-kotlin:

```kotlin
typealias CheckMethod = suspend (HealthCheckRequest) -> HealthCheckResponse

class HealthCheckService(
    private val check: CheckMethod
) : AbstractCoroutineServerImpl() {
    override fun bindService() =
        ServerServiceDefinition.builder(serviceDescriptor)
            .addMethod(unaryServerMethodDefinition(context, HealthGrpc.checkMethod, check))
            .build()
}
```

Or for the abstract class flavor:

```kotlin
abstract class HealthCheckService : AbstractCoroutineServerImpl() {
    override fun bindService() =
        ServerServiceDefinition.builder(serviceDescriptor)
            .addMethod(unaryServerMethodDefinition(context, HealthGrpc.checkMethod, ::check))
            .build()

    open suspend fun check(request: HealthCheckRequest): HealthCheckResponse =
        throw UNIMPLEMENTED.asException()
}
```

Note that extending AbstractCoroutineServerImpl is not necessary if you provide
a custom CoroutineContext. Instead you can implement BindableService directly as
when implementing a server for grpc-java.

Calling methods from a client:

```kotlin
suspend fun checkHealth(): HealthCheckResponse =
    ClientCalls.unaryRpc(
        channel,
        HealthGrpc.checkMethod,
        HealthCheckRequest { service = "foo" }
    )
```

## IntelliJ integration

If IntelliJ doesn't automatically detect the generated files as source files,
you may be missing the `idea` plugin. Apply the `idea` plugin to your Gradle
project:

```groovy
plugins {
  id 'idea'
}
```

## Command line code generation

```sh
protokt % ./gradlew assemble

protokt % protoc \
    --plugin=protoc-gen-custom=protokt-codegen/build/install/protoc-gen-protokt/bin/protoc-gen-protokt \
    --custom_out=<output-directory> \
    -I<path-to-proto-file-containing-directory> \
    -Iprotokt-runtime/src/main/resources \
    <path-to-proto-file>.proto
```

For example, to generate files in `protokt/foo` from a file called `test.proto`
located at `protokt/test.proto`:

```sh
protokt % protoc \
    --plugin=protoc-gen-custom=protokt-codegen/build/install/protoc-gen-protokt/bin/protoc-gen-protokt \
    --custom_out=foo \
    -I. \
    -Iprotokt-runtime/src/main/resources \
    test.proto
```

## Contribution

Community contributions are welcome. See the
[contribution guidelines](CONTRIBUTING.md) and the project
[code of conduct](CODE-OF-CONDUCT.md).

To enable rapid development of the code generator, the protobuf conformance
tests have been compiled and included in the `testing` project. They run on Mac
OS 10.14+ and Ubuntu 16.04 x86-64 as part of normal Gradle builds.

When integration testing the Gradle plugin, note that after changing the plugin
and republishing it to the integration repository, `./gradlew clean` is needed
to trigger regeneration of the protobuf files with the fresh plugin.

## Acknowledgements

### Authors

[Ben Gordon](mailto:ben.gordon@toasttab.com),
[Andrew Parmet](mailto:andrew.parmet@toasttab.com),
[Oleg Golberg](mailto:ogolberg@toasttab.com),
[Patty Neckowicz](mailto:pneckowicz@toasttab.com),
[Frank<EMAIL_ADDRESS>and
[everyone in the commit history](../../commits/main).

Thanks to the Google Kotlin team for their
[Kotlin API Design](https://github.com/lowasser/protobuf/blob/master/kotlin-design.md)
which inspired the DSL builder implemented in this library.

repository: open-toast/protokt

branch_name: refs/heads/main

gha_language: Kotlin

repo_name: open-toast/protokt


text:
# AppRouting

AppRouting is a pure Swift URL Router. It allows you to easily handle open URLs and Universal Links on iOS by writing and using route patterns, like the ones you might see in your favorite web framework.

As I personally despise heavy dependencies, minimalism is a core design principle.

### Introduction

At the core, you have a Route, which is anything that conforms to a protocol with two methods:

    func matchesOnURL(URL: NSURL) -> Bool
    func parametersForURL(URL: NSURL) -> RouteParameters

This simplfies the logic of a Route in a very nice way. It also lets you write custom route parsing and handling if you find the built-in Route pattern matcher to be inadequate.

### Features

- Easy to use
- Small compact dependency
- Good code coverage
- MIT License
- Carthage compatible

### Requirements

- Requires Xcode 7.3 and Swift 2.2

license: MIT

repository: zachhowe/approuting

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: zachhowe/approuting


text:
# yii2-quill
[![Latest Stable Version](https://poser.pugx.org/bizley/quill/v/stable)](https://packagist.org/packages/bizley/quill)
[![Total Downloads](https://poser.pugx.org/bizley/quill/downloads)](https://packagist.org/packages/bizley/quill)
[![Latest Unstable Version](https://poser.pugx.org/bizley/quill/v/unstable)](https://packagist.org/packages/bizley/quill)
[![License](https://poser.pugx.org/bizley/quill/license)](https://packagist.org/packages/bizley/quill)

*Yii 2 implementation of Quill, modern WYSIWYG editor.*

## Quill
You can find Quill at http://quilljs.com
- [Documentation](http://quilljs.com/docs/quickstart)
- [Examples](http://quilljs.com/examples)
- [GitHub](https://github.com/quilljs/quill)

## yii2-quill

### Installation

Easiest way to install this extension is through the [Composer](https://getcomposer.org).
Add in your ```composer.json```:
```"bizley/quill": "*"```
or run console command:
```php composer.phar require bizley/quill "*"```

### Usage

Use it as an active field extension
```<?= $form->field($model, $attribute)->widget(bizley\quill\Quill::className(), []) ?>```

or as a standalone widget
```<?= bizley\quill\Quill::widget(['name' => 'editor']) ?>```

### Parameters
- **theme** *string* default ```'bootstrap'```
  ```false``` or ```null``` for Quill's default theme with quill.base.css,
  ```'snow'``` for Quill's snow theme with quill.snow.css,
  ```'bootstrap'``` for snow theme with editor wrapped in [Bootstrap's panel](http://getbootstrap.com/components/#panels)
  You can set theme in ```configs``` array instead but this is the only way to set ```'bootstrap'``` theme.
  See [Quill's documentation for themes](http://quilljs.com/docs/themes).

- **toolbar** *string* or *array* default ```'full'```
  In case of *string*:
  ```false``` or ```null``` to switch toolbar off,
  ```'full'``` for full Quill's toolbar as seen [here](http://quilljs.com),
  ```'basic'``` for few basic toolbar options,
  *anything else* for single button (see below).
  In case of *array*:
  *string element* for single button (see below),
  *array element* for buttons grouped together - every element of this array should be *string* (a single button).

- **configs** *array* default ```[]```
  Array of Quill's configuration. This is the equivalent of [Quill's configs variable](http://quilljs.com/docs/configuration)

- **options** *array* default ```[]```
  Array of HTML options passed to the editor's div.

- **js** *string* default ```null```
  Additional js to be called with the editor.
  Use placeholder ```{quill}``` to get the current editor object variable.

### Toolbar
Quill allows you to add your own HTML toolbar for the editor. This is very flexible solution but in most cases you just need to
get few standard buttons without worrying about the HTML tags and where and how to properly place them.
With **yii2-quill** it is quite simple - there are predefined buttons you can use:

- ```'|'``` separator,
- ```'b'``` bold,
- ```'i'``` italic,
- ```'u'``` underline,
- ```'s'``` strikethrough,
- ```'font'``` font family,
- ```'size'``` font size,
- ```'textColor'``` font colour,
- ```'backColor'``` background colour,
- ```'ol'``` ordered list,
- ```'ul'``` bullet list,
- ```'alignment'``` text alignment,
- ```'link'``` link,
- ```'image'``` image

With **toolbar** parameter set to ```'full'``` all these buttons are added. ```'basic'``` gives you only
```'b', 'i', 'u', 's', 'ol', 'ul', 'alignment', 'link'```.

In case you want totally different set of buttons you can set them like:
```'toolbar' => ['b', 'i', 'u', '|', 'font', '|', 'alignment'],```

If you want to group some buttons together use nested arrays:
```'toolbar' => [['b', 'i', 'u'], ['font', 'alignment']],```

And don't worry about adding modules in **configs** for ```'link'``` and ```'image'``` options - this is done automatically.

You may wonder what to do in case of adding some button that is not listed here - simply just put the HTML code of the button
inside the **toolbar** array. *And there is still this option to create separate toolbar from the scratch - you can add toolbar
module with its container's ID in the __configs__ array as [seen here](http://quilljs.com/docs/quickstart).*

repository: LuismendozaSalv/seguridad

repo_name: LuismendozaSalv/seguridad


text:
Ephemeral Messaging
===================
A topic-based, at most once delivery messaging system, perfect for ephemeral data.

- Provides **at most once delivery semantics.**
- Messages are published with "topics", similar to AMQP-style topics. Defaults to an empty string. No ack or nack is used for ephemeral messages.
- Consumers may specify a "topic" matcher, which expresses interest in matching messages. Wildcard topic matchers are supported, similar to AMQP-style wildcards.
- If no consumer matches the topic of the message, it will be dropped.
- Consumers may form groups, where messages will be load balanced across healthy group members.
- Consumer group information is synchronously replicated to all nodes when the consumer group is formed and as members join and leave the group, but this information is only held in memory.
- Consumer group load balancing decisions are made by the node which received the message needing to be load balanced.
- Messages will be delivered once to each consumer group matching the message's topic.
- Ephemeral messaging exchanges are implicity created as part of a namespace. Namespaces have one and only one ephemeral messaging exchange.

### Topics
Hadron enforces that message topics adhere to the following pattern `[-_A-Za-z0-9.]*`. In English, this could be read as "all alpha-numeric characters, hyphen, underscore and period". Topics are case-sensitive and can not contain whitespace.

##### Topic Hierarchies
The `.` character is used to create a subject hierarchy. A volcanology team might define the following hierarchy for collecting sensor readings on volcanoes they are monitoring, where volcanoes are grouped by the region they are in, followed by the name of the volcano, then followed by the cardinal point where the sensor is stationed with respect to the center of the volcano.

```
volcanoes.usa
volcanoes.usa.atka
volcanoes.usa.kahoolawe.north
volcanoes.tanzania
volcanoes.tanzania.meru
volcanoes.tanzania.kilimanjaro.east
volcanoes.tanzania.kilimanjaro.west
```

### Wildcard Matchers
There are two wildcard tokens available to subscribers for matching message topics. Subscribers can use these wildcards to listen to multiple topics with a single subscription but Publishers will always use a fully specified subject, without any wildcards (as the wildcard characters are not valid topic characters while publishing).

##### Single-Token Matching
The first wildcard is `*` which will match a single hierarchy token. If the volcanology team needs to build a consumer for monitoring everything from `Kilimanjaro`, it could subscribe to `volcanoes.tanzania.kilimanjaro.*`, which would match `volcanoes.tanzania.kilimanjaro.east` and `volcanoes.tanzania.kilimanjaro.west`.

##### Multi-Token matching
The second wildcard is `>` which will match one or more hierachy tokens, and can only appear at the end of the topic. For example, `volcanoes.usa.>` will match `volcanoes.usa.atka` and `volcanoes.usa.kahoolawe.north`, while `volcanoes.usa.*` would only match `volcanoes.usa.atka` since it can’t match more than one hierarchy token.

### Consumers
Ephemeral message consumers specify a topic matcher and may optionally specify a queue group to begin consuming messages. Every consumer which is part of the same queue group will have messages load balanced across the group.

repository: sseg/hadron

repo_name: sseg/hadron


text:
+++
title = "NHL Data & Tidy Tuesday"
date = "2020-03-09"
authors = ["Robin Sifre"]
summary="Exploring the relationship between penalty minutes and goals scores in the NHL."
tags=["tidy tuesday", "R", "statistics", "data science"]
categories=["Tidy Tuesday"]
# Featured image thumbnail (optional)
image_preview = ""

+++

I've recently started to participate in [Tidy Tuesday](https://thomasmock.netlify.com/post/tidytuesday-a-weekly-social-data-project-in-r/), a weekly social data project in R. Each week they release a new dataset on their [GitHub](https://github.com/rfordatascience/tidytuesday). It's a fun opportunity to explore new and interesting data sets. After you do a quick analysis and generate some figures, you're supposed to tweet it with #tidytuesday.

{{< tweet<PHONE_NUMBER>721712650 >}}

In this post, I walk through a bit of my code, but you can find the complete code on my [GitHub](https://github.com/rrobinn/tidy-tuesday/tree/master/20200303-HockeyGoals).

This week's dataset comes from [HockeyReference.com](https://www.hockey-reference.com/). I used 2 of the downloadable datasets:
1. Overall career goals.
2. Season level goals.

I thought that this multi-level data would be a fun way to explore the impact of how  centering variables can clarify which level of analysis is driving the relationship.

# The question
Is there a relationship between aggressive play (time spent in the penalty box) and scoring?  On the one hand, more aggressive play could mean more goals. On the other hand, too much time in the penalty box takes you out of the game and could minimize your opportunity to score.

 Disclaimer:  I know nothing about Hockey, and most of my knowledge comes from the Mighty Ducks franchise. As someone who has lived in Minnesota for four years this is inexcusable, but here we are.

Mea culpa.

# Why should I center my variables?
Let's imagine that there is a relationship between penalty minutes and goals scored. You can imagine this relationship work on two different levels:
You can imagine that the relationship between penalty minutes and goals scored could work on 2 different levels:
 1. Between-player effect.  More aggressive players score more goals. A relationship between CAREER-AVERAGE penalty minutes and goals would suggest that the relationship is driven by  *between-player* differences.
 2. Within-player effect. When a given player plays more aggressively, they also score more goals. A relationship between SEASON-AVERAGE penalty minutes and goals would suggest that this relationship is driven by *within-player* differences.

However: when we examine season-averages we are "smushing together" variability driven by season-to-season changes within a player, and variability driven by differences between player skill. In other words, a top player may still score more goals even when they're having a poor season relative to a less skilled player.

Do aggressive players score more? Or do players score more when they play more aggressively? To better answer this question, we can center our variables.
If we take each player's season average (for penalty minutes & goals), and subtract it from their career average, we can isolate season-to-season variability.

# Centering variables
So how did I center my variables? First, I created a variable that holds career-average penalty minutes and goals for each players.  Let's call it `player_stats`.

```r
player_stats = season_goals %>%
  dplyr::select(player, penalty_min, goals) %>%
  group_by(player) %>%
  summarize(ave_penalty = mean(penalty_min), #Career-average stats for player
            ave_goals = mean(goals))
```

Then, I merged player_stats with `season_goals`, my data.frame that holds season-average goals and penalty minutes.
```r
merged = merge(season_goals, player_stats, by = 'player')
```

Now creating the  centered variables  is a piece of cake.
We center each player's **season-average penalty minutes** (`season_penalty`) on their **career-average penalty minutes** (`ave_penalty`) to create the variable `penalty_c`.  (We do the same thing for goals).

```r
merged = merged %>%
  mutate(penalty_c = season_penalty - ave_penalty,
         goals_c = season_goals - ave_goals)
```

`penalty_c` now shows how a player's penalty minutes changes from season-to-season, **holding** `ave_penalty` **constant.**

Negative values of `penalty_c` indicate seasons where a player had lower than average minutes in the penalty box, and positive values indicate  seasons where a player had higher than average minutes in the penalty box. In this case, average refers to their own personal average.

# What does it buy us?
When we plot season-average penalty minutes against goals scores, it looks like there might be a relationship between these two variables:

But, it's a bit messy.  In this figure we are smushing together variability between-players (e.g., high-scorers) and variability within a player (e.g., when someone is having a particularly good or bad season).

Now, let's plot the relationship between these two variables when we center them on a player's career average:

Here, the relationship becomes more clear. In a given season, when a player has more penalty minutes than their career average, they also score more goals than their career average.
Could this just be driven by how much play-time a player gets in a given season? Possibly! But this also illustrates how in this figure we are isolating change within a player, by holding their career averages constant.

repository: rrobinn/academic-kickstart

gha_language: Shell

gha_license_id: MIT

repo_name: rrobinn/academic-kickstart


text:
Timer

## :pushpin: What is this project?
This project is a practical and easy timer.

## :thinking: What is the objective of this project?
The aim of this project is to help the people organize their time better.

## :question: How does the Timer work?
Enter the desired time and the Timer will start instantly. When the time is up, the alarm will go off.

## :computer: What technologies are used?
This project was done with HTML5, CSS3 and JavaScript.

## :pencil: License
This project is under the MIT license. Read the file [LICENSE](https://github.com/vitorjungles/timer/blob/master/LICENSE) for more information.

## :arrow_right: How to access the Timer?
To access the Timer [click here](https://vitorjungles.github.io/timer/). :timer_clock:

repository: vitorjungles/timer

repo_name: vitorjungles/timer


text:
# Paddle Properties

## Features

Shows and provides facility to edit paddle properties.

### Scenario : Show the paddle properties

  Given the game is installed in the device and the user is in the
  start page.

  When the player clicks on the paddle icon.

  Then this module shows the paddle properties and list of paddles in his
  collection.

### Scenario : Change ball

  Given the game is installed in the device and the user is in the
  paddle properties page.

  When the player selects the paddle from his collection and click
  save changes.

  Then this module the updates the paddle information and it will be
  this paddle that shows the game.


text:
# How to

![infra sample-server](../imgs/01-sample-instance.png "infra sample-server")

### Create stack

Install Python package requirements:
```
python -m venv ./venv
source ./venv/bin/activate
pip install -r requirements.txt
```

Deploy stack:

```
pulumi up
```

This script will create:
- 1 vpc
- 1 subnet
- 1 route_table
- 1 internet gateway
- 2 security groups
- 1 instance

### Delete stack

```
pulumi destroy
```

repository: diodonfrost/pulumi-aws-examples

repo_name: diodonfrost/pulumi-aws-examples


text:
# alsa-audio-pipe
Brain dead simple audio piper with ALSA

# What do I do with this?

This is simply my set up on a Raspberry Pi running Raspbian that allows
me to pipe in the audio in from a Griffin iMic USB audio dongle to a USB
Harmon Kardon Soundsticks speaker system.

Included is a python script that depends on python-alsasound that does the
equivalent of piping audio data from one device to another.

# Requirements

python-alsasound 0.8.2

```
sudo apt-get install python-dev libasound2-dev
git clone https://github.com/larsimmisch/pyalsaaudio
cd pyalsaaudio
python setup.py build
sudo python setup.py install
```

# Setup

```
cd ~
git clone https://github.com/liquidx/alsa-audio-pipe.git
cd alsa-audio-pipe
```

## Testing

```
./alsa_audio_piper.py --input imic --output soundsticks --floor-noise 0
```

Replace `imic` and `soundsticks` with your device names (see below on setting up audio if you have problems.)

## Enabling on boot (rc.d style)

For enabling on Debian/Raspbian Wheezy which uses init.d/rc.d style init scripts, do the following:

```
sudo cp alsa-audio-pipe /etc/init.d
# Option 1. Install using chkconfig
sudo chkconfig --add alsa-audio-pipe
# Option 2. Install using update-rc.d
sudo update-rc.d alsa-audio-pipe defaults
```

To start and stop the service

```
# start the alsa-audio-pipe
sudo service alsa-audio-pipe start
# Stop the alsa-audio-pipe
sudo service alsa-audio-pipe stop
```

## Enabling service on boot (systemd style)

For more modern distributions, like Debian Jessie that uses systemd style.

```
sudo cp alsa-audio-pipe.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable alsa-audio-pipe
sudo systemctl start alsa-audio-pipe
```

To start and stop the service

```
# start the alsa-audio-pipe
sudo systemctl start alsa-audio-pipe
# Stop the alsa-audio-pipe
sudo systemctl stop alsa-audio-pipe stop
```

# Audio Setup

ALSA just works straight out of the box once you install everything, I made some additional changes to ```/etc/asound.conf``` to point to alias the devices to order-independent names:

```
# This will create an ALSA card named 'soundsticks' that maps to the SoundSticks card's PCM
pcm.soundsticks {
  type hw
  card "SoundSticks"
  device 0
}

# This will create an ALSA card named 'imic' that maps to the Griffin iMic PCM
pcm.imic {
  type hw
  card "system"
  device 0
}

# Default to SoundSticks as the default audio device.
defaults.pcm.!card "SoundSticks"
defaults.ctl.!card "SoundSticks"
```

Adjust volume

```
alsamixer
```

Store and copy volume for next restart

```
sudo alsactl store
sudo cp /var/lib/alsa/asound.state /etc/asound.state
```

repository: idog-ceva/alsa-audio-pipe

repo_name: idog-ceva/alsa-audio-pipe


text:
# A simple implementation of Snake

[Play Snake](https://ryanbard.github.io/javascript-coding-katas/games/snake/snake.html)

Code is inspired by:

* [https://www.youtube.com/watch?v=AaGK-fj-BAM](https://www.youtube.com/watch?v=AaGK-fj-BAM)
* [https://www.youtube.com/watch?v=H2aW5V46khA](https://www.youtube.com/watch?v=H2aW5V46khA)

This is a simple implementation of Snake written with HTML5 canvas.  It is mostly just practicing implementing velocity + framerate, drawing very simple objects (rectangles), and simple collision detection.  The user controls are driven by the keyboard, however, only the last valid keypress is stored and affects where the snake moves (the snake simply moves with the game loop  -- pressing keys doesn't make the snake move any faster).

repository: RyanBard/javascript-coding-katas

repo_name: RyanBard/javascript-coding-katas


text:
---
layout: single
title: "Unable to load dynamic library intl"
date: 2022-01-16 09:08:53 +0200
categories: development
comments: true
lang: en
tags: php, m1
image: images/php.jpg
---

{:refdef: style="text-align: center;"}
![dist files]({{ site.baseurl }}/images/php.jpg)
{: refdef}

{:refdef: style="text-align: center;font-size:9px"}
Photo by Ben Griffiths on Unsplash
{: refdef}

In the following post, I'm going to explain how I fixed the `Unable to load dynamic library intl` message error that I got when I tried to run a CakePHP application on my MacBook air m1.

Trying to run cake server on my localhost
--------------------------------------------
Some days ago I found myself trying to run a CakePHP application that I maintain. The application is a website with a frontend (Html5, Css, Javascript), the backend is using a PHP framework called CakePHP and as database it's using a Mysql that is included on OVH shared hosting.

When I tried to run the CakePHP server on my localhost using the following command:

```console
$> ./cake server
```

I got the following error message:

```console
PHP Warning:  PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/lib/php/extensions/no-debug-non-zts-20180731/intl (dlopen(/usr/lib/php/extensions/no-debug-non-zts-20180731/intl, 9): image not found), /usr/lib/php/extensions/no-debug-non-zts-20180731/intl.so (dlopen(/usr/lib/php/extensions/no-debug-non-zts-20180731/intl.so, 9): image not found)) in Unknown on line 0
PHP Fatal error:  You must enable the intl extension to use CakePHP.
```

PHP Intl extension
--------------------
The Internationalization extension (Intl) is a wrapper for the ICU library, a set of C/C++ and Java libraries that provide Unicode and Globalization support for software applications. It enables PHP programmers to perform UCA-conformant collation and date/time/number/currency formatting in their scripts.

I guess that `intl` dynamic library has been removed in some MacOS operating system update during the last weeks.

Trying to run PHP
------------------------

Also when trying to run the following command:

```console
php -v
```

I could read the following message:

```console
PHP Warning:  PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/lib/php/extensions/no-debug-non-zts-20180731/intl (dlopen(/usr/lib/php/extensions/no-debug-non-zts-20180731/intl, 9): image not found), /usr/lib/php/extensions/no-debug-non-zts-20180731/intl.so (dlopen(/usr/lib/php/extensions/no-debug-non-zts-20180731/intl.so, 9): image not found)) in Unknown on line 0
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
PHP 7.3.24-(to be removed in future macOS) (cli) (built: Feb 28 2021 09:53:14) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies
```

Apple official notes
--------------------------
I looked for information about this topic and I found the following release notes where they shared the following notes:

> Scripting Language Runtimes

> Deprecations

> Scripting language runtimes such as Python, Ruby, and Perl are included in macOS for compatibility with
> legacy software. Future versions of macOS won’t include scripting language runtimes by default and might
> require you to install additional packages. If your software depends on scripting languages, it’s
> recommended that you bundle the runtime within the app.

Apple intends to remove scripting languages runtime in future releases and they advise that is your responsibility to provide PHP to run your apps.

Installing PHP with homebrew
-------------------------------

The first solution to the problem that we face is to install PHP using `homebrew`. Using the following command in the command line we can install version 7.4 of PHP.

```console
$> brew install<EMAIL_ADDRESS>```

The following command creates symlinks to the previous installation we performed manually in Cellar. This allows us to have the flexibility to install things on our own but still have these participate as dependencies in homebrew formulas.

```console
$> brew link<EMAIL_ADDRESS>--force
```

After installing it if we run the command to see the version of PHP that we have available in our `$PATH`

```console
$> php -v
```

We see that the previous error doesn't show anymore:

```console
PHP 7.4.27 (cli) (built: Dec 16 2021 18:14:21) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.27, Copyright (c), by Zend Technologies
```

Using Docker to run your CakePHP app
----------------------------------------
The second option that we have is to take advantage of docker. To do so we can use the Dockerfile from the following Github repository:

Then we can run the following commands to build the container image:

```console
docker build -t my-app .
```

and run it:

```console
docker run -p 8080:80 -d my-app
```

In this case, we will be able to run a PHP app without installing it locally.

Conclusion
---------------
Hope the post was helpful and that you can run your PHP applications on your MacBook air.

repository: alexmanrique/blog

gha_language: Ruby

repo_name: alexmanrique/blog


text:
# Mine sweeper in Python!

This is a not so simple implementation of mine sweeper game (best known from Windows operating system) in Python language. It is a single-person project, started only for learning purposes. But I don't mind if you want to check it out and play!

Requirements:
-----
 - [pipenv](https://github.com/pypa/pipenv)
 - [pyenv](https://github.com/pyenv/pyenv)

Running game in CLI:
-----

    $ pipenv run python app.py

How to play?
-----
 - Left mouse click: reveal cell
 - Right mouse click: flag cell
 - Middle mouse click: check cells except flagged cells

Goals:
-----
 - get used with attrs
 - learn gui programming with python
 - tinker a lot
 - have fun!

repository: thinkofher/mymines

repo_name: thinkofher/mymines


text:
# Psych-Grad-Resources
A repository of useful information and resources for graduate students in psychology at Penn State. To
access the full website, please visit: <https://psu-psychology.github.io/Psych-Grad-Resources/>

## Components
In the main repository folder are the raw `.Rmd` and `.html` components used to build static site,
plus some extra goodies (`footer.html`,`style.css`) for making the site look better.

- `docs/`: Folder GitHub pages uses to serve site.
- `data/`: Folder contains a raw data file of journal impact factors and a handout version of the
static webpages.
- `man`: Journal articles referenced in each document are stored here.
- `R`: R scripts for (re-)producing the site and static webpages quickly.

## Instructions

1. Clone or copy the site locally.
2. Make any changes to the `.Rmd` files in the `data/` folder and re-knit them using `knitr`.
3. From the site root directory, run `rmarkdown::render_site()` from your R or RStudio console to generate the HTML, CSS, and JS files. The site resides in `docs/` and may be viewed in any browser.

repository: psu-psychology/Psych-Grad-Resources

gha_language: HTML

repo_name: psu-psychology/Psych-Grad-Resources


text:
# Socks

```text
fontawesome-5/Solid/Socks
```

```text
include('fontawesome-5/Solid/Socks')
```

| Illustration | Socks |
| :---: | :---: |
| ![illustration for Illustration](../../fontawesome-5/Solid/Socks.png) | ![illustration for Socks](../../fontawesome-5/Solid/Socks.Local.png) |

## Socks

### Load remotely
```plantuml
@startuml
' configures the library
!global $LIB_BASE_LOCATION="https://github.com/tmorin/plantuml-libs/distribution"

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('fontawesome-5/bootstrap')

' loads the Item which embeds the element Socks
include('fontawesome-5/Solid/Socks')

' renders the element
Socks('Socks', 'Socks', 'an optional tech label')
@enduml
```

### Load locally
```plantuml
@startuml
' configures the library
!global $INCLUSION_MODE="local"
!global $LIB_BASE_LOCATION="../.."

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('fontawesome-5/bootstrap')

' loads the Item which embeds the element Socks
include('fontawesome-5/Solid/Socks')

' renders the element
Socks('Socks', 'Socks', 'an optional tech label')
@enduml
```

repository: VinayaSathyanarayana/plantuml-libs

repo_name: VinayaSathyanarayana/plantuml-libs


text:
# AWS CDK Stack

## Prerequisites

- Install [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
- Install [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
- Install [AWS CDK Toolkit](https://docs.aws.amazon.com/cdk/v2/guide/cli.html)

## Run service locally

```
npm install
cdk synth
sam local start-api -t cdk.out/TapirCdkStack.template.json
```

## Deploy to production

- Configure your account ```aws configure```
- ```cdk deploy```

repository: softwaremill/tapir

gha_language: Scala

repo_name: softwaremill/tapir


text:
# Notes

## Features

Syntax highlighting for notes, with simple TODO lists. Also allows you to cross-link (cmd/ctrl-click) between notes.

<img src="https://github.com/canadaduane/vscode-notes/blob/master/images/vscode-notes-sample.png?raw=true" width="544">

The example above comes from opening `examples/basic.notes` in VS Code, with the `notes` extension enabled and the `Dark+` default theme selected.

## Snippets & Commands

A `newday` snippet includes the current date and a set of organizing section headings:

```
[2019-02-02]
Notes:
Ideas:
TODO:
Activity Log:
```

To add a new "TODO" item checkbox, use the `cmd/ctrl+L` shortcut:

```
[ ] Pick up daughter after school
[√] Install VS Code `notes` extension
```

When the cursor is on a line with a TODO checkbox, subsequent `cmd/ctrl+L` directives will cycle through `[√]` (done) and `[x]` (won't do).

## Cross-linking Notes

If you mention another `*.notes` file, it will be underlined and become a hyperlink: `work.notes`. To follow the link, use the vscode `cmd/ctrl+click` standard feature. References to notes can be absolute or relative; if relative, they are relative to the current document.

If the notes file you'd like to link to contains spaces, you can use "double quotes" to indicate the spaces should be included in the hyperlink. You can also use tilde (`~`) to mean your home directory, e.g. `~Notes/journal.notes`.

## Configurable Links

If you use shortened patterns in your notes files to refer to web pages (for example, an issue tracker has short IDs) then you can use a regular expression to teach your `notes` file what to do with it when clicked:

For example, to create links to tickets on Atlassian with prefix "ABC-", you could do something like this:
```
[/ABC-\d+/ -> https://abc-project.atlassian.net/browse/$0]
```

Now, the following pattern will be recognized as a clickable link in your note file:
```
(ABC-1234)
```
... and clicking it will send you to `https://abc-project.atlassian.net/browse/ABC-1234`

You can also add global link patterns to your config via the `notes.predefinedLinks` config key.

## Configuration

You may want to configure some of the text colors, for instance in your vscode settings file, you can add scopes like so:

```
"editor.tokenColorCustomizations": {
    "textMateRules": [
        {
            "scope": "keyword.operator.notes",
            "settings": {
                "foreground": "#92b630"
            }
        },
        {
            "scope": "variable.language.notes",
            "settings": {
                "foreground": "#92b630",
                "fontStyle": "italic"
            }
        }
    ]
}
```

All of the scopes you can configure are as follows:

```
source.notes
markup.heading.notes
markup.changed.notes
markup.canceled.notes
markup.bold.notes
variable.language.notes
keyword.other.notes
keyword.operator.notes
invalid.deprecated.notes
comment.notes
string.quoted.single.notes
string.quoted.double.notes
string.regexp
entity.name.tag.notes
```

Other scopes are language-specific. See `syntaxes/custom-colors.json` if you would like to override your theme and use the colors you see in the example image.

## Supported Syntax Highlighting

When adding code snippets, you can use the following language indicators after a [language-tag] (square brackets necessary) to get syntax highlighting for that language:

```
actionscript|as -> source.actionscript.2
applescript -> source.applescript
asp|asa -> source.asp
c -> source.c
cs|c#|csharp -> source.cs
c++|cpp|cc|cxx -> source.c++
clj|clojure -> source.clojure
css -> source.css
di -> source.d
erl|hrl|Emakefile|emakefile| -> source.erlang
go|golang -> source.go
groovy|gvy -> source.groovy
hs|haskell -> source.haskell
html|htm|shtml|xhtml|phtml|inc|tmpl|tpl|ctp -> text.html.basic
java|bsh -> source.java
js|jsx|htc|javascript -> source.js
lua -> source.lua
gnumakefile|makefile|makefile|ocamlmakefile|make -> source.makefile
mdown|markdown|markdn|md -> text.html.markdown
matlab -> source.matlab
objective-c|objc|m|h -> source.objc
ocaml|ml|mli -> source.ocaml
p|pas|pascal -> source.pascal
pm|pl|pod|t|perl -> source.perl
php -> source.php
cpy|py|python|rpy|pyw -> source.python
r|s|rprofile -> source.r
re|regex|regexp -> source.regexp
rb|rbx|rjs|ruby|Rakefile|rake|cgi|fcgi|gemspec|irbrc|capfile|gemfile -> source.ruby
scala -> source.scala
sh|bash|zsh|bashrc -> source.shell
sql|dml|ddl|mysql -> source.sql
tcl -> source.tcl
tex|latex|sty|cls -> text.tex
xml|tld|jsp|pt|cpt|dtml|rss|opml -> text.xml
yaml|yml -> source.yaml
```

## Release Notes

See [CHANGELOG.md](CHANGELOG.md).

Syntax highlighting based on [Sublime Text Notes](https://packagecontrol.io/packages/Notes) by tbh1.

repository: canadaduane/vscode-notes

gha_language: JavaScript

repo_name: canadaduane/vscode-notes


text:
# WeVo Platform - MVP test

## We build more inclusive cities with data and analytics.

### Summary

WeVo is a civic engagement platform designed to help land development and building project stakeholders incorporate community feedback into their projects, reduce paper consumption, conserve resources by managing project risk, analyze public sentiment and predict community response.

### Objectives

The project objectives are as follows:

1. Reduce project risk by minimizing project delays and lawsuits
2. Allow constituents to vote on projects and initiatives
3. Allow project owners to track voting and sentiment

### Background

This project started at [Startup Weekend Sacramento](http://communities.techstars.com/usa/sacramento/startup-weekend/14400) in June 2019 with the goal of increasing civic engagement, reducing project risk and helping build more inclusive cities.

### Methodology

This project was developed based on coach feedback and custom development during the event; it pivoted into this concept for the following reasons:

1. Customers have a pain point with costly project delays and lawsuits
2. Constituents may not be involved with the civic engagement process
3. Project owners are required by law to hold public comment periods
4. Project satisfies multiple portions of the sustainability model
5. This project was developed based on the tutorial listed below

## Citation

This project is based on the [Flask Microblog
Tutorial](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world)
by Miguel Grinberg.

## Data Dashboard with Python, Flask and Plotly

### Summary

Initial MVP app with Pythong, Flask and Plotly; it will be developed into the full MVP based on customer interviews with additional features. User authentication, CRUD operations, voting feature and data visualization will be added soon.

### Local Development

1. Verify that Python and Pip (package manager) have been installed
* 1.1. Production runs on Python 3; however, either v2 or 3 works in dev mode
2. After verifying installations, git clone this repository
* 1.2. Repository contains dev branch for collaboration
3. From within the root directory, run commands within `scripts/venv_notes.sh`
* 3.1. File has instructions for creating virtual environment for packages
* 3.2. Instructions will download required packages and start local server
4. Local database currently is SQLite, and deployment database is Postgres
* 4.1. Database settings identified within config.py file
* 4.2. Models.py file contain data schema; manage.py contains migration info
* 4.3. Create migration files with `python manage.py db init`
* 4.4. Move migration files with `python manage.py db migrate`
* 4.5. Execute migration files with `python manage.py db upgrade`

### Heroku Deployment

1. Procfile, requirements.txt and runtime.txt files provide necessary info
* 1.1. Procfile creates 1 web worker with gunicorn
* 1.2. Python 3 is specified in runtime.txt file
2. Verify that Heroku toolbelt is installed, then add Heroku as remote
* 2.1. Verify that all changes are committed and stored on the master branch
* 2.2. Check that config vars have been set and app created in Heroku dashboard
3. Next, deploy using `git push heroku master` once repo has been linked

### Citations

MVP is based on the tutorials and links below:

Flask, Postgres and Heroku:
* MVP closely follows this [tutorial](https://medium.com/@dushan14/create-a-web-application-with-python-flask-postgresql-and-deploy-on-heroku-243d548335cc)
* Tutorial [Github Repo](https://github.com/dushan14/books-store)
* Real Python [tutorial](https://realpython.com/flask-by-example-part-1-project-setup/) which has more complex features but first several sections are useful
* Flask [documentation](http://flask.pocoo.org/docs/1.0/patterns/#patterns) which has design patterns for common tasks such as database, MVC and template design

Data Dashboard with Plotly:
* Hepta Analytics [Tutorial](https://blog.heptanalytics.com/2018/08/07/flask-plotly-dashboard/)
* Hepta Analytics [Github Repo](https://github.com/yvonnegitau/flask-Dashboard)
* Plotly [website](https://plot.ly/products/dash/) with additional documentation

### Installation

1. Install and run virtualenv, requirements and export vars
* 1.1. Run script `scripts/setup_venv`
* 1.2. Script creates workspace and runs requirements
2. Set secret key and run local server with `flask run`
3. Debugging options are turned on, so troubleshoot for errors

repository: walteryu/wevo-demo

repo_name: walteryu/wevo-demo


text:
# Iptables Docker

8MB Docker image to run iptables rules.

Built for amd64, 386, ARM and s390x CPU architectures.

## Setup

1. Write your iptables rules in a file *rules.sh*. You might want to make it clear everything at the beginning so you can restart the container easily. For example:

    ```sh
    # Flush the Docker user chain
    iptables -F DOCKER-USER
    # Accept related connections
    iptables -A DOCKER-USER -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

    # Limit access for a web server container running on port 8080
    MYLAN=<IP_ADDRESS>/24
    WEB_SERVER_CONTAINER=<IP_ADDRESS>
    # No outbound connections
    iptables -A DOCKER-USER -s $WEB_SERVER_CONTAINER -j DROP
    # Allow inbound connections from your LAN
    iptables -A DOCKER-USER -d $WEB_SERVER_CONTAINER -s $MYLAN -p tcp --dport 8080 -j ACCEPT
    # Drop inbound connections from your other private IP addresses
    # PRIVATE_IPS is built-in and contains all the private ip addresses
    iptables -A DOCKER-USER -d $WEB_SERVER_CONTAINER -s $PRIVATE_IPS -p tcp --dport 8080 -j DROP
    # Allow inbound connections from public IP addresses
    iptables -A DOCKER-USER -d $WEB_SERVER_CONTAINER -s $PRIVATE_IPS -p tcp --dport 8080 -j ACCEPT
    # Block the rest
    iptables -A DOCKER-USER -d $WEB_SERVER_CONTAINER -j DROP
    ```

1. Make it executable

    ```sh
    chmod 500 rules.sh
    ```

1. Run the container (ephemerally) with

    ```sh
    docker run -it --rm --cap-add=NET_ADMIN --net=host -v /yourpath/rules.sh:/rules.sh:ro qmcgaw/iptables
    ```

    You can also use `docker-compose up` with the [docker-compose.yml](https://raw.githubusercontent.com/qdm12/iptables/master/docker-compose.yml) file.

## Suggestions

👉 [Create an issue](https://github.com/qdm12/iptables/issues/new)

## License

License is of course an MIT license

## TODOs

- Get microbadger webhook link
- Trap error and revert back changes


text:
# Build system

By default, we only build for Firefox.

## Tools

We use Gulp as a build system, and web-ext to run and sign the Webextensions. The most frequently used commands are also included as npm scripts for convenience.

The code is linted using ESLint, transpiled with Babel and packed with Browserify.

## Tasks

Available tasks can be displayed by `gulp --tasks`. For more information, check out the gulpfile.

Here are some common tasks:
```bash
# Clean the build directory
gulp clean # or `npm run clean`

# Build for Firefox
gulp # or `gulp build` or `npm run build`

# Build packed extension
gulp dist # or `npm run dist`

# Build packed extensions for Firefox and Opera
gulp all # or `npm run all`

# Load the extension in Firefox
npm run run # or `web-ext run -s build`

# Create a zip of the source code for AMO review
gulp zip # or npm run zip
```

## Configuration files

Other than the master gulpfile.js, there are various configuration files that control parts of the build process.

* For ESlint: .eslintrc.json
* For Babel: .babelrc.json, .browserslistrc

repository: tqdv/tab-counter

repo_name: tqdv/tab-counter


text:
# SimpleBus Asynchronous Message Bus using Bernard and Amazon SQS

Demonstration on how to configure two [SimpleBus Message Buses](https://github.com/SimpleBus/MessageBus):

- [Asynchronous](http://simplebus.github.io/Asynchronous/): which serializes and persists all incoming Commands on a [Amazon SQS](https://aws.amazon.com/sqs/) Message Queue using [Bernard](http://bernard.readthedocs.io/).
- Synchronous: actually processes the Commands using CommandHandlers

## Install the Application

    composer install

## Configure the Application
Make sure the Amazon Web Services credentials are configured properly in

    src/dic/Config.AmazonWebServices.php

## Start the Application

	composer start

### List Message Queues

    http://localhost:8080/list-queues

### Publish to an Asynchronous CommandBus => persist on Message Queue

    http://localhost:8080/publish-message

### Consume Message from Queue => repost on Synchronous CommandBus

    http://localhost:8080/consume-messages


text:
Mongo support for MiniProfiler
See the home page at: http://miniprofiler.com

To profile, do the following when you create your database:

    new ProfiledMongoDatabase(server, dbSettings, MiniProfiler.Current);

And make sure to set the Mongo formatter

    MiniProfiler.Settings.MongoFormatter = new MongoFormatter();

Docs for the ruby version can be found here: https://github.com/SamSaffron/MiniProfiler/tree/master/Ruby

Licensed under apache 2.0 license, see: http://www.apache.org/licenses/LICENSE-2.0

repository: hudl/MiniProfiler

gha_language: Go

repo_name: hudl/MiniProfiler


text:
0.7.7 / 2021/04/22
==================

- Added hubspot client

0.7.6 / 2021/04/14
==================

- Fix relative link rendering

0.7.5 / 2021/04/9
==================

- Fixes in relative link rendering

0.7.4 / 2021/04/9
==================

- Fixes in link rendering

0.7.3 / 2021/03/30
==================

- Fix isUrlRelative function placement - it was in the wrong file before.

0.7.2 / 2021/03/29
==================

- Add custom image and link rendering functions for Markdown

0.7.1 / 2021/03/26
==================

- Adding JOBS to the list of actor categories

0.7.0 / 2021/03/25
==================

- Adding new actor categories. This needs to be reflected in both app and web.

0.6.3 / 2021/03/05
==================

- Fix invalid published package structure.

0.6.2 / 2021/03/05
==================

- Added `ACTOR_RUN_RESURRECTED` to `WEBHOOK_EVENT_TYPES` constant

0.6.1 / 2021/02/27
==================

- Updated the list of Docker images with SDK v1 images. Deprecated old ones.

0.6.0 / 2021/02/11
==================

- Reworked custom heading renderer in `apifyMarked`
- Updated `marked` to 2.0.0 because of <https://github.com/advisories/GHSA-4r62-v4vq-hr96>

0.5.9 / 2021/02/04
==================

- Added `PROXY_STATUS_URL` environment variable to the constants file

0.5.8 / 2021/02/03
==================

- Updated packages dependencies
- Bump axios to 0.21.1 because <https://www.npmjs.com/advisories/1594>

0.5.7 / 2021/01/14
==================

- Updated function to convert relative image paths in git README files to absolute paths to support more URL formats

0.5.6 / 2020/12/10
==================

- Replaced `crypto` in favor of `create-hmac` in ImageProxyClient so it can be used in browsers as well

0.5.5 / 2020/12/08
==================

- Added new images with fixed version of Apify SDK

0.5.4 / 2020/11/24
==================

- Added function `deterministicUniqueId` for ID generation.

0.5.3 / 2020/11/24
==================

- Packages updated
- Code linted to match the new set of rules

0.5.2 / 2020/11/12
==================

- Replaced deprecated methods insert and remove of collection for mongoDb package

0.5.1 / 2020/10/27
==================

- Added function to convert relative URL paths in git README files to absolute paths

0.5.0 / 2020/10/02
==================

- Removed unused `getPublicCrawlerNiceUrl` function and its unlicensed dependency `slugg`.
- Removed `bluebird` dependency because it was not needed for anything.

0.4.6 / 2020/09/29
==================

- Improved custom code renderer to support default markdown fenced code block with explicitly specified language.

0.4.5 / 2020/09/09
==================

- Fixed custom code renderer to support the use case of rendering code tabs.

0.4.4 / 2020/09/01
==================

- Added custom code renderer to `marked` package

0.4.3 / 2020/08/19
==================

- Fixed getLeadByEmail with multiple leads in response

0.4.2 / 2020/08/18
==================

- Added methods createLead, createEvent, getLeadByEmail into salesforce client

0.4.1 / 2020/08/17
==================

- Moved Salesforce client from commons to shared

0.4.0 / 2020/06/04
==================

- Removed actor template constants in favor of
  [actor templates](https://github.com/apifytech/actor-templates)
  repository and package.

0.3.1 / 2020/06/03
===================

- Exported the `traverseObject()` function and extended the transformation
  function to enable also transformation of values

0.3.0 / 2020/05/26
===================

- Added `utils.makeInputJsFieldsReadable()`
- Dropped NodeJS v8 support

0.2.16 / 2020/05/18
===================

- Removed jsdom and jQuery dependencies from image proxy

0.2.15 / 2020/05/13
===================

- Added `HTTP_URL_REGEX` for better URL matching
- Added new constant with the default Apify platform limits

0.2.14 / 2020/05/05
===================

- Fixed extra whitespace in heading markdown renderer

0.2.13 / 2020/04/29
===================

- Added markdown heading renderer with custom ID support

0.2.12 / 2020/04/27
==================

- Added health checker

0.2.11 / 2020/04/08
==================

- Deprecated ACTOR_LOG_MAX_CHARS in favor of ACTOR_LIMITS.LOG_MAX_CHARS
- Fixed Babel configuration that was not working on iOS devices

0.2.10 / 2020/03/16
==================

- Removed `skipLevelInfo: true` from LoggerJson() to improve LogDNA filtering
- Added SPLIT_PATH_REGEX regex

0.2.9 / 2020-02-27
==================

- Added ACTOR_TEMPLATES

0.2.8 / 2020-02-18
==================

- Added EMAIL_REGEX_STR, added test for EMAIL_REGEX

0.2.7 / 2020-02-12
==================

- Increased node.js version in base images names.

0.2.6 / 2020-02-10
==================

- Added support for Meteor like errors with `reason` property.

0.2.5 / 2020-02-10
==================

- Returning `log.set|getLevel()` methods.

0.2.4 / 2020-02-10
==================

- Fixing logger problem when error doesn't have stack and using console.error() in text logger

0.2.3 / 2020-02-10
==================

- `skipTime` set to `true` by default for a text logger

0.2.2 / 2020-02-10
==================

- Final touches to new logger

0.2.1 / 2020-02-05
==================

- Fix in imports/exports of new logger + added `prepareLogLine` method to `LoggerJson`

0.2.0 / 2020-02-05
===================

- Logger completely rewritten to support colors, be extendable, ... .
  Logger API is compatible with the old one except the `log.internal()` where signature got changed, `logMethodCall|logMethodException()`
  were removed and initial configuration is different.
- Added support for `apifyProxyCountry` to input schema proxy field validation.

0.1.72 / 2020-02-06
===================

- Added statuses for marketplace projects and marketplace user role names to `consts.js`

0.1.71 / 2020-02-06
===================

- Just republishing v0.1.x as latest

0.1.70 / 2020-02-05
===================

- Added "noopener noreferrer" to `markedSetNofollowLinks` in `utilities.client.js`
- Removed Meteor.js related methods and code from the logger

0.1.69 / 2020-01-22
===================

- Added RUN_MEMORY_MBYTES_PER_CPU_CORE constant

0.1.68 / 2019-12-23
===================

- Better error messages for input schema regex errors

0.1.67 / 2019-10-15
===================

- Added stream utilities with readStreamToString() from @apify/http-request

0.1.66 / 2019-10-02
===================

- Added sectionCaption and sectionDescription to string enum input schema field

0.1.65 / 2019-10-02
===================

- Fixed imageProxyClient.updateImagesInHtml() function

0.1.64 / 2019-09-25
===================

- Fixed missing variables in input schema validation messages

0.1.63 / 2019-09-25
===================

- Added validateInputSchema function to validate input schema with user friendly messages

0.1.62 / 2019-09-18
===================

- Added new function to ImageProxyClient

0.1.61 / 2019-09-18
===================

- Added MAX_MULTIFILE_BYTES and SOURCE_FILE_FORMATS to consts.

0.1.60 / 2019-09-16
===================

- Added actor name constraints const

0.1.59 / 2019-09-11
===================

- Updated `secretKey` option to `hmacKey` for image proxy client

0.1.58 / 2019-09-10
===================

- Added client to generate URL for Apify image proxy

0.1.57 / 2019-08-22
===================

- Moved `splitFullName` function from `utilities.js` to `utilities.client.js`

0.1.56 / 2019-07-30
===================

- Added `sectionCaption` and `sectionDescription` as available properties for each input type in `INPUT_SCHEMA.json`

0.1.55 / 2019-07-18
===================

- Removed `SPORTS` and `UTILS` from `ACTOR_CATEGORIES`

0.1.54 / 2019-07-16
===================

- Updated labels in ACTOR_CATEGORIES

0.1.53 / 2019-07-15
===================

- Added python editor to input schema

0.1.52 / 2019-07-04
===================

- _traverseObject() function used in unescapeFromBson() skips buffers.

0.1.51 / 2019-05-16
===================

- Add support of dot notation (`resource.id`) to `WebhookPayloadTemplate`.

0.1.50 / 2019-05-16
===================

- Fix `WebhookPayloadTemplateError` `captureStackTrace` error in environments without support.

0.1.49 / 2019-05-16
===================

- Refactor `WebhookPayloadTemplate` to disregard JSON.parse error messages in parsing.

0.1.48 / 2019-05-15
===================

- Added `WEBHOOK_DEFAULT_PAYLOAD_TEMPLATE` and `WEBHOOK_ALLOWED_PAYLOAD_VARIABLES` to consts.

0.1.47 / 2019-05-15
===================

- Added `InvalidJsonError` and `InvalidVariableError` to `WebhookPayloadTemplate`.

0.1.46 / 2019-05-14
===================

- Added `APIFY_UI_CLIENT_KEY` constant

0.1.45 / 2019-05-14
===================

- Fixed exponential backoff to include error in warning logs

0.1.44 / 2019-05-09
===================

- Renamed `JsonToken` to `JsonVariable`.

0.1.43 / 2019-05-07
===================

- Added `jsonStringifyExtended()` and `JsonToken` class to client utils.

0.1.42 / 2019-04-17
===================

- Added input field definition allowing to create a field of any type with editor "json" or "hidden".
- Changed `./publish.sh` script to work with master only, we don't support develop branch any more.


text:
Installation

1. clone the directory
2. update the composer via composer update
3. Duplicate the .env.example and create .env file with database username & password
3. Create a database known as demo-cimpress
3. import the Symfony gitHub repositories using php artisan import:github-data
4. run the project with route as cimpress/public/user/repositories to get the listing


text:
---
title: Endpoint Lookup Example - Spine FHIR Endpoints
keywords: build, directory, endpoints
tags: [design]
sidebar: overview_sidebar
permalink: build_endpoints_example_spine_fhir.html
summary: "Worked example of looking up a Spine endpoint from SDS for Spine FHIR APIs"
---

## Worked example of the endpoint lookup process ##

### Step 0. PDS Trace (pre-requisite step)

The Consuming system is responsible for [performing a PDS Trace](pds_overview.html) to verify the identity of the patient and find or confirm their NHS Number.

For this example, NHS Number<PHONE_NUMBER> with demographic details Mr Anthony Tester, 19 Ficticious Avenue, Testtown

### Step 1. Accredited System Lookup on SDS

Assuming we are using the Spine Development environment, we can refer to the [details of that environment](test_environments.html) and use the fixed party key value: **YES-0000806**

### Step 2: MHS lookup on SDS to determine FHIR endpoint Server Root URL

We need to identify the interaction ID appropriate for the API call we wish to make. Assuming we are calling the Visitors and Migrants API and want to use major version 1 of that API, the interaction ID we need (as per the [API spec](https://developer.nhs.uk/apis/vandm) for the API) is: **urn:nhs:names:services:visitorsandmigrants:fhir:rest:search:observation:1**

Using the Party Key identified in Step 1, and the interaction ID, the following ldapsearch query is executed against the SDS URL for the appropriate [environment](test_environments.html):

	ldapsearch -x -H ldaps://ldap.vn03.national.ncrs.nhs.uk -b "ou=services, o=nhs"
	"(&(nhsMhsPartyKey=YES-0000806) (objectClass=nhsMhs) (nhsMhsSvcIA=urn:nhs:names:services:visitorsandmigrants:fhir:rest:search:observation:1))"
	nhsMhsEndPoint nhsMHSFQDN

This query should return a single endpoint. In this case, the ldapquery returns the following results:

TODO

repository: nhsconnect/FHIR-SpineCore

gha_language: CSS

repo_name: nhsconnect/FHIR-SpineCore


text:
# Release Notes

## Development

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.13.0...master)

## v0.13.0 - February 15th, 2015
- add method will now always replace a previous mixin with the same alias & removed the replace function - 7c005c0

In order to have deterministic behavior with mixins that are added w/o namespaces and un-qualified references to mixins registered with a namespace there is no longer a ```React.mixins.replace``` and ```React.mixins.add``` will *always* replace a mixin if it currently exists with the same alias.

If you only want to add a mixin if it does not previously exist, you can use

```
    if (!React.mixins.exists('mixinName')) {
      React.mixins.add('mixinName', ...);
    }
```

Also, getting close to a 1.0 release

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.12.0...v0.13.0)

## v0.12.0 - February 12th, 2015
- add namespace support - a03f201

If the name contains a dot "." the prefix is assumed to be the namespace.  A mixin can be retrieved by either using the fully qualified name or the suffix.  The first mixin to be added with any suffix will be returned if there are 2 different namespaces with the same suffix.

```
    React.mixins.add('namespace-a.foo', aFoo);
    React.mixins.add('namespace-b.foo', bFoo);
    mixins: ['foo'] // will result to [aFoo]
    mixins: ['namespace-a.foo'] // will result to [aFoo]
    mixins: ['namespace-b.foo'] // will result to [bFoo]
```

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.11.2...v0.12.0)

## v0.11.2 - February 9th, 2015
- fix bug when named mixins were using the mixins attribute to define dependencies - f2dea59

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.11.1...v0.11.2)

## v0.11.1 - February 5th, 2015
- fix token comment in un-minified source (for react-backbone) - df41ae9
(no functional change)

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.11.0...v0.11.1)

## v0.11.0 - February 5th, 2015
- add customizable deferUpdate timer - 9b28b4e

```React.mixins.defaultDeferUpdateInterval``` can be used to set the interval in milis between the ```deferUpdate``` call and the actual ```forceUpdate``` call.  A value < 0 will not defer the ```forceUdpate``` call (beneficial only to change behavior of 3rd party mixins that depend on this functionality).

The defer interval can also be adjusted on a per component basis.  Any mixins registered as dependencies of the React component will obey the value that is set for the component.  It can be set using the mixin parameter.

```
React.createClass({
  // call forceUpdate 100 ms after the deferUpdate call
  mixin: ['deferUpdate(100)'],

  somethingThatRequiresUpdate: function() {
    this.deferUpdate();
  }
});
```

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.10.0...v0.11.0)

## v0.10.0 - December 29th, 2014
- initiatedOnce mixins should accept array or argument arrays - dc3cdc4

Compatibility notes:
If you are using the advanced "initiatedOnce" capabilities, the argument structure has changed.

Previously, there would be a function argument representing each parameterized mixin reference and now there is a single argument which is an array of argument arrays.  The length of this array would be equal to the number of times the mixin was referenced with parameters.

For example:
```
    mixins: ['foo("a")', 'foo("b", "c")']
```
Would previously execute the mixin wrapper function as
```
    function(["a"], ["b", "c"])
```
But will now use
```
    function([["a"], ["b", "c"]])
```

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.9.4...v0.10.0)

## v0.9.4 - December 11th, 2014
- code cleanup and remove accidental global var 5f4674f

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.9.3...v0.9.4)

## v0.9.3 - December 10th, 2014
no functional code changes.  There is just an additional comment that is used to create react-backbone/with-deps.js

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.9.2...v0.9.3)

## v0.9.2 - December 1st, 2014
- allow object mixin references to have a "mixins" attribute to define dependencies - e6a1edd

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.9.1...v0.9.2)

## v0.9.1 - November 26th, 2014
- for AMD, you must execute the function with params (see README AMD install instructions) - 37c72bb
```
require(
  ['react', react-mixin-manager'], function(React, reactMixinManager) {
  reactMixinManager(React);
});
```

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.9.0...v0.9.1)

## v0.9.0 - November 25th, 2014
- add React.mixins.getState / React.mixins.setState methods - 42443d2

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.8.0...v0.9.0)

## v0.8.0 - November 11th, 2014
- add "state" mixin - 4c00d185

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.7.1...v0.7.2)

## v0.7.1 - September 7th, 2014
- add react-component keyword - bcdeeb9

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.7.0...v0.7.1)

## v0.7.0 - August 8th, 2014
- [#1](https://github.com/jhudson8/react-mixin-manager/pull/1) - Once initiated mixins support. ([@anatolikurtsevich](https://api.github.com/users/anatolikurtsevich))

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.6.1...v0.7.0)

## v0.6.1 - July 19th, 2014
- bug fix: include dependencies when mixin parameters are used - ec68956

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.6.0...v0.6.1)

## v0.6.0 - July 19th, 2014
- add React component provided mixin parameters - e574075

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.5.2...v0.6.0)

## v0.5.2 - June 16th, 2014
- allow add/replace signature (name, array) where array is [mixin, dependencies...] - 798c6a2
- add bower.json - ea204e6

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.5.1...v0.5.2)

## v0.5.1 - June 14th, 2014
- remove console.log - 3e2bc8a
- Update README.md - 286555c

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.5.0...v0.5.1)

## v0.5.0 - June 14th, 2014
- added the "deferUpdate" mixin - 4e74d21

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.4.0...v0.5.0)

## v0.4.0 - May 18th, 2014
- add new "inject" functionality - 7fc5324

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.3.0...v0.4.0)

## v0.3.0 - May 16th, 2014
- change "group" function name to "alias" - 21e6242
- fix author email address - 85358eb

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.2.0...v0.3.0)

## v0.2.0 - May 15th, 2014
- add mixing group registration API - f53d869
- allow mixins to be functions for later execution - e81cfb3

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.1.2...v0.2.0)

## v0.1.2 - May 10th, 2014
- require React to be passed as param for commonJS init - 887f7d8

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/v0.1.1...v0.1.2)

## v0.1.1 - May 10th, 2014
- add index.js

[Commits](https://github.com/jhudson8/react-mixin-manager/compare/ee47aec...v0.1.1)

repository: franferdez/easytobook-challenge

repo_name: franferdez/easytobook-challenge


text:
# aws-jamulus

Automatically sets up a Jamulus server and a Ardour mixing console on AWS using CDK. [Jamulus](https://jamulus.io) allows bands to do jam sessions in a remote environment. [Ardour](http://ardour.org) is a digital audio workstation which supports thousands of plugins to let your mix sound nice.

## Architecture

The basic architecture is shown in the image below. We setup a Jamulus server in the AWS cloud which will be available through a defined DNS entry. In addition, it will set up an EC2 instance prepared for being a mixing console.

Every musician opens one Jamulus instance per instrument or microphone and associates the signal to one instance. The Jamulus instances connect to the Jamulus server. The mixing console opens one Jamulus instance per instrument or microphone and directs the signal to separate input channels on Ardour.

![architecture](./diagrams/architecture.png)

## Getting Started (rough list of commands)

```bash
git clone https://github.com/cabcookie/aws-jamulus.git
cd aws-jamulus
# npm install global cdk
# npm install global awscli
npm install
# create PEM file with name JamulusKey in EC2 and download it
# aws configure
cdk bootstrap
cdk deploy
```

## TODOS

- describe how to establish a Jamulus Server
- describe how to establish a Mixing Console
- create .sh files for connecting with the server and the mixing console
- describe pre-requisites
1. Create AWS account
1. Creating a key pair
1. Create two Elastic IPs so your Jamulus Server and your Mixing Console always have the same IP; copy the allocation ID
1. Install cdk and aws cli locally
1. Clone git repo
1. Configure aws environment

## Information on the CDK TypeScript project

The `cdk.json` file tells the CDK Toolkit how to execute your app.

### Useful commands

 * `npm run build`   compile typescript to js
 * `npm run watch`   watch for changes and compile
 * `npm run test`    perform the jest unit tests
 * `cdk deploy`      deploy this stack to your default AWS account/region
 * `cdk diff`        compare deployed stack with current state
 * `cdk synth`       emits the synthesized CloudFormation template

repository: ghukar/aws-jamulus

repo_name: ghukar/aws-jamulus


text:
# jest-manual-mock-example

A very simplistic example of how to mock our own modules in React and React Native using Jest.

Inspired by https://stackoverflow.com/q/54213418/5466997.

### Run the Example

```
$ npm i && npm test
```

### Steps by Step

1. Add a folder named **__mocks__** at the same level as the module you want to mock:
```
src
├── config
│   ├── __mocks__
│   │   └── MyModule.js
│   └── MyModule.js
```

2. In your test file, call `jest#mock` with the correct path to your module (the original one!):
```
import React from "react";
import Enzyme from "enzyme";

jest.mock("path/to/MyModule")

// your tests down here
// ...
```
And require your component in the test block, not on top:
```
it("should pass", () => {
  const Comp = require("./Comp").default;

  // your actual test here
```
Otherwise your mock won't be injected.

3. Alternatively, you may define your own mocks directly in the test!
```
jest.mock("./config/i18n", () => { /* your mock implementation here! */});
```

repository: josemigallas/jest-manual-mock-example

repo_name: josemigallas/jest-manual-mock-example


text:
# Google Tag Manager
[![npm](https://img.shields.io/npm/dt/@nuxtjs/google-tag-manager.svg?style=flat-square)](https://www.npmjs.com/package/@nuxtjs/google-tag-manager)
[![npm (scoped with tag)](https://img.shields.io/npm/v/@nuxtjs/google-tag-manager/latest.svg?style=flat-square)](https://www.npmjs.com/package/@nuxtjs/google-tag-manager)

> Add Google Tag Manager (GTM) to your nuxt.js application.
This plugins automatically sends first page and route change events to GTM.

## Setup
- Add `@nuxtjs/google-tag-manager` dependency using yarn or npm to your project
- Add `@nuxtjs/google-tag-manager` to `modules` section of `nuxt.config.js`
```js
  modules: [
   ['@nuxtjs/google-tag-manager', { id: 'GTM-XXXXXXX' }],
  ]
```

## Options

### `id`
- Required
- Can be String in form of `GTM-XXXXXXX`
- Can be function returning Promise or String:
```js
// Returns Promise
id: () => {
  return axios.get('http://example.com/')
    .then(({ data }) => {
      return data.gtm_id
    })
}

// Returns String
const code = '1234567'
id: () => {
  return 'GTM-' + code
}
```

### All options
```js
{
  id: 'GTM-XXXXXXX',
  layer: 'dataLayer',
  pageTracking: false,
  pageViewEventName: 'nuxtRoute',
  respectDoNotTrack: false,
  dev: true, // set to false to disable in dev mode
  query: {
    // query params...
    gtm_auth:        '...',
    gtm_preview:     '...',
    gtm_cookies_win: '...'
  },
  scriptURL: '//example.com',
  noscriptURL: '//example.com'
}
```

### Router Integration

You can optionally set `pageTracking` option to `true` to track page views.

This is disabled by default to prevent double events when using alongside with Google Analytics so take care before enabling this option.

The default event name for page views is "nuxtRoute", you can change it by setting the `pageViewEventName` option.

## Usage

### Pushing events

You can push events into the configured `layer`:
```js
this.$gtm.pushEvent({ event: 'myEvent', ...someAttributes })
```