Skip to content

Instantly share code, notes, and snippets.

View btopro's full-sized avatar
🃏
Seeking Ubiquity

Bryan Ollendyke btopro

🃏
Seeking Ubiquity
View GitHub Profile
@btopro
btopro / socketfix.php
Created July 12, 2021 13:14
Drupal 7 SSL connection issue with sockets; so force usage of curl if available.
/**
* Wrapper to leverage curl when possible to avoid potential socket connection
* issues with certain SSL connections
*/
function _cis_connector_make_request($url, $options){
// support developers overloading the request method, specifically curl
// as some systems can have issues with SSL configuration and socket connections
if (function_exists('curl_init')) {
$headers = array();
foreach ($options['headers'] as $property => $value) {
@btopro
btopro / scopedcustomelementregistry.md
Last active April 14, 2021 17:30
Some thoughts on Scoped custom element registry proposals

Forward

I am not on the WHATWG / W3C, I'm just someone who implements and tracks low level JS/HTML APIs. The current direction and discussions around this topic are interesting yet seem to revolve around the concept of anonymous class instances of element definitions that ship with other elements.

The advantages of this methodology involve being able to ship completely containerized code that is not going to suffer issues with cool-stuff tag being registered globally when trying to download and implement whatever-tag which happens to ship with a competing reference to cool-stuff.

The scoped proposal can be found here: https://github.com/WICG/webcomponents/blob/gh-pages/proposals/Scoped-Custom-Element-Registries.md

@btopro
btopro / pandoras_vox.mdown
Created March 31, 2021 14:34 — forked from kolber/pandoras_vox.mdown
pandora’s vox: on community in cyberspace

pandora’s vox: on community in cyberspace

by humdog (1994)

when i went into cyberspace i went into it thinking that it was a place like any other place and that it would be a human interaction like any other human interaction. i was wrong when i thought that. it was a terrible mistake.

the very first understanding that i had that it was not a place like any place and that the interaction would be different was when people began to talk to me as though i were a man. when they wrote about me in the third person, they would say “he.” it interested me to have people think i was “he” instead of “she” and so at first i did not say anything. i grinned and let them think i was “he.” this went on for a little while and it was fun but after a while i was uncomfortable. finally i said unto them that i, humdog, was a woman and not a man. this surprised them. at that moment i realized that the dissolution of gender-category was something that was happening everywhere, and perhaps it was only just very obvious on the ne

@btopro
btopro / escape-cantvas.js
Created September 17, 2020 21:38
"Another way out"
javascript:(function()%7Bwindow.__appCDN%3D%22https%3A%2F%2Fcdn.webcomponents.psu.edu%2Fcdn%2F%22%3Bvar%20tag%20%3D%20document.createElement('script')%3Btag.src%3D%22https%3A%2F%2Fcdn.webcomponents.psu.edu%2Fcdn%2Fbuild.js%22%3Bdocument.head.appendChild(tag)%3Bfunction%20tokenHack(e)%20%7BsetTimeout(function()%20%7Bif%20(document.getElementById('content'))%20%7Bvar%20pageContents%20%3D%20document.getElementById('content').innerHTML%3Bvar%20myRegexp%20%3D%20%2F%5C%5Bwc%3A(.*%3F)%5Cs(.*%3F)%5C%2F%5C%5D%2Figm%3Bvar%20match%20%3D%20myRegexp.exec(pageContents)%3Bvar%20replacement%3Bwhile%20(match%20!%3D%20null)%20%7Breplacement%20%3D%20'%3C'%20%2B%20match%5B1%5D%20%2B%20'%20'%20%2B%20match%5B2%5D%20%2B%20'%3E%3C%2F'%20%2B%20match%5B1%5D%20%2B%20'%3E'%3BpageContents%20%3D%20pageContents.replace(match%5B0%5D%2C%20replacement)%3Bmatch%20%3D%20myRegexp.exec(pageContents)%3B%7Ddocument.getElementById('content').innerHTML%20%3D%20pageContents%3Bwindow.WCAutoload.process()%3B%7D%7D%2C%200)%3B%7Dwindow.addEventListener(%2
@btopro
btopro / gist:5504dd72f8ff50ec2c71f9f7a0490abf
Last active August 28, 2020 14:47
Pretty standard service worker reloading methodology we use
if ('serviceWorker' in navigator) {
var sitePath = '/';
// discover this path downstream of the root of the domain
var swScope = window.location.pathname.substring(0, window.location.pathname.indexOf(sitePath)) + sitePath;
if (swScope != document.head.getElementsByTagName('base')[0].href) {
document.head.getElementsByTagName('base')[0].href = swScope;
}
window.addEventListener('load', function () {
navigator.serviceWorker.register('service-worker.js', {
scope: swScope
cd ~/HAXcms
ln -s ~/lrnwebcomponents/node_modules node_modules
@btopro
btopro / gist:ddc9d968627f15b9a4f3911045e744ea
Last active February 28, 2020 20:51
Meet the EdTechJoker: HAX'ing OER by making any system a learning system

Abstract

I am the EdTechJoker and I'd like you to take my red pill and explore a world where ANY platform is a learning platform. A world where the production of accessible and sustainable OER is possible by anyone on any platform. A world where educator, learner and instructional designer creativity flow like water.

In this session we'll explore that world through the open source editor called HAX being developed by Penn State, the US National Archives and others! We'll look at multiple Penn State courses taught using HAX, see student produced OERs using HAXcms, learn about my digital activism approach to pedagogy and get a chance to play with the HAX editor and see the future of web production.

Submission

I am the EdTechJoker and I'd like you to explore a world where ANY platform is a learning platform. A world where the production of accessible and sustainable OER is possible by anyone on any platform. A world where educator, learner and instructional designer creativity flow like water. Welcome

Me (4 min)

  • Show what web components
  • supported everywhere
  • why web components over other things (building 1 brick at a time, progressive decoupling, no framework lock in)
  • describe how a tag went from PolymerElement to LitElement to HTMLElement in production bc of same integraiton "api"
  • element forms an api / contract for how it should work via its slot, css variables and properties / attributes
  • show what integration looks like
  • talk about toolng and our element repo if people want to learn more about our work
  • talk about open-wc and starting with that
@btopro
btopro / gist:c807a057f029f30f2a46a8c97a718bef
Last active January 8, 2020 15:23
HAXcms 0.12.3 OpenAPI documentation blob
openapi: 3.0.0
info:
title: 'HAXcms API'
description: 'API for interfacing with HAXcms end points'
termsOfService: 'https://haxtheweb.org'
contact:
email: [email protected]
license:
name: 'Apache 2.0'
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
@btopro
btopro / webcomponentizer.js
Created September 19, 2019 11:57
A Bookmarklet that converts areas on a website into web components via an alerts based "UI"
javascript:(function(){window.__haxClickEvent=(e)=>{if(e.target.tagName!=='TO-ELEMENT'){e.preventDefault();e.stopPropagation();e.stopImmediatePropagation();if(!window.__first){alert('You\'ll now be asked to name this element. Make sure the element name has a hypthen in it like "cool-new-things".');window.__first=true;}let name=prompt('Name for this element:','cool-new-thing');if(name){e.target.classList.remove('hax-injected-highlighter');document.getElementById('haxallthethings').downloadNewComponent(e.target,name);}else{document.body.removeEventListener('click',window.__haxClickEvent);document.body.removeEventListener('mouseover',function(e){e.target.classList.add('hax-injected-highlighter');});document.body.removeEventListener('mouseout',function(e){e.target.classList.remove('hax-injected-highlighter');});}}};let link=document.createElement('script');link.type="module";link.src="https://cdn.waxam.io/build/es6/node_modules/@lrnwebcomponents/to-element/to-element.js";document.body.appendChild(link);let toE=do