Skip to content

Instantly share code, notes, and snippets.

@x8BitRain
x8BitRain / CustomLineChart.js
Last active October 15, 2022 17:16
ChartJS 3 Line Chart with vertical line on hover
import { LineController } from 'chart.js';
class CustomLineChart extends LineController {
draw() {
super.draw();
if (this.chart.tooltip._active && this.chart.tooltip._active.length) {
let activePoint = this.chart.tooltip._active[0],
ctx = this.chart.ctx,
x = activePoint.element.x,
<template>
<details :style="unknownCountry ? 'pointer-events: none;' : null">
<summary @click="getShippingData(country[1])" >
<img :src="getFlag(country)" alt="">
<h3>{{ country[0] }}</h3>
</summary>
<div class="listContainer">
<img v-if="!shippingData" src="../assets/img/loader.svg" />
<div v-if="shippingData" class="list">
<h2><u>{{ country[0] }}</u></h2>
def clock(time)
time = time.split(':')
hour = time.first.to_i
minute = time.last.to_i
angle = ((minute * 6) - (hour * 30))
if angle < 0
angle = angle.abs + minute * 0.5
//paste into your browser dev console and mouse over your contribution graph.
document.querySelectorAll("rect.day").forEach(c => c.addEventListener('mouseover', function (e) {e.target.style.fill = '#196127'}));
@x8BitRain
x8BitRain / corruptSVG.jsx
Last active November 4, 2019 17:23
Neat piece of React code that manipulates/corrupts SVGs
// This is a react component that's a part of an SVG corrupting web app I made:
// https://x8bitrain.github.io/svg-emoji-corrupt/
// While code is long the main function that does the actual manipulation is just a
// for loop that changes integer values when it matches a certain regex.
import React, { Component } from 'react';
import UIkit from 'uikit';
let svgDataLock = 0; // This stops svgOG from being updated the first execution.
let svgOG = []; // This is used to store a clone of the original values the
@x8BitRain
x8BitRain / Random Meta Theme Value
Created October 9, 2019 17:23
Random Meta Theme Value
//Generate Random Color
function getRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
@x8BitRain
x8BitRain / Dell XPS 13 Xorg touchpad settings
Last active May 14, 2019 11:26
File as /etc/X11/xorg.conf.d/30-touchpad.conf
Section "InputClass"
Identifier "libinput"
Driver "libinput"
MatchDevicePath "/dev/input/event*"
MatchIsTouchpad "true"
Option "Tapping" "True"
Option "TappingDragLock" "False"
Option "PalmDetection" "True"
Option "ButtonMapping" "1 2 3"