Skip to content

Instantly share code, notes, and snippets.

View sijpkes's full-sized avatar
🦜
Support ACF

Paul Sijpkes sijpkes

🦜
Support ACF
  • University of Newcastle
  • Newcastle, NSW, Australia
View GitHub Profile
var findParentWithClass = function(node, _class) {
var parent = node.parentNode;
if(parent.className.indexOf(_class) !== -1) {
return parent;
}
return pfapp.findParentWithClass(parent, _class);
};
^(http){1}s?(://){1}[a-zA-Z0-9\-\.\/]+$
@sijpkes
sijpkes / minify.js
Created March 2, 2018 03:57
Simple minify maker script
var UglifyJS = require('uglify-js');
var fs = require('fs');
var path = require('path');
var sys = require('util');
/*
https://gist.github.com/kethinov/6658166#gistcomment-1921157
*/
var walkSync = function(dir, filelist) {
var path = path || require('path');
var fs = fs || require('fs'),
(function() {
var params;
function eventFire(el, etype){
if (el.fireEvent) {
el.fireEvent('on' + etype);
} else {
var evObj = document.createEvent('Events');
evObj.initEvent(etype, true, false);
el.dispatchEvent(evObj);
@sijpkes
sijpkes / edX_zip_extract.sh
Last active September 19, 2017 00:35
edX ZIP file download, extraction and decryption - edX_zip_extract.sh yyyy-mm-dd filename.sql
#!/bin/bash
# ensure you have a _data and decrypted folder defined in this dir.
date=$1
ZFILE=newcastlex-$date.zip
ENC_FILE=$2
#have a
if [ -f _data/$ZFILE ]; then
echo "File $ZFILE already downloaded.."
@sijpkes
sijpkes / css-inject.js
Last active June 22, 2017 04:38
Host this somewhere to load into your blackboard item (see bb_item.html)
(function(){
"use strict";
var cssId = "aHR0cHM6Ly91b25saW5lLm5ld2Nhc3RsZS5lZHUuYXUvYmJjc3dlYmRhdi94aWQtMTEwNzQwOTJfMQ==";
if (!document.getElementById(cssId))
{
var role = $("role").value;
var url = $("styurl").readAttribute("href");
var head = document.getElementsByTagName("head")[0];
var link = document.createElement("link");
@sijpkes
sijpkes / bb_item.html
Last active June 22, 2017 04:35
Loads external stylesheet, allows application of custom styles to Blackboard items
<div id="bold_script">
<p>This element is viewable only by BOLD team members. Copy this to any section to apply custom stylesheets to the content stream.</p>
<strong><span style="text-decoration: underline;">Stylesheet URL</span><br /><br /></strong>
<a href="https://bb-sample-url.edu/bbcswebdav/pid-3317012-dt-content-rid-11074092_1/xid-11074092_1" id="styurl" target="_blank">
Assign Stylesheet URL to this link to change
</a>
<input type="hidden" name="role" id="role" value="@X@user.role@X@" />
</div>
<!-- get this script from my other gist css-inject.js -->
@sijpkes
sijpkes / new_node_project.sh
Last active June 12, 2020 22:34
create new node project and github repo script
#!/bin/sh
# @Author: ps158
# @Date: 2017-04-24T13:08:28+10:00
# @Last modified by: ps158
# @Last modified time: 2017-04-24T13:41:13+10:00
mkdir $1
git init
cd $1
@sijpkes
sijpkes / add and populate Blackboard VM
Last active April 11, 2017 06:50
rough shell script and instructions for setting up a fully usable Blackboard DEV instance
mkdir my-blackboard-dir/
cd my-blackboard-dir
# put the box file in this folder
cp/mv my-blackboard-vm.box . #from wherever
vagrant box add my-blackboard-vm.box --name NameForMyBox
vagrant plugin install vagrant-triggers
# add the Vagrantfile below
@sijpkes
sijpkes / squeaky.js
Last active May 3, 2017 02:02
script to clean the mess that Blackboard makes of CSS
var squeaky = squeaky ||
{
filterNone: function () {
return NodeFilter.FILTER_ACCEPT;
},
getCSS: function (rootElem) {
var comments = [];
var iterator = document.createNodeIterator(rootElem, NodeFilter.SHOW_COMMENT, this.filterNone, false);