Skip to content

Instantly share code, notes, and snippets.

View badvision's full-sized avatar

Brendan Robert badvision

View GitHub Profile
@badvision
badvision / kaboom.a
Created July 15, 2015 07:20
Apple II: Kaboom animation
*= $300;
!cpu 65c02;
;Kaboom: Simple Lo-res color cycle just for fun
php
pha
phx
phy
@badvision
badvision / reloadOnLayerSwitch.js
Last active May 17, 2021 14:09
AEM 6.x: Reload the page when the user switches layers
// This must be in a client library with the category cq.authoring.editor.hook
/* global Granite, jQuery, document */
(function ($, channel) {
'use strict';
$(function () {
var loadedTime = new Date();
channel.on('cq-layer-activated', function (event) {
if (event.prevLayer && event.layer !== event.prevLayer) {
var eventTime = new Date();
if (event.prevLayer !== 'Annotate' && event.layer !== 'Annotate' && (eventTime - loadedTime) > 1500) {
@badvision
badvision / previewOrAnnotateOnly.js
Last active August 29, 2015 14:24
AEM 6.1: Require a user to be in a specific group in order to edit content. Other users will only see preview and annotate layers
// This must be in a client library with the category cq.authoring.editor.hook
/* global Granite, CQ, window */
(function($, author, user, http) {
'use strict';
var UUID = 'UUID',
MEMBERS = 'EDITOR_MEMBERS',
EDITOR_GROUP = '/home/groups/express/express-content-editors',
PREVIEW = 'Preview',
ANNOTATE = 'Annotate',
hideEditLayer = function() {