Skip to content

Instantly share code, notes, and snippets.

View tingletech's full-sized avatar

Brian Tingle tingletech

View GitHub Profile
@robertknight
robertknight / README.md
Last active December 31, 2022 14:39
Using Hypothesis in a JavaScript SPA with client-side routing

Update 2022-12-31:

The latest version of Hypothesis will detect client-side URL changes via the HTML 5 History API or the Navigation API and update the loaded set of annotations automatically. For this to work, the web application must follow these best practices for web apps that do client-side navigation:

  1. Update the URL when the logical route in the app changes
  2. Use the path and query string of the URL to indicate the route, not the fragment. For example https://example.com/your-app/some/page is OK, https://example.com/your-app/#!/some/page is not.
  3. The content of the page must be updated by the time Hypothesis has fetched the new annotations for the new URL. The safest way to do this is by not updating the URL until the content has been updated or is just about to be updated (eg. content has been fetched and a React/Vue/Angular re-render is queued up). In browsers that implement the new Navigation API
@manigandham
manigandham / rich-text-html-editors.md
Last active November 14, 2024 09:30
Rich text / HTML editors and frameworks

Strictly Frameworks

Abstracted Editors

These use separate document structures instead of HTML, some are more modular libraries than full editors

@nmvega
nmvega / INTERACTIVE.PYSPARK.SHELL.README.txt
Last active February 3, 2020 23:44
I wrote this a while back because I wanted to interact with the PySpark shell from within the bpython(1) code-auto-complete enabled interpreter and/or WING IDE and/or any code-auto-complete enabled IDE for that matter. Simply invoking the supplied pyspark(1) command wasn't good enough, since there's no code intelligence to assist. While this was…
How to use this code.
NOTE: You can place all of the following in your .profile (or shell equivalent).
(1) linux$ export MASTER='yarn-client | local[NN] | spark://host:port'
(2) linux$ export SPARK_HOME=/usr/lib/spark # Your's will vary.
(3) linux$ export JAVA_HOME=/usr/java/latest # Your's will vary.
(4) linux$ export NAMENODE='vps00' # Your's will vary.
(5) linux$ export PYSTART=${PYTHONSTARTUP} # See in-line commends about the reason for the need for this alias to PYTHONSTARTUP.
(6) linux$ export HADOOP_CONF_DIR=/etc/hadoop/conf # Your's will vary. This one may not be necessary to set. Try and see.
@Vp3n
Vp3n / gist:5340891
Created April 8, 2013 21:55
Allowing CORS (Cross-Origin Resource Sharing) requests from grunt server
//Allowing CORS (Cross-Origin Resource Sharing) requests from
// grunt server, put this into Gruntfile.js
grunt.initConfig({
connect: {
livereload: {
options: {
port: 9000,
hostname: 'localhost',
middleware: function (connect) {
return [
@gourneau
gourneau / downloadChunks.py
Created December 4, 2011 18:33
Download large files with Python urllib2 to a temp directory
import os
import urllib2
import math
def downloadChunks(url):
"""Helper to download large files
the only arg is a url
this file will go to a temp directory
the file will also be downloaded
in chunks and print out how much remains
@AlBaker
AlBaker / ExampleGroovySparql.groovy
Created June 27, 2011 05:30
Groovy SPARQL Example
@Grab('com.hp.hpl.jena:jena:2.6.4')
@Grab('com.hp.hpl.jena:arq:2.8.8')
import groovy.sparql.Sparql
// Can also take a Jena model as an argument
def sparql = new Sparql("http://dbpedia.org/sparql")
def query = """
SELECT ?abstract