Skip to content

Instantly share code, notes, and snippets.

View jmacqueen's full-sized avatar

Jonathan MacQueen jmacqueen

  • Bitsight
  • United States
View GitHub Profile
@jmacqueen
jmacqueen / alacritty.toml
Created November 4, 2024 21:03
My Alacritty conf
[window]
opacity = 1
decorations = "None"
option_as_alt = "OnlyLeft"
[font]
size = 16.0
normal = { family = "BerkeleyMono Nerd Font", style = "Regular" }
bold = { family = "BerkeleyMono Nerd Font", style = "Bold" }
italic = { family = "BerkeleyMono Nerd Font", style = "Italic" }
@jmacqueen
jmacqueen / tmux.conf
Last active November 4, 2024 20:47
My tmux.conf
set -g mouse on
set -g history-limit 1000000 # increase history size (from 2,000)
set -g set-clipboard on # use system clipboard
set -g status-position top # macOS / darwin style
# Set true color
set-option -sa terminal-overrides ",xterm*:Tc"
# set vi mode
set-window-option -g mode-keys vi
# Set prefix
export const command = `/usr/local/bin/docker ps --format '{{.Names}}\t{{.Ports}}'`
export const refreshFrequency = 5000 // ms
export const render = ({ output }) => {
if (!output) return <h3>Docker daemon not responding</h3>
const lines = output.split("\n")
function tableRow(line) {
const splitLine = line.split(/\t/)
@jmacqueen
jmacqueen / captions.vtt
Created November 19, 2019 13:11
Sample VTT file
WEBVTT
1
00:00:00.000 --> 00:00:00.500
2
00:00:00.500 --> 00:00:02.170
<v Neil deGrasse Tyson>Then I would like to introduce
the two persons who will
@jmacqueen
jmacqueen / queryObj.js
Created February 20, 2019 13:21
Object from the browser query
query = window.location.search
.replace('?','')
.split('&')
.reduce((obj, item) => {
const pair = item.split('=')
obj[pair[0]] = pair[1]
return obj
}, {})
@jmacqueen
jmacqueen / mockSlowAsyncService.js
Created February 14, 2019 20:05
During the mocking phase, I like to see loading states, too!
mockData = [1,2,3]
const getSlowThing = async () => {
await new Promise(resolve => setTimeout(resolve, 3000))
return Promise.resolve(mockData)
}
@jmacqueen
jmacqueen / AppWithContext.js
Created January 15, 2019 15:54 — forked from dndhm/AppWithContext.js
React Context.Consumer mocking
import React, { Component } from 'react';
import FruitContext from './FruitContext';
import FruityComponent from './FruityComponent';
export class App extends Component {
state = {
fruit: 'apple',
}
@jmacqueen
jmacqueen / React Task.md
Last active July 21, 2021 11:56
React Exercise

The Task

Implement a React component that will receive an array of options:

  [
    { label: 'Label 1', value: 1 },
    { label: 'Label 2', value: 2 },
    { label: 'Label 3', value: 3 },
    { label: 'Label 4', value: 4 }
 ]
@jmacqueen
jmacqueen / CSS Task.md
Last active July 27, 2021 16:07
CSS Exercise

The Task

Given the HTML markup:

<button class="checkout-btn">
  checkout
</button>

Without changing the HTML, make the button look reasonably similar to the screenshot below. It doesn't have to have pixel-perfect measurements. Feel free to use Google. Try not to spend more than an hour on it. The colors used are: lightsteelblue, steelblue, white and darkslategray and the font is whatever sans-serif floats your boat.

@jmacqueen
jmacqueen / something.test.js
Created September 27, 2017 11:38
How to mock components from ui-lib
jest.mock('@echo360/ui-lib', () => {
const module = jest.genMockFromModule('@echo360/ui-lib')
module.Button = 'Button'
module.SelectSingle = 'SelectSingle'
module.TextInput = 'TextInput'
return module
})