Skip to content

Instantly share code, notes, and snippets.

View SheepTester's full-sized avatar
🐑
Existing

Sean Yen SheepTester

🐑
Existing
View GitHub Profile

I'm using the following localStorage extension:

importScripts('https://cdnjs.cloudflare.com/ajax/libs/localforage/1.7.3/localforage.min.js')

class LocalStorage {
  constructor () {}

  getInfo () {
    return {
@SheepTester
SheepTester / style.css
Created February 11, 2021 17:54
Centre a Leopard project on the screen
.leopard__project {
/* Centre the project on the screen */
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
/* Set the width the entire width
of the screen, and set the height
@SheepTester
SheepTester / index.html
Last active February 1, 2021 01:15
Template webpage
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>If you see this, I haven't bothered setting a website title.</title>
<meta name="description" content="If you see this, I haven't bothered writing a description." />
<link rel="stylesheet" type="text/css" href="/sheep3.css">
@SheepTester
SheepTester / hirbot.txt
Last active October 14, 2020 22:45
rbot
``` @everyone <@355534246439419904> ```
`` @everyone <@355534246439419904> ``
` @everyone <@355534246439419904> `
@SheepTester
SheepTester / sgy-reveal-discussion-members.js
Created August 17, 2020 22:37
Get everyone in your class on Schoology using a discussion board
document.querySelector('.dropdown-wrapper').classList.add('open')
document.querySelector('.dropdown-wrapper').classList.remove('disabled')
for (const tr of document.querySelectorAll('[id^="discussion-user-filter-"]')) {
const name = tr.querySelector('.user-stats-name')
const a = Object.assign(document.createElement('a'), {
href: `/user/${tr.id.replace('discussion-user-filter-', '')}/info`
})
a.style.fontWeight = 'normal'
name.replaceWith(a)
a.append(name)
@SheepTester
SheepTester / sheep.txt
Last active July 26, 2020 19:40
About me
🐑
const ArgumentType = require('../../extension-support/argument-type')
const BlockType = require('../../extension-support/block-type')
class LocalStorage {
constructor () {}
getInfo () {
return {
id: 'localstorage',
name: 'LocalStorage',
@SheepTester
SheepTester / event-utils.js
Last active May 18, 2020 21:31
Using for await for listening to events; inspired by Deno's http module
export async function * on (target, ...events) {
const nextPromises = []
let onFire
function addNextPromise () {
addNextPromise.push(new Promise(resolve => (onFire = resolve)))
}
addNextPromise()
function listener (event) {
@SheepTester
SheepTester / fetch.js
Created May 6, 2020 05:08
Simple Scratch fetch extension
class Fetch {
constructor () {}
getInfo () {
return {
id: 'fetch',
name: 'Fetch',
blocks: [
@SheepTester
SheepTester / explainer.md
Created May 4, 2020 19:35
Change speed of Edpuzzle video

Edpuzzle aggressively reverts the playbackRate of a <video> element, so you can't simply change it to increase the speed. Thus, a more aggressive response is necessary to combat it.

Firstly, we get the <video> element:

video = document.querySelector('video')

Then, we get the setter function for the playbackRate property using Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'playbackRate').set. It is called with the <video> element as this and with speed as the new value. This way, the <video> element is properly notified of the speed change by simulating assigning a value to playBackRate directly (ie using =).