Skip to content

Instantly share code, notes, and snippets.

View haliphax's full-sized avatar
💭
git clone self

haliphax

💭
git clone self
View GitHub Profile
@haliphax
haliphax / tvguide-tidy.user.js
Created August 28, 2014 20:05
TV Guide Tidy (userscript)
// ==UserScript==
// @match http://www.tvguide.com/listings/
// @name TV Guide Tidy
// @description Cleans up the TV Guide listings page
// @version 1.0
// ==/UserScript==
window.onload = function(){
var l = document.querySelector(".listings-w");
@haliphax
haliphax / gmcc.user.js
Last active August 29, 2015 14:05
Give Me Coins Condensed (userscript)
// ==UserScript==
// @name Give Me Coins Condensed
// @namespace http://roadha.us
// @version 1.0
// @description Condenses the layout of the give-me-coins.com dashboard
// @include https://give-me-coins.com/pool/dashboard
// @match https://give-me-coins.com/pool/dashboard
// @run-at document-end
// ==/UserScript==
@haliphax
haliphax / ko.extenders.scrollFollow.js
Created April 13, 2013 18:15
Auto-scrolling extender for knockout.js observableArray objects
ko.extenders.scrollFollow = function (target, selector) {
target.subscribe(function (newval) {
var el = document.querySelector(selector);
// the scroll bar is all the way down, so we know they want to follow the text
if (el.scrollTop == el.scrollHeight - el.clientHeight) {
// have to push our code outside of this thread since the text hasn't updated yet
setTimeout(function () { el.scrollTop = el.scrollHeight - el.clientHeight; }, 0);
}
});
@haliphax
haliphax / jquery.inview.js
Created April 20, 2016 17:11
jQuery :inview and :reached psuedo-selectors
// jQuery pseudo-selectors to figure out if an element is on-screen
$.extend($.expr[':'], {
// determines if the element is within the viewport
'inviewport': function (el) {
var $el = $(el)
, h = $el.outerHeight()
, t = $el.offset().top
, b = t + h
, s = $(document).scrollTop()
, w = $(window).height()
@haliphax
haliphax / wpx
Last active April 26, 2017 04:19
automagic WINEPREFIX script
#!/usr/bin/env bash
# Copyright (c) 2016 haliphax
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
<?php
/***
* Pull HTML source for given URL and format for output
* 2011 haliphax https://github.com/haliphax
**/
?>
<!DOCTYPE html>
<html>
<head>
<title>Format page as plain text</title>
@haliphax
haliphax / vtecho.py
Created February 25, 2016 21:35
Player script for textfiles.com VT100 animations
#!/usr/bin/env python2.7
"""
This script will echo each line in either stdin or a given file,
with a 1/50th of a second delay between each. This makes it
suitable for "playing" the animations found on textfiles.com:
http://artscene.textfiles.com/vt100/
Just use it like this:
@haliphax
haliphax / Browsercache.php
Created May 9, 2013 04:08
Browsercache.php - A simple browser-cache-handling library for CodeIgniter
<?php if(! defined('BASEPATH')) exit();
class Browsercache
{
private $ci;
function __construct()
{
$this->ci =& get_instance();
}
@haliphax
haliphax / nodechat.py
Created May 25, 2018 03:50
nodechat.py band-aid version cannibalized from ircchat.py
""" Node chat script for x/84. Bastardized from ircchat.py. """
# stdlib
from collections import deque
import datetime
import re
import warnings
# 3rd party
from x84.bbs import (ScrollingEditor, getsession, echo, getterminal,
get_ini, syncterm_setfont, LineEditor)
@haliphax
haliphax / README.md
Last active August 28, 2018 17:47
Roll20 NPC spell slots bookmarklet

Roll20 NPC spell slots bookmarklet

This bookmarklet can be used to produce a clickable list of spells for an NPC chat macro. You input the spell level (0 for cantrips), the number of slots available for that level, and it will produce the markup to put into a chat macro.

As far as building the shell for the spellbook is concerned, this should get you started:

/w GM &{template:default}{{name=@{selected|character_name} Spellcasting
}}{{ DC @{selected|spell_save_dc} = +@{selected|spell_attack_bonus} to hit
}}{{ Cantrips = [@{selected|repeating_spell-cantrip_$0_spellname}](~selected|repeating_spell-cantrip_$0_spell)