Skip to content

Instantly share code, notes, and snippets.

@Xanir
Xanir / twitch-chat-mark-as-read.js
Created October 15, 2019 03:58
Visually mark all messages previous to the clicked message as read
var CLASS_CHAT_CONTAINER = 'chat-list__list-container';
var CLASS_CHAT_MESSAGE = 'chat-line__message';
var CLASS_MESSAGE_READ = 'chat-message-marked-as-read';
var styles = document.createElement('style');
styles.innerText = `
.chat-list__list-container .chat-line__message.${CLASS_MESSAGE_READ} {
opacity: 0.5;
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.0/showdown.min.js"></script>
<script>
var converter = new showdown.Converter();
converter.setOption('tables', true);
converter.setOption('simpleLineBreaks', true);
converter.setOption('emoji', true);
window.renderMarkdown = function() {
var markdownInput = document.querySelector('#markdownInput').value;
var scriptId = 'api-base-path';
var scriptElem = document.querySelector('script#' + scriptId)
var scriptBlob = new Blob([scriptElem.innerText])
var scriptURL = URL.createObjectURL(scriptBlob)
var res = await fetch('worker.js');
var script = await res.text();
var scriptBlob = new Blob([script]);
@Xanir
Xanir / frameBuster.js
Last active January 4, 2019 04:36
Strip / Prevent IFrames
if (!window.iframeBuster) {
var append = window.document.append;
window.document.append = function(node) {
if (node instanceof HTMLIFrameElement) {
console.log('blocked addition of iframe via append')
} else {
append.apply(apply, node);
}
};
.lift-card {
background-color: peach;
}
.liftable {
padding: 0;
transition: padding 0.1s ease-in-out;
.lift-card {
margin-top: 0px;
@Xanir
Xanir / GroupedGet
Last active April 25, 2017 14:53
GroupedGet
var GroupedGet = function(getterFn, massGetterFn) {
var thisGroupService = this;
thisGroupService._items = {};
thisGroupService._pendingItems = {};
thisGroupService._singleGet = getterFn;
thisGroupService._massGet = massGetterFn;
thisGroupService.sendMassGet = thisGroupService.sendMassGet.bind(this);
.label-value-group {
display: table;
margin: 0 2rem;
border-collapse: separate;
border-spacing: 0 1em;
}
.label-value-pair {
display: table-row;
@Xanir
Xanir / Dockerfile
Created March 21, 2017 03:47
Terraria Dockerfile
FROM ubuntu:16.10
# Download and install TShock
ENV TSHOCK_VERSION=4.3.23 \
TSHOCK_FILE_POSTFIX=""
# Add mono repository
# Update and install mono and a zip utility
# fix for favorites.json error
@Xanir
Xanir / Dockerfile
Created March 18, 2017 20:26
7Days to Die Docker Image
FROM ubuntu:16.10
RUN apt-get update && \
apt-get upgrade && \
apt-get install -y curl lib32gcc1 && \
mkdir /var/steam && \
cd /var/steam && \
curl -sqL http://media.steampowered.com/installer/steamcmd_linux.tar.gz | tar zxvf -
.footnote-index {
font-size: 0.6em;
vertical-align: super
}
ol.footnote-details {
counter-reset:li; /* Initiate a counter */
margin-left:0; /* Remove the default left margin */
padding-left:0; /* Remove the default left padding */