Skip to content

Instantly share code, notes, and snippets.

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 February 12, 2023 18:14
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 29, 2022 07:42
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');
@baumandm
baumandm / GIF-Screencast-OSX.md
Last active November 10, 2022 18:48 — 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:

@NickClark
NickClark / thoughts.markdown
Last active September 27, 2021 22:33
Elm vs TypeScript Thoughts
View thoughts.markdown

Elm and TypeScript

  • Elm Task - An Elm specific implementation of Observables (more limited?)
  • TS and Elm - Once it compiles it usually runs (Provided you're following the warnings provided in either the compiler output (better) or editor (best) )
  • Editor and tooling support?
  • TS and Elm - Typed Langs
  • Most suitable for complete apps, not just a JS compiler
  • Enforces Reactive programming - Angular 2 (Observables) provides the same thing, just not forced.
  • Know TS, know JS. Able to contribute back to the community easier.
  • Object assignment kinda weird: { point | x = 42 } Reason? (overall weird sytnax)