Skip to content

Instantly share code, notes, and snippets.

View atesgoral's full-sized avatar

Ateş Göral atesgoral

View GitHub Profile

Keybase proof

I hereby claim:

  • I am atesgoral on github.
  • I am atesgoral (https://keybase.io/atesgoral) on keybase.
  • I have a public key whose fingerprint is 8D59 5FAD E029 0A18 3357 08BF EA57 0ED6 6ACF 59B3

To claim this, I am signing this object:

@atesgoral
atesgoral / validate.js
Last active March 28, 2016 09:26
Turkish Citizenship ID Validator
n=>{a=[].slice.call(n,0,9);a.push(a.reduce((s,d,i)=>{return s+d*(((i+1&1)*8)-1)},0)%10,a.reduce((s,d)=>{return s+1*d},0)%10);return n==a.join('')}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Balls.</title>
<style>
canvas { background-color: black; }
</style>
</head>
<body>
@atesgoral
atesgoral / gist:11261918
Created April 24, 2014 17:04
Find the closest match in an array of numbers
function findClosestToDesired(values, desired) {
return values
.slice(0)
.sort(function (a, b) {
return Math.abs(desired - a) - Math.abs(desired - b);
})
.shift();
}
// findClosestToDesired([ 1, 3, 7, 15 ], 6) === 7
@atesgoral
atesgoral / LICENSE.txt
Last active January 26, 2017 18:11 — forked from 140bytes/LICENSE.txt
Date formatter that uses human-readable date instance getters instead of cryptic Y/M/D etc. tokens
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Ates Goral <http://magnetiq.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@atesgoral
atesgoral / LICENSE.txt
Created June 2, 2011 20:36 — forked from 140bytes/LICENSE.txt
Relative path resolver
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Ates Goral <http://magnetiq.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@atesgoral
atesgoral / LICENSE.txt
Created May 24, 2011 17:35 — forked from 140bytes/LICENSE.txt
XML-escape given string
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Ates Goral <http://magnetiq.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@atesgoral
atesgoral / LICENSE.txt
Last active January 26, 2017 19:17 — forked from 140bytes/LICENSE.txt
Significant figures with nearest integer rounding
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Ates Goral <http://magnetiq.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@atesgoral
atesgoral / LICENSE.txt
Created May 21, 2011 09:32 — forked from 140bytes/LICENSE.txt
Parse UTC date string in ISO 8601 format
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Ates Goral <http://magnetiq.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@atesgoral
atesgoral / LICENSE.txt
Created May 21, 2011 08:48 — forked from 140bytes/LICENSE.txt
Variable-argument string formatter with {token} syntax that supports object properties and argument indices
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Ates Goral <http://magnetiq.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE