Skip to content

Instantly share code, notes, and snippets.

Avatar
🤑
Looking for work

Barney Carroll barneycarroll

🤑
Looking for work
View GitHub Profile
@barneycarroll
barneycarroll / feedback.js
Last active Sep 13, 2020
A browser plugin script to identify previous / next pagination links in forums and expose them to generic keyboard navigation
View feedback.js
const options = {
duration: 600,
easing: 'cubic-bezier(0, 0.55, 0.45, 1)',
fill: 'both',
}
function feedback(message = 'error'){
const $circle = render(circle)
$circle.animate({
View Islands.js
import {viewOf, indexOf, domOf} from './utils.js'
export function EnsconcedIsland(v){
let input
let index
let dom
return {
view: v => {
viewOf(v)({render, vnode, write})
View Island.js
import {indexOf} from './utils.js'
export default function Island({children: [visitor]}){
let index
let vnode
visitor({ patch, attach, render })
return {
view(){
View Mobile.js
import {getSet, indexOf, viewOf} from './utils.js'
export function Mobile(){
return {
view: v => {
Promise.resolve().then(reconcile)
return viewOf(v)(Unit)
}
}
View NowThen.js
export default () => {
const queue = []
let then
return {
onbeforeupdate : () => !blocker,
oncreate : resolve,
onupdate : resolve,
view : ({
instance,
@barneycarroll
barneycarroll / .js
Last active Aug 2, 2019
Functor Mithril!
View .js
import m from './functor-mithril'
function Async(){
let cache
return ({content, setup, teardown}, dom) => {
if(content && !cache && teardown)
dom(node => {
void node.clientHeight
View Refresher.js
import {m} from './deps.js'
import viewOf from './viewOf.js'
// View component exposing a single function:
// Once invoked, the function causes the subtree to be reinitialised
export default () => {
let timestamp
const refresh = () => {
@barneycarroll
barneycarroll / tabitha.js
Created Oct 10, 2018
Get user-focusable elements within a context in tab order
View tabitha.js
// Source
const tabitha = (context = document) =>
[
...context.querySelectorAll('*')
]
.filter(element => {
const style =
window.getComputedStyle(element)
return (
View OffFocus.jsx
class OffFocus extends React.Component {
constructor(){
super()
const handler = e => {
if(
this.state.focused
&&
e.target.nodeType
&&
You can’t perform that action at this time.