Skip to content

Instantly share code, notes, and snippets.

View Posandu's full-sized avatar
🎯
Focusing

Posandu Mapa Posandu

🎯
Focusing
View GitHub Profile
@jevgen
jevgen / float2rat.js
Created January 19, 2017 18:18 — forked from anonymous/float2rat.js
JavaScript function to convert a floating point number into a ratio with the help of some continued fractions.
function float2rat(x) {
tolerance = 1.e-4;
h1=1; h2=0;
k1=0; k2=1;
b = x;
do {
a = Math.floor(b);
aux = h1; h1 = a*h1+h2; h2 = aux;
aux = k1; k1 = a*k1+k2; k2 = aux;
b = 1/(b-a);
@tkon99
tkon99 / name.js
Last active April 19, 2024 14:38
Random Name Generator for Javascript
/*
(c) by Thomas Konings
Random Name Generator for Javascript
*/
function capFirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function getRandomInt(min, max) {
anonymous
anonymous / float2rat.js
Created January 18, 2013 23:15
JavaScript function to convert a floating point number into a ratio with the help of some continued fractions.
function float2rat(x) {
tolerance = 1.e-4;
h1=1; h2=0;
k1=0; k2=1;
b = x;
do {
a = Math.floor(b);
aux = h1; h1 = a*h1+h2; h2 = aux;
aux = k1; k1 = a*k1+k2; k2 = aux;
b = 1/(b-a);
@gre
gre / easing.js
Last active May 17, 2024 03:33
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {