Skip to content

Instantly share code, notes, and snippets.

@bohnacker
bohnacker / points_to_curve.js
Last active August 20, 2021 15:31
A javascript function that takes a list of points and calculates a curvy path that passes all these points. See https://hartmut-bohnacker.de/projects/points-to-curve for more information.
// Calculates a curve that goes through a number of points.
// There are lots of mathematical approaches to do so
// (see: https://en.wikipedia.org/wiki/Cubic_Hermite_spline).
// The most commonly used seems to be the Catmull–Rom spline.
// My approch here is not intended to be a new general
// solution to this problem, but it should fit some geometrical
// and graphical needs. See
// https://hartmut-bohnacker.de/projects/points-to-curve
// for more explanation.
@travstoll
travstoll / create_issue.php
Created January 15, 2017 16:29
Create GitHub Issue in PHP with File_Get_Contents using GitHub API
<?
//personal auth token from your github.com account. doing this will eliminate having to use oauth everytime
$token = "zzzzzzzzYourPersonalGithubAccessTokenzzzzzzzz";
//post url, https://developer.github.com/v3/issues/
$url = "https://api.github.com/repos/octocat/some_repo/issues?access_token=" . $token;
//request details, removing slashes and sanitize content
$title = htmlspecialchars(stripslashes("Test Title''\s"), ENT_QUOTES);
$body = htmlspecialchars(stripslashes("Test Body'\'$%'s"), ENT_QUOTES);
@bellbind
bellbind / algorithms-for-jpeg.js
Last active November 17, 2023 13:03
[javascript]Algorithms for JPEG processing
/* eslint no-unused-vars: 0, no-multi-spaces: 0 */
"use strict";
// [JPEG encode process]
// 1. RGB to YUV
// 2. Padding & chunk to 8x8-blocks
// 3. DCT
// 4. Quantization
// 5. zigzag scan
// 6. Huffman coding