Skip to content

Instantly share code, notes, and snippets.

View cevherkarakoc's full-sized avatar
😁

Cevher Karakoç cevherkarakoc

😁
View GitHub Profile
@cevherkarakoc
cevherkarakoc / range.js
Last active March 13, 2020 13:40
a range function
const range = (stop, start = 0, step = 1) => (
(step === 0 || ((stop - start) * Math.sign(step)) <= 0) ?
[] :
[...new Array(Math.abs(Math.ceil((stop - start) / step)))].map((_, index) => index * step + start)
)
range(6)
// output : [0, 1, 2, 3, 4, 5]
range(20, 1, 5)
// ==UserScript==
// @name IMDB Orjinal title
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author cevherkarakoc
// @include http://www.imdb.com/title/tt*
// @grant none
// ==/UserScript==
@cevherkarakoc
cevherkarakoc / cartesianToPolar.js
Created July 13, 2016 13:48
Converting cartesian coordinates to polar coordinates
function cartesianToPolar(x,y){
return {
radius: Math.sqrt( Math.pow(x, 2) + Math.pow(y, 2) ),
alpha: Math.atan2(y, x)
}
}
@cevherkarakoc
cevherkarakoc / polarToCartesian.js
Created July 13, 2016 13:35
Converting polar coordinates to cartesian coordinates
function polarToCartesian(radius,radian){
return {
x:radius*Math.cos(radian),
y:radius*Math.sin(radian)
}
}