Skip to content

Instantly share code, notes, and snippets.

<template>
<div class="notifications" :style="notificationStyle">
<div class="notifications__top">
<TransitionGroup name="notificationViewFade">
<LoadSavedPlanNotification
v-if="notificationState[NOTIFICATION_TYPES.LOAD_IDB_CONFIG]?.open"
:payload="
notificationState[NOTIFICATION_TYPES.LOAD_IDB_CONFIG].payload!
"
:close="() => close(NOTIFICATION_TYPES.LOAD_IDB_CONFIG)"
@x8BitRain
x8BitRain / RTCService.ts
Last active March 17, 2024 12:02
Simple WebRTC chat class
const rtcConfig = { iceServers: [{ urls: 'stun:stun.l.google.com:19302' }] }
const createOfferFromSdp = (sdp: string): RTCSessionDescriptionInit => {
return {
type: 'offer',
sdp,
}
}
const createAnswerFromSdp = (sdp: string): RTCSessionDescriptionInit => {
describe('Test helpcenter visibility based on initData on mobile', () => {
const { configurator, roomdesigner, disable } =
FALLBACK_INIT_DATA.featureFlags.helpcenter;
it.each`
configurator | roomdesigner | disable | isPlanner | expected | reason
${configurator} | ${roomdesigner} | ${disable} | ${true} | ${true} | ${'default behavior for planner should be visible'}
${configurator} | ${roomdesigner} | ${disable} | ${false} | ${false} | ${'default behavior for configurator should not be visible'}
${true} | ${true} | ${false} | ${false} | ${true} | ${'should show in configurator if explicitly enabled'}
${true} | ${false} | ${false} | ${true} | ${false} | ${'should not show in planner if explicitly disabled'}
${true} | ${true} | ${true} | ${true} | ${false} | ${'disable: true should never show helpcenter'}
@x8BitRain
x8BitRain / keyword-page.hbs
Created September 6, 2023 09:50
ember table example
<NwKeywordTable::Provider
@scope={{@scope}}
@url={{@url}}
@dynamicView={{@dynamicView}}
@sort={{@sort}}
@direction={{@direction}}
@onSort={{this.sortKeywords}}
@keywords={{this.keywords.data}}
@fetchKeywordStats={{this.fetchKeywordStats}}
@filterChange={{this.filterChange}}
import { acceptHMRUpdate, defineStore } from 'pinia'
import { computed, ref } from 'vue'
import type { Room } from '/@/interfaces'
import { hideFaviconNotification } from '/@/utils/toggleFaviconNotification'
interface Rooms {
[key: string]: Room
}
export const useRoomsStore = defineStore('rooms', () => {
@x8BitRain
x8BitRain / ISB.cs
Created July 6, 2023 23:21
GTA SA Instant Speed Boost CLEO script
{$CLEO .cs}
script_name 'SN'
:SN_11
wait 0
1@ = Actor.CurrentCar($PLAYER_ACTOR)
if and
0449: actor $PLAYER_ACTOR in_a_car
00E1: player 0 pressed_key 17
@x8BitRain
x8BitRain / ChartJSDataStream.vue
Created January 26, 2023 08:08
ChartJS Data Streaming in Vue 3
<template>
<canvas ref="chartRef" class="main-canvas"></canvas>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import {transparentize, rand, CHART_COLORS} from './utils/utils.js'
import ChartStreaming from 'chartjs-plugin-streaming';
import {
@x8BitRain
x8BitRain / generateManifest.js
Last active October 15, 2022 17:14
PWA Share Target API accept any file type
// using 'application/*' doesn't do the trick but adding as many mimetypes and filetypes as you can seems to get the serviceworker to accept them if they are listed explicitly.
import mimeDb from 'mime-db'
import fileTypes from './src/utils/fileTypes' // from https://github.com/dyne/file-extension-list/blob/master/pub/extensions.json
const allFileTypesAndMimes = () => {
return process.env.NODE_ENV === 'production'
? [...Object.keys(mimeDb), ...fileTypes]
: []
}
@x8BitRain
x8BitRain / DragDropOverlay.vue
Last active October 15, 2022 17:14
Vue 3 Drag & Drop Overlay
<template>
<div
class="file-drop overlay"
@dragover="handleDrag"
@dragleave="toggleFileDrop"
@drop="handleDrop"
></div>
<div class="file-drop-text">
<h1>Upload File</h1>
<i-feather-upload />
@x8BitRain
x8BitRain / simulate_mouseover.js
Last active April 27, 2021 12:23
Simulate a Mouseover Event in JS
document.querySelector('#element').dispatchEvent(new MouseEvent('mouseover', {bubbles: true}))