Skip to content

Instantly share code, notes, and snippets.

View lloydjatkinson's full-sized avatar
🌧️
Chilling

Lloyd Atkinson lloydjatkinson

🌧️
Chilling
View GitHub Profile
Render Error Invariant Violation: Objects are not valid as a React child (found: object with keys {en-GB}). If you meant to render a collection of children, use an array instead.
in span
in button
in div
in div
in section
in div
in Unknown (created by TabContent)
in TabContent (created by StoreComponent)
in div (created by StoreComponent)
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'plugin:vue/strongly-recommended',
'plugin:vue/recommended',
'plugin:vue/essential',
'@vue/airbnb',
@lloydjatkinson
lloydjatkinson / 42.js
Created July 16, 2019 13:46
42: The answer to life, the universe, and everything
// See if you can figure it out.
+(!+[]+!![]+!![]+!![]+[]+(!+[]+!![]+[]));
// 42
export const filterCollection = <TOriginal>(originalCollection: TOriginal[], search: (item: TOriginal) => boolean) => {
const result = originalCollection.filter(search);
return {
anyMatches: result.length > 0,
originalCollection,
filteredCollection: result
};
};
import { filterCollection } from './filter-collection';
@lloydjatkinson
lloydjatkinson / trim-text.js
Last active December 5, 2022 19:26
Trim text and prefix ellipses when the text length is greater than the maximum
const trimText = (input = '', maximumLength = 80) => {
const exceedsMaximum = input.length >= maximumLength;
return {
exceedsMaximum,
text: exceedsMaximum ? `${ input.substr(0, input.lastIndexOf(' ', maximumLength)) }...` : input,
}
};
export default trimText;
import axios from 'axios';
const rocketEndpoint = 'https://api.spacexdata.com/v3/rockets';
const upcomingLaunchesEndpoint = 'https://api.spacexdata.com/v3/launches/upcoming';
const getRockets = async () => {
try {
return {
success: true,
data: (await axios.get(rocketEndpoint)).data
computed: {
hasScrolledNearEnd () {
return !inRange(this.scrollView.endIndex, this.notifications.length - 5);
},
},
watch: {
hasScrolledNearEnd (nearEnd, previousValue) {
if (nearEnd && !previousValue) {
this.updateNotifications();
}
@lloydjatkinson
lloydjatkinson / list.txt
Created October 27, 2020 20:45
Discord Bad Users List
this list will contain discord users that are to be preemptively banned due to their toxicity
@lloydjatkinson
lloydjatkinson / Example.md
Created January 22, 2021 14:15
Vue Dialog/Modal/Toast component with v-model binding for closing and opening

Dialog.vue:

<template>
    <div>
        <button @click="close">Close</button>
        <slot />
    </div>
https://bolinwoodturners.co.uk/
https://www.one2onecaraudio.co.uk/
http://walkingforpaws.co.uk/
https://www.barracudascuba.co.uk/
http://www.nottsgates.com/
https://www.mpm-ltd.co.uk/
https://www.nottinghamshirehealthcare.nhs.uk/
https://www.elmbanknursinghome.co.uk/
https://www.woodthorpegarage.co.uk/
http://st-james-nottingham.org.uk/