Skip to content

Instantly share code, notes, and snippets.

View jamesplease's full-sized avatar
🍕
yum

James Please jamesplease

🍕
yum
  • USA
View GitHub Profile
@mrcdk
mrcdk / shader_stylebox.gd
Created February 25, 2024 10:43
A StyleBox that uses a Material to render
@tool
class_name StyleBoxShader extends StyleBox
@export var material:Material
@export var texture:Texture2D
# the canvas item we are going to use
var canvas_item_rid:RID
import PropTypes from 'prop-types';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Defined<T> = T extends undefined ? never : T;
/**
* Get the type that represents the props with the defaultProps included.
*
* Alternatively, we could have done something like this:
#!/bin/bash
browser=$1
if [ -z "$browser" ]; then
echo "Usage: ./deploy.sh <browser>"
exit 1
fi
set -euo pipefail
# Copy the right files
@bvaughn
bvaughn / updating-subscriptions-when-props-change-example.js
Last active March 27, 2022 09:29
Advanced example for manually updating subscriptions in response to props changes in an async-safe way
// This is an advanced example! It is not typically required for application code.
// If you are using a library like Redux or MobX, use the container component provided by that library.
// If you are authoring such a library, use the technique shown below.
// This example shows how to safely update subscriptions in response to props changes.
// In this case, it is important to wait until `componentDidUpdate` before removing a subscription.
// In the event that a render is cancelled before being committed, this will prevent us from unsubscribing prematurely.
// We also need to be careful about how we handle events that are dispatched in between
// `getDerivedStateFromProps` and `componentDidUpdate` so that we don't put stale values into the `state`.
@ceejbot
ceejbot / esm_in_node_proposal.md
Last active July 17, 2023 02:45
npm's proposal for supporting ES modules in node

ESM modules in node: npm edition

The proposal you’re about to read is not just a proposal. We have a working implementation of almost everything we discussed here. We encourage you to checkout and build our branch: our fork, with the relevant branch selected. Building and using the implementation will give you a better understanding of what using it as a developer is like.

Our implementation ended up differing from the proposal on some minor points. As our last action item before making a PR, we’re writing documentation on what we did. While I loathe pointing to tests in lieu of documentation, they will be helpful until we complete writing docs: the unit tests.

This repo also contains a bundled version of npm that has a new command, asset. You can read the documentation for and goals of that comma

@ericclemmons
ericclemmons / example.md
Last active February 22, 2024 16:18
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
anonymous
anonymous / what.js
Created July 9, 2015 00:15
function checkForCompletion(event) {
// assumes source data in sheet named Needed
// target sheet of move to named Acquired
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();
// Ignore edits on sheets other than the first sheet
if (s.getName() !== 'Sheet1') { return; }
Johann Sebastian Bach (31 March [O.S. 21 March] 1685 – 28 July 1750) was
a German composer and musician of the Baroque period. He enriched established
German styles through his skill in counterpoint, harmonic and motivic
organisation, and the adaptation of rhythms, forms, and textures from abroad,
particularly from Italy and France. Bach's compositions include the Brandenburg
Concertos, the Goldberg Variations, the Mass in B minor, two Passions, and over
three hundred sacred cantatas of which nearly two hundred survive. His music
is revered for its technical command, artistic beauty, and intellectual depth.
http://en.wikipedia.org/wiki/Johann_Sebastian_Bach
@Fonserbc
Fonserbc / Easing.cs
Last active February 23, 2024 01:13
Compact and simple easing functions for Unity
using UnityEngine;
/*
* Most functions taken from Tween.js - Licensed under the MIT license
* at https://github.com/sole/tween.js
* Quadratic.Bezier by @fonserbc - Licensed under WTFPL license
*/
public delegate float EasingFunction(float k);
public class Easing
@ianmetcalf
ianmetcalf / router.js
Created December 5, 2014 19:54
Chainable Async Router
var ChainableRouter = BaseRouter.extend({
constructor: function(options) {
BaseRouter.apply(this, arguments);
this.options = options || {};
this._initRoutes();
},