Skip to content

Instantly share code, notes, and snippets.

View benjdlambert's full-sized avatar
🍺

Ben Lambert benjdlambert

🍺
View GitHub Profile
/*
* Copyright 2020 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@benjdlambert
benjdlambert / index.ts
Last active September 11, 2021 01:45
Scaffolder Extension
//packages/app/src/scaffolder/extensions/index.ts
import { scaffolderPlugin, createScaffolderFieldExtension } from '@backstage/plugin-scaffolder';
import { BitbucketToken }
export const BitbucketFieldExtension = scaffolderPlugin.provide(
createScaffolderFieldExtension({
name: 'BitbucketToken',
component: BitbucketToken,
})
);
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"annotations": {
"deployment.kubernetes.io/revision": "1",
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"app.kubernetes.io/name\":\"emoji\",\"app.kubernetes.io/part-of\":\"emojivoto\",\"app.kubernetes.io/version\":\"v10\",\"backstage.io/kubernetes-id\":\"emoji\"},\"name\":\"emoji\",\"namespace\":\"emojivoto\"},\"spec\":{\"replicas\":1,\"selector\":{\"matchLabels\":{\"app\":\"emoji-svc\",\"version\":\"v10\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"emoji-svc\",\"backstage.io/kubernetes-id\":\"emoji\",\"version\":\"v10\"}},\"spec\":{\"containers\":[{\"env\":[{\"name\":\"GRPC_PORT\",\"value\":\"8080\"},{\"name\":\"PROM_PORT\",\"value\":\"8801\"}],\"image\":\"buoyantio/emojivoto-emoji-svc:v10\",\"name\":\"emoji-svc\",\"ports\":[{\"containerPort\":8080,\"name\":\"grpc\"},{\"containerPort\":8801,
time="2018-09-16T14:15:51Z" level=info msg="running version v18.8.4"
time="2018-09-16T14:15:51Z" level=info msg="Adding k8s name resolver"
time="2018-09-16T14:15:51Z" level=info msg="starting admin server on :9999"
time="2018-09-16T14:15:51Z" level=info msg="waiting for caches to sync"
time="2018-09-16T14:15:51Z" level=info msg="starting gRPC server on 127.0.0.1:8089"
time="2018-09-16T14:15:52Z" level=info msg="Establishing watch on endpoint offers.ms:8443"
time="2018-09-16T14:15:52Z" level=info msg="Establishing watch on endpoint objectives.ms:8443"
time="2018-09-16T14:15:52Z" level=info msg="Establishing watch on endpoint notifications.ms:8443"
time="2018-09-16T14:15:52Z" level=info msg="Establishing watch on endpoint balance.ms:8443"
time="2018-09-16T14:15:52Z" level=info msg="Establishing watch on endpoint places.ms:8443"
@benjdlambert
benjdlambert / instructions.md
Last active August 23, 2018 17:11
Bowling!

Bowling Code Challenge

  • Please create a repository in GitHub (or a similar service) so that we can follow your progress.
  • The implementation should use either Javascript, Go.
  • Remember that we are more interested how you approach this problem than seeing you complete all the features (if you don't have enough time to finish everything, simply explain how you would continue the implementation).

Minimum requirements

  • Implement a scoring system for a bowling game according to these rules:
  • A game consists of 10 frames.
Name: controller-859c95f77f-lthpf
Namespace: linkerd
Node: ip-172-20-102-28.eu-west-1.compute.internal/172.20.102.28
Start Time: Wed, 15 Aug 2018 02:34:17 +0200
Labels: linkerd.io/control-plane-component=controller
linkerd.io/control-plane-ns=linkerd
linkerd.io/proxy-deployment=controller
pod-template-hash=4157519339
Annotations: linkerd.io/created-by=linkerd/cli v18.8.1
linkerd.io/proxy-version=v18.8.1
function createContainer(ReactClass, options) {
return class Container extends React.Component {
setDataParams(dataParams) {
this.setState({ dataParams })
}
render() {
return <ReactClass setDataParams={this.setDataParams} />
}
}
}
@benjdlambert
benjdlambert / method.md
Last active June 5, 2021 21:41
Route -> Page -> Container -> Presentation

Route -> Page -> Container -> Presentation

What is this?

This document outlines a method of structuring React components, in a clean, efficient, managable way. Its based loosely around https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0, but gives a much more indepth description on how everything should fit together.

It outlines what each component type is responsible for, and how they are supposed to be structured.

Recommended File Structure

app/
@benjdlambert
benjdlambert / example.jsx
Created September 5, 2016 11:19
Static Properties on Components
// old way
class TestComponent extends React.Component {
render() {
return <h1>{this.props.header}</h1>
}
}
TestComponent.defaultProps = {
header: 'hello',
};
@benjdlambert
benjdlambert / query.js
Created October 8, 2014 12:33
Content Search Query
{
"project":"earth-uk-index",
"query":{
"and":[
{
"and":[
[
"promo:card-type",
"=",
"photo"