Skip to content

Instantly share code, notes, and snippets.

View fuale's full-sized avatar
🏠
Working from home

Farid Akhmedov fuale

🏠
Working from home
  • Russia, Kemerovo
View GitHub Profile
@gre
gre / easing.js
Last active June 27, 2024 15:37
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 = {
@syrusakbary
syrusakbary / fib.rb
Last active June 9, 2024 12:33
Fibonacci algorithm in O(1) ;)
SQRT_5 = Math.sqrt(5)
GOLDEN_NUMBER = (1+SQRT_5)/2
def fib(n)
(1/SQRT_5*(GOLDEN_NUMBER**n-(-1/GOLDEN_NUMBER)**n)).to_i
end
puts fib(7)