Skip to content

Instantly share code, notes, and snippets.

View GoodNovember's full-sized avatar
🖍️
Why can't I write my code in Crayon?

Victor GoodNovember

🖍️
Why can't I write my code in Crayon?
  • 951 Gaspra
View GitHub Profile
@GoodNovember
GoodNovember / makeRange.js
Created October 10, 2019 19:43
Useful to get an array of integer values that start from one number and end in another one.
export const makeRange = ([ start, end ]) => {
const length = Math.abs(end - start)
const output = []
let cursor = start
if (start === end) {
return [start]
}
for (let i = 0; i <= length; i++) {
if (start < end) {
output.push(cursor++)
// useful for setting constraints.
export const bracket = ({ value, min, max }) => Math.min(Math.max(value, min), max)
@GoodNovember
GoodNovember / example.js
Last active November 18, 2019 18:16
Some Handy React Hooks
const Range = ({ containerStyle, containerClassName, min, max, value, step, onChange }) => {
const animate = (timestamp, delta) => {
console.log('AnimationTick', {timestamp, delta})
}
const [startAnimation, stopAnimation, getIsAnimatingRef, getIsAnimatingState] = useAnimationFrame(animate, true)
useDocumentEvents({
'pointerup' (event) {
stopAnimation()
const differentiate = (targetArray, filterFunction) => targetArray.reduce(([truthAcc, falseAcc], item, index, arr) => {
if (filterFunction(item, index, arr)) {
truthAcc.push(item)
} else {
falseAcc.push(item)
}
return [truthAcc, falseAcc]
}, [[], []])
module.exports = { differentiate }
@GoodNovember
GoodNovember / classify.js
Created September 27, 2019 19:15
Classify Stuff with filters.
const giveMeArrayOfArrays = count => {
const output = []
for (let i = 0; i < count; i++) {
output.push([])
}
return output
}
const classify = (inputArray, arrayOfFilters = []) => {
const getFilterResults = (value, index, array) => {
@GoodNovember
GoodNovember / email.md
Created September 17, 2019 21:14
Junk Email: on behalf of Steven | RONTA <sales@XMRONTA.COM>

Dear Sir/Maddam, lawit

Wish you a nice day!

This is Steven from Ronta(Xiamen)Co.,Ltd.We are a professional manufacturer of bags located in Xiamen,China.

We can produce the following products for you:

Sports Bags Backbacks

@GoodNovember
GoodNovember / interface.md
Created August 18, 2019 15:40
LENS Thoughts

interface

a phone keyboard like interface. searchable. with the best carrot in town.

effortless to put where you want and every action performed is clearly understandable what happened and be easily undoable and redoable.

drag to reorder everything. every action is clear and distinct yet cohesive.

every action fits together like Legos.

@GoodNovember
GoodNovember / makeGetSet.js
Created August 8, 2019 22:32
Kinda useful getter setter and subscriber all in one.
export const makeGetSet = ({ initialValue, skipInitialCall = false }) => {
let value = initialValue
let subscribers = new Set()
const getValue = () => value
const setValue = newValue => {
value = newValue
subscribers.forEach(sub => { sub(newValue) })
}
const subscribe = callback => {
if (subscribers.has(callback) === false) {
@GoodNovember
GoodNovember / BabylonLayout.jsx
Created August 2, 2019 16:05
WebGL Renderers, made Responsive, paired with React and Styled Components
import React, { useState } from 'react'
import { FullContainer } from '../FullContainer'
import { BabylonScene } from '../BabylonScene'
import { Container } from '../Container'
import { ScrollContainer } from '../ScrollContainer'
import * as BABYLON from 'babylonjs'
import * as GUI from 'babylonjs-gui'
const {

3128 4693 6742