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 / clone.sh
Created January 13, 2022 15:49
Clone all repos in an org
#!/bin/bash
# gh is the GitHub CLI
ORG='cdk8s-team'
gh repo list cdk8s-team --json "name" | jq -r ".[] | .name" | xargs -I '{}' gh repo clone "cdk8s-team/{}"
@DanielMSchmidt
DanielMSchmidt / update-renovate.js
Created September 3, 2020 14:40
Generates renovate config to fix @types and package running out of sync
#!/usr/bin/env node
// Generates renovate config to fix @types and package running out of sync
// See https://github.com/renovatebot/renovate/issues/4893
const path = require("path");
const fs = require("fs");
// This script lies under scripts/update-renovate.js, therefore the ..
const renovatePath = path.resolve(__dirname, "../renovate.json");
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View
} from 'react-native';
import { Accelerometer } from "react-native-sensors";
const Value = ({name, value}) => (
<View style={styles.valueContainer}>
import React, { Component } from "react";
import { StyleSheet, Text, View, Image } from "react-native";
import { Gyroscope } from "react-native-sensors";
const Dimensions = require("Dimensions");
const PixelRatio = require("PixelRatio");
const window = Dimensions.get("window");
const deviceWidth = window.width;
const deviceHeight = window.height;
@DanielMSchmidt
DanielMSchmidt / 0-README.md
Last active December 10, 2018 13:00
This is a rough draft of how we could define mocks in a nice way

API Proposal

I would like to solve the problem of stubs in a way that allows us to easily extend them. I would also like to prevent the stubs to go stale and I would like to have it defined in a central place. Let me show you what I have in mind on the next files.

@DanielMSchmidt
DanielMSchmidt / README.md
Last active February 27, 2018 09:53
Remove this from tests

Run this on your tests to remove every this.foo from the tests

npm install -g jscodeshift

jscodeshift --transform https://gist.githubusercontent.com/DanielMSchmidt/9e1bc548ab5d8d1a3fadddc2d735f8c2/raw/808d337f6088ff62feae99115edaf59a6c333b1a/transform.js ./**/__tests__/*.js
const tracer = ... // As previously defined
tracer.scoped(() => {
// Previous example
const previousResult = 404;
tracer.scoped(() => {
const id = tracer.createChildId();
tracer.setId(id);
tracer.recordAnnotation(new zipkin.Annotation.ClientSend());
const tracer = ... // like defined before
function loadFromLocalStorage() { return new Promise(...) }
tracer.local("load", loadFromLocalStorage()).then(loadedData => {
tracer.local("compute", () => {
runComputationOn(loadedData);
});
});
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"));
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