Skip to content

Instantly share code, notes, and snippets.

View jtomaszewski's full-sized avatar

Jack Tomaszewski jtomaszewski

View GitHub Profile
@wpiekutowski
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 {
someData
}
}
@royshouvik
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';
const LOGGER_OPTIONS = {
indent: 2,
depth: 1,
};
@jack-sf
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';
// https://hackernoon.com/removing-that-ugly-focus-ring-and-keeping-it-too-6c8727fefcd2
export class KeyboardFocusHandler extends React.PureComponent {
componentDidMount(): void {
window!.addEventListener('keydown', this.handleFirstTab);
}
componentWillUnmount(): void {
@tbutts
tbutts / tmux-migrate-options.py
Last active July 14, 2023 02:52
For tmux configs: Merge deprecated/removed -fg, -bg, and -attr options into the -style option
View tmux-migrate-options.py
#!/usr/bin/env python
# vim: set fileencoding=utf-8
#
# USAGE:
# 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-migrate-options.py ~/.tmux.conf.orig > ~/.tmux.conf
#
@karthik101
karthik101 / Readonly user for Kubernetes Dashboard.md
Last active June 12, 2023 16:32
Read only user for Kubernetes Dashboard
View Readonly user for Kubernetes Dashboard.md

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:

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: dashboard-viewonly
@donaldpipowitch
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
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">
<arguments>
<argument name="text" xsi:type="string"><![CDATA[&nbsp;]]></argument>
</arguments>
</block>
</container>
@mardr
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 https://online.mbank.pl/*
// ==/UserScript==
document.documentElement.classList.remove('lifting');
@wojteklu
wojteklu / clean_code.md
Last active December 1, 2023 10:25
Summary of 'Clean code' by Robert C. Martin
View clean_code.md

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
baumandm / GIF-Screencast-OSX.md
Last active November 3, 2023 07:18 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to Animated GIF
View GIF-Screencast-OSX.md

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 https://gist.github.com/dergachev/4627207. Updated to use a palette to improve quality and skip gifsicle.

Instructions

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