Skip to content

Instantly share code, notes, and snippets.

Avatar

TIm St.Clair frumbert

  • Repton, Australia
View GitHub Profile
@frumbert
frumbert / index.html
Created May 4, 2020
xAPI Example - Send simple Statement to LRS
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Send xAPI statement</title>
<script type="text/javascript" src="xAPIWrapper-master/lib/cryptojs_v3.1.2.js"></script>
<script type="text/javascript" src="xAPIWrapper-master/lib/utf8-text-encoding.js"></script>
<script type="text/javascript" src="xAPIWrapper-master/src/activitytypes.js"></script>
<script type="text/javascript" src="xAPIWrapper-master/src/verbs.js"></script>
@frumbert
frumbert / index.php
Created Apr 13, 2020
Sort and Link to markdown files in nested sub-folders in PHP (e.g. build documentation)
View index.php
<?php
/*
You have markdown files in nested folders which comtain
--01.getting-started
| |
| +--02.finalisation
| | |
| | docs.md
| | picture.png
@frumbert
frumbert / zipfolders.php
Created Sep 2, 2019
zip each folder in current directory recursively without the top-level folder, and name it after the directory
View zipfolders.php
<?php
header("content-type:text/plain");
$root = realpath(".");
$ar = array_diff(scandir($root), array('.','..'));
foreach ($ar as $fold) {
$rootPath = "{$root}/{$fold}";
if (is_dir($rootPath)) {
$zip = new ZipArchive();
$zip->open("{$rootPath}.zip", ZipArchive::CREATE | ZipArchive::OVERWRITE);
$files = new RecursiveIteratorIterator(
@frumbert
frumbert / block.php
Last active Sep 11, 2020
Block code for hacking scorm and completion data in Moodle (incomplete file, just the important function bits)
View block.php
<?php
// there's more to this file than this:
public function get_content()
{
global $CFG, $DB, $USER;
if (!is_siteadmin()) {
return null;
}
@frumbert
frumbert / sample-animation.svg
Created Feb 20, 2018
animated svg using smil
View sample-animation.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@frumbert
frumbert / tab-title-marquee.html
Created Oct 27, 2017
Make a marquee on the browser title
View tab-title-marquee.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>argh!</title>
<script type="text/javascript">
message = "The quick brown 🦊 jumps over the lazy 🐶 ";
function step() {
message = message.substr(1) + message.substr(0,1);
document.title = message.substr(0,15);
@frumbert
frumbert / activity.php
Created Aug 12, 2017
In moodle, get a list of activities that are available and their index (order from the top down)
View activity.php
<?php
require('../../config.php'); // adjust as needed
require_once($CFG->dirroot.'/course/format/lib.php');
require_once($CFG->libdir.'/modinfolib.php');
$courseid = 26; // the numerical id of the course we are looking in
$index = 1;
$course = get_course($courseId); // in course/format/lib.php
$modinfo = get_fast_modinfo($course); // in lib/modinfolib.php
@frumbert
frumbert / function.js
Created Aug 9, 2017
blob to dataurl, because I keep forgetting how to do it!
View function.js
function blobToDataURL(blob) {
return new Promise((fulfill, reject) => {
let reader = new FileReader();
reader.onerror = reject;
reader.onload = (e) => fulfill(reader.result);
reader.readAsDataURL(blob);
})
}
@frumbert
frumbert / Program.cs
Created Aug 9, 2017
c# to php encryption handy code snippet
View Program.cs
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Security.Cryptography;
namespace csharpstuff
{
class MainClass
{
@frumbert
frumbert / pew-pew.html
Last active Oct 27, 2017
a canvas game, based on a tutorial by gamekedo
View pew-pew.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>game</title>
</head>
<body>
<script>
hiscore = score = 1000;
player = {