Skip to content

Instantly share code, notes, and snippets.

@botimer
botimer / checkpoint.md
Created February 19, 2018 23:44
Some Checkpoint scribbles

Resource and Zone inheritance (containers and cascading permissions)

What makes these problems challenging is that there are multiple reasonable approaches to the issues. Here are options, none better than the other, for dealing with inheriting permissions from a more 'powerful' resource/zone.

For Resources:

  1. Write it into the policy 1a. Check a property of the parent resource
@botimer
botimer / index-fonts.js
Created February 5, 2014 17:02
Index and count all font variations on an HTML page
function indexFonts() {
var fonts = {};
var props = ['font-family', 'font-size', 'font-weight', 'font-style'];
var nodes = document.body.getElementsByTagName('*');
var L = nodes.length;
for (var i = 0; i < L; i++) {
var node = nodes[i];
if (node.style) {
var style = node.style;
var cs = getComputedStyle(node, '');
@botimer
botimer / gist:3067054
Created July 7, 2012 16:18
Check working copy SVN diff
" Open a new scratch buffer with the SVN diff of the current
" working directory (pwd). Set up mappings for \sd (with the
" default backslash leader) and F7 for convenience.
function! SvnDiff()
wincmd n
set buftype=nofile
exec "%!svn diff"
set ft=diff
endfunction
@botimer
botimer / yesno.rb
Created June 7, 2012 19:56
Handy yes/no prompt for little ruby scripts
# This is a reasonably well-behaved helper for command-line scripts needing to ask a simple yes/no question.
# It optionally accepts a prompt and a default answer that will be returned on enter keypress.
# It keeps asking and echoes the answer on the same line until it gets y/n/Y/N or enter.
# I tried to get Highline to behave like this directly, but even though it's sophisticated, I didn't like the result.
# This isn't especially elegant, but it is straightforward and gets the job done.
require 'highline/import'
def yesno(prompt = 'Continue?', default = true)
a = ''
s = default ? '[Y/n]' : '[y/N]'