This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const exceptions = ["www.example.com"]; | |
if (!exceptions.includes(new URL(window.location).hostname)) { | |
console.log("Adding slash keybinding"); | |
document.addEventListener("keydown", function (event) { | |
const searchInput = | |
// https://caniuse.com/css-case-insensitive | |
document.querySelector('input[type="search" i]') ?? | |
document.querySelector('form[role="search" i] text[type="text"]') ?? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const exceptions = ["www.example.com"]; | |
if (!exceptions.includes(new URL(window.location).hostname)) { | |
console.log("Adding slash keybinding"); | |
document.addEventListener("keydown", function (event) { | |
const searchInput = | |
// https://caniuse.com/css-case-insensitive | |
document.querySelector('input[type="search" i]') ?? | |
document.querySelector('form[role="search" i] text[type="text"]') ?? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/> | |
<meta name="description" content="Stream"/> | |
<title>Stream</title> | |
<style> | |
html { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"Title": "Hobo with a Shotgun", | |
"Year": "2011", | |
"Rated": "Not Rated", | |
"Released": "12 May 2011", | |
"Runtime": "86 min", | |
"Genre": "Action, Comedy, Horror, Thriller", | |
"Director": "Jason Eisener", | |
"Writer": "John Davies", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chk :: Eq b => (a -> b) -> a -> b -> Bool | |
-- All arguments are present on the left | |
-- chk fn a b = b == fn a | |
-- get rid of 'b' param on the left by partially applying (==) operator | |
-- chk fn a = (== fn a) | |
-- get rid of 'a' param on the left by composing (==) after fn | |
-- chk fn = (==) . fn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The reducer function looks at each action that comes in | |
// and based on the type generates a new state based on the | |
// previous state and any additional data the action carried | |
const reducer = (state, action) => { | |
switch (action.type) { | |
case "COUNT_INCREMENT": | |
return { | |
...state, | |
count: state.count + 1 | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module List | |
( MyList | |
, fromList | |
, toList | |
, myMap | |
, myFilter | |
, myFoldl | |
, myReverse | |
, (+++) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useReducer, useContext } from "react"; | |
const defaultState = { | |
todos: [], | |
addTodoInputText: "" | |
}; | |
export const StoreContext = React.createContext([defaultState, () => {}]); | |
export function Store({ children }) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const format = (strings, ...values) => { | |
if (values.every(v => typeof v !== "function")) { | |
return strings.reduce((acc, str, i) => values[i] === undefined ? acc + str : acc + str + values[i], "") | |
} | |
return obj => strings.reduce((acc, str, i) => values[i] === undefined ? acc + str : | |
typeof values[i] === "function" ? acc + str + values[i](obj) : acc + str + values[i], "") | |
} |