Skip to content

Instantly share code, notes, and snippets.

View vnys's full-sized avatar

Victor Nystad vnys

View GitHub Profile

How to add SSL binding for Equinor domains in azure

In this readme we will use the eds.equinor.com domain as an example. Can be done for any sub domain, given you have setup correct DNS/Re-routing.

1. Generate new key & request (needs to be be done only once)

Run in terminal

openssl req -new -newkey rsa:2048 -nodes -keyout eds.equinor.com.key -out request.csr
/*
* This script fetches all color styles from a Figma team/document.
*
* Dependencies:
*
* - node-fetch
*
* Due to a limitation in the Figma /styles endpoint, we need to use a
* document for actually using the colors in a color grid 🙄That's why
* we're both fetching from /styles and /files below.
@vnys
vnys / figma-project-stats.js
Created May 1, 2020 05:57 — forked from rsms/figma-project-stats.js
Script that generates statistics for a Figma project, like number of files, frames, versions etc
//
// Figma project stats
// Pulls statistics like number of files, frames, versions etc for a project.
//
// Usage:
// export FIGMA_API_ACCESS_TOKEN='your-token'
// node figma-project-stats.js <project-id>
//
// You can generate tokens in your account settings or at
// https://www.figma.com/developers/explorer#personal-access-token
@vnys
vnys / adding-props-to-styled-components.md
Last active April 20, 2020 09:31
adding props to styled components

Sometimes it’s useful to extend an existing component and add style props similar to styled-system

const addMarginRightProp = () => ({ marginRight }) =>
  marginRight && { marginRight: `${marginRight}px` }

const IconWithMarginProp = styled(Icon)(addMarginRightProp)
const ButtonWithMarginProp = styled(Button)(addMarginRightProp)
@vnys
vnys / launch.json
Created December 20, 2019 08:29 — forked from cecilemuller/launch.json
Run ts-node in VSCode Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Node Inspector",
"type": "node",
"request": "launch",
"args": ["${workspaceRoot}/src/service.ts"],
"runtimeArgs": ["-r", "ts-node/register"],
"cwd": "${workspaceRoot}",
@vnys
vnys / ..git-pr.md
Created November 8, 2019 10:25 — forked from gnarf/..git-pr.md
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@vnys
vnys / README.md
Created September 12, 2019 06:06 — forked from hofmannsven/README.md
Increase key repeat rate on macOS

Increase key repeat rate on macOS

Settings: System Preferences » Keyboard » Key Repeat/Delay Until Repeat

Use the commands below to increase the key repeat rate on macOS beyond the possible settings via the user interface. The changes aren't applied until you restart your computer.

Source: https://apple.stackexchange.com/a/83923

How to: Equinor private NPM registry

Disclamer: This is just an example on how to do these tasks. You can configure npm/yarn in many ways to make life easier.
Feel free to experiment.

Login

CLI

Requirements: Have a Github account that is a member of the Github organization Equinor

  1. Create a personal access token on Github with the read:org scope
  2. Run npm login --registry https://npm.equinor.com
@vnys
vnys / nuke-mock-data-with-bgf.md
Last active June 4, 2019 09:41
nuke mock-data with bfg

Nuking mock-data folder from git repo

Assuming: Mac, no java sdk installed, homebrew installed

$ brew cask install adoptopenjdk
$ brew install bfg
$ cd my-git-repo
$ bfg --delete-folders mock-data --no-blob-protection ./
$ git reflog expire --expire=now --all

$ git gc --prune=now --aggressive

@vnys
vnys / git-checkout-pr.md
Last active June 4, 2019 06:19
check out pr
$ git fetch origin pull/123/head:pr-123

$ git checkout pr-123