Skip to content

Instantly share code, notes, and snippets.

Avatar

Rob Wierzbowski robwierzbowski

View GitHub Profile
@robwierzbowski
robwierzbowski / husky-to-simple-git-hooks.sh
Created May 18, 2022
Convert Husky to Simple Git Hooks
View husky-to-simple-git-hooks.sh
rm -f .huskyrc.js
cat > .simple-git-hooks.js << EOF
const { simpleGitHooks } = require('@stitch-fix/kufak-fe-infra');
module.exports = simpleGitHooks;
EOF
View schema.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"anyOf": [
{
"$ref": "#/definitions/{name:\"order\"|\"categories\"|\"exchange\"|\"freestyle\"|\"homefeed\"|\"post_checkout_promo\"|\"return\"|\"shopping_bag\"|\"storybook\";schema:\"screen_view\";locale:\"en-GB\"|\"en-US\";region:\"UK\"|\"US\";source_app:\"android\"|\"storybook\"|\"home-ui\"|\"kept-items-ui\"|\"shop-collections-ui\";}"
},
{
"$ref": "#/definitions/{name:\"buy_it_again_index\"|\"category\"|\"collections_index\"|\"kept_items_index\"|\"saved_items_index\";schema:\"category_screen_view\";locale:\"en-GB\"|\"en-US\";region:\"UK\"|\"US\";source_app:\"android\"|\"storybook\"|\"home-ui\"|\"kept-items-ui\"|\"shop-collections-ui\";category_id:string;}"
},
{
View idea.rb
# frozen_string_literal: true
# Collector for v2 "atomic" events. This is currently a bare-minimum implementation
# for v2 event steel-threads. These events should not yet be used for any production
# data processing.
class Api::V2::EventsCollectorController < Api::ApiController
# Client-auth data is being used to add client-id to our event payloads
include StitchFix::ClientFacingAuth::ControllerHelpers
include StitchFix::Logger::Logging
View example.yml
version: 2.1
###################
# SHARED COMMANDS #
###################
cache_key: &cache_key dependency-cache-{{ checksum "yarn.lock" }}
# Docker build environment images
build_env: &build_env
image: cimg/node:current-browsers
@robwierzbowski
robwierzbowski / switch_to_npm_registry.sh
Last active Mar 11, 2022
Configure yarn to use the npm registry directly
View switch_to_npm_registry.sh
#!/bin/bash
# Remove all settings in the .npmrc except the required auth token setting.
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
# Create a new .yarnrc that specifies the npm registry, or append to an existing one.
echo 'registry: https://registry.npmjs.org/' >> .yarnrc
# Remove and regenerate the yarn.lock. This should be identical to running `yarn upgrade`.
# If you are uncomfortable regenerating the yarn.lock file, you can comment out the next
@robwierzbowski
robwierzbowski / index.js
Last active Nov 15, 2017
No `sort()` anagram tester
View index.js
// Takes two strings.
// Returns true if they're anagrams, false if not.
function isAnagram (a, b) {
const remove = (string, pattern) => string.replace(new RegExp(pattern, 'ig'), '');
// Discard whitespace; anagrams can be different numbers of words
let lettersA = remove(a, '\\s');
let lettersB = remove(b, '\\s');
@robwierzbowski
robwierzbowski / additive.scss
Last active Nov 2, 2017
Example of additive styles
View additive.scss
.userPreview {
border: solid $off-black;
&.--default {
border-width: 5px;
font-size: 1.5rem;
background: $light-gray;
}
&.--compact {
@robwierzbowski
robwierzbowski / non-additive.scss
Last active Nov 2, 2017
Example of non-additive styes
View non-additive.scss
.userPreview {
border: 5px solid $off-black;
font-size: 1.5rem;
background: $light-gray;
&.--compact {
border: 1px solid $off-black;
font-size: 1rem;
background: transparent;
}
@robwierzbowski
robwierzbowski / UserList.html
Created Nov 2, 2017
UserList template example
View UserList.html
<article styleName='userList'>
<h1 styleName='title'>Friends</h1>
<ul styleName='users'>
<li styleName='user'>
<UserPreview user={1} compact={true} />
</li>
<li styleName='user'>
<UserPreview user={2} compact={true} />
</li>
<li styleName='user'>