A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
// ==UserScript== | |
// @version 1.4.1 | |
// @name Hide watched videos on YouTube | |
// @icon https://www.youtube.com/favicon.ico | |
// @match https://www.youtube.com/* | |
// @exclude https://www.youtube.com/embed/* | |
// @exclude https://www.youtube.com/api/* | |
// @namespace https://gist.github.com/xPaw/6324624 | |
// @updateURL https://gist.github.com/xPaw/6324624/raw/YoutubeHideWatched.user.js | |
// @downloadURL https://gist.github.com/xPaw/6324624/raw/YoutubeHideWatched.user.js |
/** | |
A little bare-bones drake calculator whipped together in ten minutes just to test some values and have fun. | |
Should work in all modern browsers. | |
**/ | |
function createDrake(element){ | |
if(!element){element = document.body;} | |
const container = document.createElement('div'); | |
container.id = 'drake'; |
// see also https://www.npmjs.com/package/subtractiontype.ts | |
// for literal unions | |
type Sub0< | |
O extends string, | |
D extends string, | |
> = {[K in O]: (Record<D, never> & Record<string, K>)[K]} | |
type Sub< |
# Please credit "Ghouly The Ghost" out of your kind heart! Check my gist page for a license. | |
# Includes: No slip inclines, variable angle climbing, shape agnostic implementation, slope climb up/down, smooth old school vertical collisions | |
# WARNING! IMPORTANT!: Relies on " Scene >> Projects Settings >> Physics 2D >> motion_fixed_enabled[x] __ on[x]" | |
extends KinematicBody2D | |
const floorCheckVector = Vector2( 0, 1 ) | |
const normalCheckVector = Vector2( 0, -1 ) | |
var angleThreshold = 1.39 setget set_angle_threshold | |
var slopeScale = tan( angleThreshold ) |
import React from 'react'; | |
class ReducerComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
reducer = (state, action) => state; | |
dispatch = action => this.setState(state => this.reducer(state, action)); |
A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
invoices/123
?
in a URL like /assignments?showGrades=1
.#
portion of the URL. This is not available to servers in request.url
so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things.extends KinematicBody2D | |
export var move_speed = 200.0 | |
var velocity := Vector2.ZERO | |
export var jump_height : float | |
export var jump_time_to_peak : float | |
export var jump_time_to_descent : float |
class_name HBHTTPRangeDownloader | |
signal download_finished | |
enum STATE { | |
STATE_READY, | |
STATE_BUSY | |
} | |
var download_url := "" |