Useful labeling system used in all my repositories.
- Visit the labels page https://github.com/{user}/{repo}/labels
- Click on "New Label"
- Open the Developer Console
- Paste this snippet and hit enter
const labels = [
{| <script> | |
| import Refresher from './refresher.svelte'; | |
| const onRefresh = async () => { | |
| await new Promise(res => setTimeout(res, 2000)); | |
| } | |
| </script> | |
| <Refresher {onRefresh}> | |
| <div id="app">This is my cool Svelte app! (switch to mobile emulator)</div> |
Useful labeling system used in all my repositories.
const labels = [
{const labels = [];
const list = [].slice.call(document.querySelectorAll(".js-label-link"));
list.forEach((element) => {
labels.push({| /** | |
| * Finds the greatest common divisor (GCD) by determining the highest | |
| * number that evenly divides both numbers | |
| * @param {Number} width Width of the object | |
| * @param {Number} height Height of the object | |
| * @return {Number} GCD number | |
| */ | |
| const gcd = (width, height) => height === 0 ? width : gcd(height, width % height); | |
| /** |
JS:
const setTranslate = (x, y, element) => {
element.style.transform = `translate3d(${x}px, ${y}px, 0)`;
};
/**
* Simple Draggable Utility
* @param {String} selector CSS Selector of the container element
* @param {String} dragElement CSS Selector of the drag handler element (optional)| /** | |
| * Deep copy example: | |
| * angular.extend(true, { hello: 'world', app: { id: '1234', groups: [{ id: 1},2,3,4,5] }, ids: [1,2,3] }, { app: { name: 'bond', groups: [6, 7, {hello:'world', test: [1,2,3,4, [12,34,45]]}, 9] }, ids: [4,5,6,3] }); | |
| * => "{"hello":"world","app":{"id":"1234","groups":[{"id":1},2,3,4,5,6,7,{"hello":"world","test":[1,2,3,4,[12,34,45]]},9],"name":"bond"},"ids":[1,2,3,4,5,6,3]}" | |
| * | |
| * Deep copy and dedup arrays | |
| * angular.extend(true, true, { hello: 'world', app: { id: '1234', groups: [{ id: 1},2,3,4,5] }, ids: [1,2,3] }, { app: { name: 'bond', groups: [6, 7, {hello:'world', test: [1,2,3,4, [12,34,45]]}, 9] }, ids: [4,5,6,3] }); | |
| * => "{"hello":"world","app":{"id":"1234","groups":[{"id":1},2,3,4,5,6,7,{"hello":"world","test":[1,2,3,4,[12,34,45]]},9],"name":"bond"},"ids":[1,2,3,4,5,6]}" | |
| * | |
| * vs jQuery deep copy |