Skip to content

Instantly share code, notes, and snippets.

View yowainwright's full-sized avatar
👦
Dad life!

Jeff Wainwright yowainwright

👦
Dad life!
View GitHub Profile
@briangonzalez
briangonzalez / dark-title-bar.sh
Last active September 8, 2016 16:04
Atom - Dark Title Bar
# A prettier Atom via PR #10208.
# https://github.com/atom/atom/pull/10208
# Quit then remove.
osascript -e 'quit app "Atom"'
rm -rf /Applications/Atom.app
# Install, build, then open.
git clone -b pb-hidden-inset-1.8 git@github.com:briangonzalez/atom.git
cd atom
#!/bin/bash -
#===============================================================================
# FILE: repos.sh
#
# USAGE: Update all the git repos in your ~/code directory. This will
# skip over "dirty" (code changed and uncommited) repos and
# give a warning and, after completion, list those repos.
#
# The script will ask if you want to npm install or npm build
# in the frontend repos, default is "n" (no).
@rodneyrehm
rodneyrehm / polyfill-intl.js
Created August 21, 2017 08:16
Webpack: load Intl polyfill with languages
const needsPolyfill = !window.Intl
/* eslint-disable import/no-webpack-loader-syntax */
const intl = require('bundle-loader?lazy&name=intl!intl')
/* eslint-enable import/no-webpack-loader-syntax */
const polyfilled = needsPolyfill && new Promise(resolve => {
intl(resolve)
})
@DiogoDoreto
DiogoDoreto / yarn-lock-check.js
Last active April 18, 2022 03:39
Log dependencies that are potentially duplicated in yarn.lock
const readline = require('readline');
const fs = require('fs');
const file = fs.createReadStream('yarn.lock');
const rl = readline.createInterface(file);
let lastPkg, lastVer, lastLine, currPkg, currVer, currLine;
const re = /^"?(@?[^@]+)/;
rl.on('line', (line) => {
@abhiaiyer91
abhiaiyer91 / reduxSelectorPattern.md
Last active April 29, 2022 06:00
Redux Selector Pattern

Redux Selector Pattern

Imagine we have a reducer to control a list of items:

function listOfItems(state: Array<Object> = [], action: Object = {}): Array<Object> {
  switch(action.type) {
    case 'SHOW_ALL_ITEMS':
      return action.data.items
    default:
@gregrickaby
gregrickaby / html5-schema.org-markup.html
Last active August 2, 2022 00:05
Proper SCHEMA.ORG markup
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noodp, noydir" />
<link rel="dns-prefetch" href="//cdnjs.cloudflare.com">
<link rel="canonical" href="http://mysite.com/" />
<link rel="stylesheet" href="http://mysite.com/style.css" type="text/css" />
@mircohacker
mircohacker / release.yaml
Created April 30, 2020 08:13
Push to Github Pages with Github Actions
name: Build and Deploy
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
@yowainwright
yowainwright / $README.md
Last active December 21, 2022 19:27
Run Intel Mac Terminal Commands On Your M1 Mac Like A Boss In 5 Minutes Or Less

Run Intel Mac Terminal Commands On Your M1 Mac Like A Boss In 5 Minutes Or Less

After using terminals (iTerm, Terminal, Kitty) with an M1 Mac without issue for over a year, I finally came upon an issue that I couldn’t solve without using Rosetta. Rosetta is Mac software to run Intel Mac terminal commands on an M1 Mac. My issue initially came from trying to use Pyenv to install and use different versions of Python across multiple projects. After installing Rosetta, I initially used it by adding a custom flag to commands like this arch -x86_64 . This worked for me but was really error prone, “Did I forget the flag? Did I add the flag in the correct place?”.


This document describes solving M1 Mac vs Intel Mac terminal command discrepancies by creating a copy of your terminal and setting it up to run Intel Mac terminal commands using Rosetta. Although the process of making a Rosetta termi

@Bergvca
Bergvca / unnittestexample.py
Last active December 22, 2022 20:54
Some unnittest + Mock examples in Python. Includes examples on how to mock a entire class (ZipFile), mock an Iterator object and how to use side_effect properly
import unittest
import os
from zipfile import ZipFile
from mock import MagicMock, patch, Mock, mock_open
# The functions that are tested:
def function_to_test_zipfile(example_arg):
with ZipFile(example_arg, 'r') as zip_in:
for input_file in zip_in.infolist():
@getify
getify / 1.md
Last active March 2, 2023 21:24
In defense of using blocks to create localized scope for variables... (part 1 of 2)