This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name d20pfsrd Statblockerer | |
// @match *://www.d20pfsrd.com/* | |
// @description adds buttons open a statblock from d20pfsrd.com in a new window to print or save | |
// @author schuyberg | |
// @grant none | |
// @version 0.1 | |
// @updateURL https://gist.github.com/schuyberg/794d78bd34a0661cb72d5833a2a83934/raw/statblockerer.user.js | |
// @downloadURL https://gist.github.com/schuyberg/794d78bd34a0661cb72d5833a2a83934/raw/statblockerer.user.js | |
// @run-at document-end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name d20pfsrd Print Card 2 | |
// @match www.d20pfsrd.com/* | |
// @description print a statblock from d20pfsrd.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const right_sidebar = document.querySelector(".right-sidebar"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Spotify: Linked Labels | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description make Label Copyrights into hyperlinks in Spotify: Browse Music by Label! | |
// @author schuyberg | |
// @match https://open.spotify.com/* | |
// @grant none | |
// @require http://code.jquery.com/jquery-3.2.1.min.js | |
// ==/UserScript== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts an RGB color value to HSL. Conversion formula | |
* adapted from http://en.wikipedia.org/wiki/HSL_color_space. | |
* Assumes r, g, and b are contained in the set [0, 255] and | |
* returns h, s, and l in the set [0, 1]. | |
* | |
* @param Number r The red color value | |
* @param Number g The green color value | |
* @param Number b The blue color value | |
* @return Array The HSL representation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chmod 700 $HOME/.ssh | |
chmod go-w $HOME $HOME/.ssh | |
chmod 600 $HOME/.ssh/authorized_keys | |
chown `whoami` $HOME/.ssh/authorized_keys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use this anywhere in your php app | |
function console_log() { | |
$messages = func_get_args(); | |
if(!$GLOBALS['cLogs']){ | |
$GLOBALS['cLogs'] = array(); | |
} | |
$GLOBALS['cLogs'] = array_merge($GLOBALS['cLogs'], $messages); | |
} | |
// use this at the bottom of the global template (or wherever you can insert some js) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$provinces = array(0 => 'Alberta', | |
1 => 'British Columbia', | |
2 => 'Manitoba', | |
3 => 'New Brunswick', | |
4 => 'Newfoundland and Labrador', | |
5 => 'Northwest Territories', | |
6 => 'Nova Scotia', | |
7 => 'Nunavut', | |
8 => 'Ontario', | |
9 => 'Prince Edward Island', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// generates a table of contents | |
// blame @schuyberg 2016 | |
// | |
// | |
// use on jquery object you want it appended before (usually first header) | |
// hStart = number: html heading level to start on (ie. 2 would be h2) | |
// depth = number: depth to traverse heading heirarchy (h2 + 1 = h2, h3) | |
// example: jQuery('h2').first().toc(2,1); --> adds contents before first h2 tag, includes h2, h3 tags. | |
$.fn.toc = function(hStart, depth){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* AngularJS Print Service | |
thanks to Bahmni for the original code at https://github.com/Bhamni/openmrs-module-bahmniapps/blob/master/ui/app/common/ui-helper/printer.js | |
** modified here to work with ie10/11 */ | |
services.factory('printer', [ '$rootScope', '$compile', '$http', '$timeout', 'utility', function ($rootScope, $compile, $http, $timeout, utility) { | |
var printHtml = function (html) { | |
var hiddenFrame = $('<iframe name="printframe" style="position: absolute; left: -9999px;"></iframe>').appendTo('body')[ 0 ]; | |
var htmlContent = "<!doctype html>" + | |
'<head><meta http-equiv="X-UA-Compatible" content="IE=edge"></head>' + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pattern for creating servicesto communicate efficiently between angular components | |
services.factory('changeService', ['$rootScope', | |
function ($rootScope) { | |
var changeService = {}; | |
// use changeService.changed(action) in controller to act on changes | |
changeService.changed = function(callback){ | |
$rootScope.$on('change', callback); |
NewerOlder