Skip to content

Instantly share code, notes, and snippets.

View larscwallin's full-sized avatar

Lars Wallin larscwallin

View GitHub Profile
async function annotateAllWordsInVisibleRange(){
let intRange = await vanillaReader.readingProgressionTimeLine.fetchTimelineRange(vanillaReader._readerView.getVisibleRange().getLocator());
for(let i = intRange.start; i <= intRange.end; i++ ) {
let location = await vanillaReader.readingProgressionTimeLine.fetchContentLocationAsRange(i, i + 1)
vanillaReader.highlightsLayer.addHighlight(location.getLocator().toString(), {
color: 'yellow',
locator: location.getLocator().toString()
}
This file has been truncated, but you can view the full file.
/*!
*
* WebGazer.js: Scalable Webcam EyeTracking Using User Interactions
* Copyright (c) 2016-2021, Brown HCI Group
* Licensed under GPLv3. Companies with a valuation of less than $1M can use WebGazer.js under LGPLv3.
*
*/
var webgazer =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
var SpeechRecognition = SpeechRecognition || webkitSpeechRecognition
var SpeechGrammarList = SpeechGrammarList || webkitSpeechGrammarList
var SpeechRecognitionEvent = SpeechRecognitionEvent || webkitSpeechRecognitionEvent
var actions = [ 'next' , 'previous' , 'toc'];
var grammar = '#JSGF V1.0; grammar actions; public <action> = ' + actions.join(' | ') + ' ;'
var recognition = new SpeechRecognition();
var speechRecognitionList = new SpeechGrammarList();
speechRecognitionList.addFromString(grammar, 1);
recognition.grammars = speechRecognitionList;
recognition.continuous = false;

Sync Media Explainer

DEFINITIONS

  • Sync Media Document

    The SMIL document including all the Sync Media extensions.

  • Media Object

// svg.textflow.js 0.8 - Copyright (c) 2013 Wout Fierens - Licensed under the MIT license
SVG.Textflow = function() {
this.constructor.call(this, SVG.create('text'))
/* define default style */
this.styles = {
'font-size': 16
, 'font-family': 'Helvetica, Arial, sans-serif'
, 'text-anchor': 'start'
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask.ext.httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':
@larscwallin
larscwallin / larscwallin.inx.extractelements.inx
Last active December 16, 2015 19:59
larscwallin.inx.extractelements version 0.1 extracts all selected SVG Elements to file and/or displayed as a string in the Inkscape GUI.
| A README
| larscwallin.inx.extractelements version 0.1 extracts all selected SVG Elements to file and/or displayed as a string in the
| Inkscape GUI.
|| UPDATE 130510
|||| Added option to keep the canvas size of the original drawing when exporting.
(Previously each exported drawing was sized according to its elements bounding box)
|||| Bug fixes

stopBefore.js

2min screencast

Examples

stopBefore(document, 'getElementById')
stopBefore('document.getElementById') // the same as the previous
stopBefore(Element.prototype, 'removeChild')
@larscwallin
larscwallin / simplx.dompdf.php
Created March 27, 2013 18:41
Simplx DOMPDF Snippet. Depends on http://dompdf.github.com/
<?php
/*
simplx.dompdf
*/
$filename = isset($filename) ? $filename : false;
$outputto = isset($outputto) ? $outputto : 'file';
@larscwallin
larscwallin / Bansai!
Last active October 13, 2015 23:18
Bansai! exports SVG from wonderous Inkscape to BonsaiJS template code. Still in Alpha but works as a proof of concept :)
Bansai!
* What is Bansai?
This is a script extension for Inkscape.It was inspired by the splendid BonsaiJS library. As well as
my lazy disposition, which does not like "coding" graphics ;)
So in short Bansai lets you select one or elements in Inkscape, and export them to BonsaiJS JSON notation.
* What is supported by this version?
A little, and still a lot :) At the moment I have had time to implement support for