Skip to content

Instantly share code, notes, and snippets.

View DanielMSchmidt's full-sized avatar
🚀
Working on Terraform Core

Daniel Schmidt DanielMSchmidt

🚀
Working on Terraform Core
View GitHub Profile
@DanielMSchmidt
DanielMSchmidt / accordion-test.js
Last active September 3, 2021 08:17
A Jest snapshot test for an accordion
import React from 'react';
import renderer from 'react-test-renderer';
import Accordion from '../src/components/Accordion';
describe('Accordion', () => {
it('renders the additional content on hover', () => {
const component = renderer.create(
<Accordion activeIndex={1} headlines={['Foo', 'Bar', 'Baz']} content={['Foo Content', 'Bar content', 'Baz content']} />
);
@DanielMSchmidt
DanielMSchmidt / accordion-test.js.snap
Created August 21, 2016 13:24
The snapshot for the accordion
exports[`Accordion renders the additional content on hover 1`] = `
<ul>
<li>
<h3>
Foo
</h3>
</li>
<li>
<h3>
Bar
{
"jest": {
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less|scss|sass)$": "identity-obj-proxy"
}
},
}
$ npm install -g flow-bro # npm installation
$ yarn global add flow-bro # yarn installation
$ flow-bro get-untyped 2
This may take a while, concurrency is limited to reduce the failure rate.
Why dont you go get a coffee, I will do the heavy lifting!
The following files have the least flow coverage:
@DanielMSchmidt
DanielMSchmidt / ci-check.sh
Last active May 7, 2017 08:48
Prettier CI Check
./node_modules/.bin/prettier --write ./**/*.js # insert your prettier command here
if [ "$(git status --porcelain | wc -l)" != "0" ]; then exit 1 ; fi
@DanielMSchmidt
DanielMSchmidt / wercker.yml
Created May 9, 2017 22:13
Expo deployment through wercker
box: node
build:
steps:
- script:
name: Install Exponent CLI
code: |
npm install -g exp
# A step that executes `npm install` command
- npm-install
@DanielMSchmidt
DanielMSchmidt / index.js
Last active May 31, 2017 09:37
Minimal example of how to use zipkin
const express = require('express');
const { BatchRecorder, Tracer, Annotation, ExplicitContext } = require('zipkin');
const { HttpLogger } = require('zipkin-transport-http');
const tracer = new Tracer({
ctxImpl: new ExplicitContext(),
recorder: new BatchRecorder({
logger: new HttpLogger({
endpoint: 'http://localhost:9411/api/v1/spans',
}),
import zipkin from "zipkin";
import { HttpLogger } from "zipkin-transport-http";
const tracer = new zipkin.Tracer({
ctxImpl: new zipkin.ExplicitContext(),
recorder: new zipkin.BatchRecorder({
logger: new HttpLogger({
endpoint: 'http://localhost:9411/api/v2/spans',
jsonEncoder: zipkin.jsonEncoder.JSON_V2,
fetch
const tracer = ... // See example above
tracer.scoped(() => {
const id = tracer.createRootId();
tracer.setId(id);
tracer.recordAnnotation(new zipkin.Annotation.ClientSend());
tracer.recordAnnotation(new zipkin.Annotation.Rpc("My Span"));
const tracer = ... // like defined before
function loadFromLocalStorage() { return new Promise(...) }
tracer.local("load", loadFromLocalStorage()).then(loadedData => {
tracer.local("compute", () => {
runComputationOn(loadedData);
});
});