Skip to content

Instantly share code, notes, and snippets.

@Xanir
Xanir / EventManager.js
Last active February 7, 2017 21:35
EventManager
var EventManager = function() {
var emitter = this;
// Map of even names to list of event callbacks
emitter.events = {};
};
/*
Registerer a callback function for a specific event
*/
.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 */
@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 -
@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
.label-value-group {
display: table;
margin: 0 2rem;
border-collapse: separate;
border-spacing: 0 1em;
}
.label-value-pair {
display: table-row;
@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);
.lift-card {
background-color: peach;
}
.liftable {
padding: 0;
transition: padding 0.1s ease-in-out;
.lift-card {
margin-top: 0px;
@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);
}
};
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]);
<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;