Skip to content

Instantly share code, notes, and snippets.

View knownasilya's full-sized avatar
🦾
Working on Archegos

Ilya Radchenko knownasilya

🦾
Working on Archegos
View GitHub Profile
  const [size, toolbarRef] = useElementInlineResized<'small' | 'medium' | 'full', HTMLDivElement>({
    match: {
      small: 250,
      medium: 544,
      full: Infinity,
    },
  });
import {RefObject, useEffect, useRef} from 'react';
export default function useElementResized<T extends HTMLElement>(
check: (entry: ResizeObserverEntry, element: T) => boolean,
callback: (element: T) => void,
ref?: RefObject<T>
) {
const backupRef = useRef<T>(null);
const actualRef = ref ?? backupRef;
name: Integration Tests
on:
pull_request:
types: [synchronize, ready_for_review, labeled]
jobs:
integration_tests_on_code_review:
name: Integration Tests on Code Review
runs-on: ubuntu-latest
@knownasilya
knownasilya / machine.js
Last active June 30, 2021 15:53
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
import Controller from '@ember/controller';
const namedValues = (event) => {
const fields = Object.keys(event.target.elements).filter(key => Number.isNaN(parseInt(key, 10)))
const values = Object.fromEntries(fields.map(key => {
let element = event.target.elements[key];
let value = element.type === 'checkbox' ? element.checked : element.value
return [key, value];
}));
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
let index = 0;
export default class extends Component {
@tracked obj = {
index: 0
};
@knownasilya
knownasilya / machine.js
Last active September 29, 2020 13:45
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@knownasilya
knownasilya / controllers.application\.js
Created September 25, 2020 15:24
special char hash
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
@knownasilya
knownasilya / machine.js
Last active June 20, 2020 14:37
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@knownasilya
knownasilya / machine.js
Last active August 22, 2020 03:14
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions