This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import path from 'path'; | |
| import { fileURLToPath } from 'url'; | |
| import comments from '@eslint-community/eslint-plugin-eslint-comments/configs'; | |
| import { FlatCompat } from '@eslint/eslintrc'; | |
| import js from '@eslint/js'; | |
| import nextPlugin from '@next/eslint-plugin-next'; | |
| import eslintConfigPrettier from 'eslint-config-prettier'; | |
| import hooksPlugin from 'eslint-plugin-react-hooks'; | |
| import reactRecommended from 'eslint-plugin-react/configs/recommended.js'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from "react"; | |
| import { useMousePosition } from "~/hooks/useMousePosition"; | |
| /** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */ | |
| export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) { | |
| const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {}; | |
| const [mouseX, mouseY] = useMousePosition(); | |
| const positions = { x, y, h, w, mouseX, mouseY }; | |
| return ( | |
| <div |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Drupal\my_module\Plugin\Field\FieldFormatter; | |
| use Drupal\Core\Field\FieldItemListInterface; | |
| use Drupal\Core\Plugin\ContainerFactoryPluginInterface; | |
| use Drupal\responsive_image\Plugin\Field\FieldFormatter\ResponsiveImageFormatter as ResponsiveImageFormatterCore; | |
| /** | |
| * Responsive image formatter that allow to force the format. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Read the https://storybook.js.org/docs/guides/guide-react/ | |
| Configure: | |
| 1) open ./storybook/config.js | |
| 2) remove configure(require.context('../src', true, /\.stories\.js$/), module); | |
| 3) replace with the code below | |
| 4) change path prepare in to getTitle function | |
| 5) remove in story files export default.title |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const HN_URL = 'https://hackernewsapi.example.com/'; | |
| function updateUI(hnData) { | |
| // Update the DOM. | |
| } | |
| async function init() { | |
| const channel = new BroadcastChannel('hn-updates'); | |
| channel.addEventListener('message', async (event) => { | |
| if (event.data.payload.updatedUrl === HN_URL) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Invalidates the current `ServiceWorker` running on the page. | |
| * Why? Because managing a cache is damn hard; and sometimes due to race conditions | |
| * your assets might get out-of-sync. | |
| * | |
| * This mini snippet checks the version of the app against an uncached resource and | |
| * invalidates the workers if it finds a mismatch. | |
| */ | |
| if ( navigator.serviceWorker && navigator.serviceWorker.getRegistrations ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @file | |
| * Defines a dropdown widget for integer fields. | |
| */ | |
| namespace Drupal\nba_content_core\Plugin\Field\FieldWidget; | |
| use Drupal\Core\Field\FieldFilteredMarkup; | |
| use Drupal\Core\Field\FieldItemListInterface; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| This has moved: | |
| https://github.com/guardian/frontend/wiki/Browsers-on-theguardian.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
| // http://creativecommons.org/publicdomain/zero/1.0/ | |
| (function (win, doc) { | |
| 'use strict'; | |
| if (!doc.querySelectorAll || !win.addEventListener) { | |
| // doesn't cut the mustard. | |
| return; | |
| } | |
| var toggles = doc.querySelectorAll('[aria-controls]'); | |
| var togglecount = toggles.length; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta name="description" content="[resize width only]"> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
| <meta name="viewport" content="width=device-width,initial-scale=1.0"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> |
NewerOlder