Skip to content

Instantly share code, notes, and snippets.

@techniq
techniq / index.js
Last active April 24, 2026 15:15
Get calendar days
import dateFns from 'date-fns';
function getMonthDays(date) {
const startOfMonth = dateFns.startOfMonth(date);
const endOfMonth = dateFns.endOfMonth(date);
let prevMonthDaysNeeded = startOfMonth.getDay();
const prevMonthDays = prevMonthDaysNeeded ? dateFns.eachDay(
dateFns.subDays(startOfMonth, prevMonthDaysNeeded),
dateFns.subDays(startOfMonth, 1)
@bryik
bryik / .block
Last active December 4, 2019 19:21
Anisotropic Filtering With and Without
license: mit
@luthfianto
luthfianto / dda.js
Created September 29, 2014 12:48
Digital Differential Analyzer in JavaScript
function dda(x0, y0, x1, y1)
{
const dx = x1 - x0,
dy = y1 - y0,
s = Math.abs(dx) > Math.abs(dy) ? Math.abs(dx) : Math.abs(dy),
xi = dx * 1.0 / s,
yi = dy * 1.0 / s
var x = x0,
y = y0,