Skip to content

Instantly share code, notes, and snippets.

View jtomaszewski's full-sized avatar

Jack Tomaszewski jtomaszewski

View GitHub Profile
wpiekutowski / some_subscription_test.exs
Created August 7, 2020 13:34
Testing subscriptions: Elixir + Absinthe + Phoenix WebSocket
View some_subscription_test.exs
defmodule App.Schema.SomeSubscriptionTest do
use App.SubscriptionCase
test "subscription: someSubscription" do
subscription_query = """
subscription {
someSubscription {
royshouvik / console.ts
Last active October 4, 2022 00:12
Nestjs REPL
View console.ts
import 'dotenv/config';
import { NestFactory } from '@nestjs/core';
import * as repl from 'repl';
import * as Logger from 'purdy';
indent: 2,
depth: 1,
jack-sf / KeyboardFocusHandler.tsx
Created July 8, 2019 08:42
Add `.has-keyboard-focus` class to your `<body>` element whenever keyboard focus is active - as an easy solution to add focus outline to all keyboard-focused elements (until `:focus-visible` is supported in all the major browsers)
View KeyboardFocusHandler.tsx
import * as React from 'react';
import { document, window } from '../../../utils/browser';
export class KeyboardFocusHandler extends React.PureComponent {
componentDidMount(): void {
window!.addEventListener('keydown', this.handleFirstTab);
componentWillUnmount(): void {
tbutts /
Last active July 14, 2023 02:52
For tmux configs: Merge deprecated/removed -fg, -bg, and -attr options into the -style option
#!/usr/bin/env python
# vim: set fileencoding=utf-8
# Back up your tmux old config, run the script and redirect stdout to your conf
# file. Example:
# $ cp ~/.tmux.conf ~/.tmux.conf.orig
# $ python ./ ~/.tmux.conf.orig > ~/.tmux.conf
karthik101 / Readonly user for Kubernetes
Last active June 12, 2023 16:32
Read only user for Kubernetes Dashboard
View Readonly user for Kubernetes

The view ClusterRole doesn’t actually have permissions for the Cluster level objects like Nodes and Persistent Volume Claims. So we’ll have to create a new RBAC config.

First, we’ll create a new dashboard-viewonly ClusterRole:

kind: ClusterRole
  name: dashboard-viewonly
donaldpipowitch / axe.js
Created November 26, 2018 11:44
aXe based a11y checks in your CI for Storybook
View axe.js
const puppeteer = require('puppeteer');
const chalk = require('chalk');
const { green, red, cyan, grey, bold } = chalk;
// we assume storybook can visited at http://localhost:9001
const url = 'http://localhost:9001/iframe.html';
const runAxe = () =>
new Promise((resolve, reject) =>
vasilii-b / magento2-layout-empty-container.xml
Last active January 14, 2021 23:58
Adding an empty container in Magento 2 layout file
View magento2-layout-empty-container.xml
<container name="some.container" htmlTag="div" htmlClass="container">
<!-- Force container to render -->
<block class="Magento\Framework\View\Element\Text">
<argument name="text" xsi:type="string"><![CDATA[&nbsp;]]></argument>
mardr / mbank_unlifting.user.js
Last active April 15, 2019 18:25
Przywraca wygląd strony transakcyjnej mbanku z przed liftingu. Do działania wymaga jednego z rozszerzeń do przeglądarki: np. Greasemonkey lub Tampermonkey.
View mbank_unlifting.user.js
// ==UserScript==
// @name mbank unlifting
// @description Przywraca wygląd strony transakcyjnej mbanku z przed liftingu
// @version 0.1
// @grant none
// @author mardr
// @include*
// ==/UserScript==
wojteklu /
Last active December 1, 2023 10:25
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.

General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

baumandm /
Last active November 3, 2023 07:18 — forked from dergachev/
OS X Screencast to Animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime and ffmpeg.

Forked from Updated to use a palette to improve quality and skip gifsicle.


To capture the video (filesize: 19MB), using the free "QuickTime Player" application: