Skip to content

Instantly share code, notes, and snippets.

View entropitor's full-sized avatar

Jens Claes entropitor

View GitHub Profile
@entropitor
entropitor / why.ts
Created March 28, 2022 12:59
Why (advanced) typescript types
// Why do we compute types from other types? Is it practical?
//
// Image a function that takes a url like "/company/:companyName" and some parameters like {companyName: "DataCamp"}
// and returns the url with parameters filled in like "/company/DataCamp"
//
// How would we type this?
// A naive implementation might be like the following:
// (With Record<string, string> just be any "map"/"object" with string keys and string values)
const fillInUrl = (url: string, parameters: Record<string, string>): string => {
@entropitor
entropitor / convert-dashboard.mjs
Created December 15, 2020 16:56
terraformer import datadog-dashboard
import fs from "fs";
const body = JSON.parse(fs.readFileSync("./dashboard.json").toString());
const renderGroupWidget = (widget) => {
return `widget {
group_definition {
layout_type = "${widget.definition.layout_type}"
title = "${widget.definition.title}"
${renderWidgets(widget.definition.widgets)
@entropitor
entropitor / hide-slack-sidebar.user.js
Last active October 26, 2020 17:03
Hide slack sidebar
// ==UserScript==
// @name Slack Hide Sidebar
// @namespace entropitor.com
// @version 2.1
// @grant none
// @include https://app.slack.com/*
// @run-at document-idle
// ==/UserScript==
function getElements() {
const sidebar = document.querySelector('.p-workspace__sidebar')
@entropitor
entropitor / index.js
Created April 9, 2019 12:31
Fix react navigation bug
import React, { Component } from 'react'
import { View, Text, TouchableOpacity, AppRegistry } from 'react-native'
import {
createSwitchNavigator,
createStackNavigator,
StackActions,
NavigationActions,
createAppContainer,
} from 'react-navigation'

Keybase proof

I hereby claim:

  • I am entropitor on github.
  • I am entropitor (https://keybase.io/entropitor) on keybase.
  • I have a public key ASC1g7JjRIQbFR6uY1mozUi8sqxEi6w3SmywtO5Kai9ynAo

To claim this, I am signing this object:

@entropitor
entropitor / gist:11395463
Created April 29, 2014 09:42
keybase.md
### Keybase proof
I hereby claim:
* I am caske33 on github.
* I am caske33 (https://keybase.io/caske33) on keybase.
* I have a public key whose fingerprint is C7F4 D6E1 1E71 93E1 E5A1 127D 9320 04D3 6CE7 311C
To claim this, I am signing this object: