Skip to content

Instantly share code, notes, and snippets.

View egeozcan's full-sized avatar
🎉
update all the dependencies!!

Yavuz Ege Özcan egeozcan

🎉
update all the dependencies!!
View GitHub Profile
@egeozcan
egeozcan / index.html
Created October 18, 2024 08:40
image viewer
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fullscreen Image Viewer</title>
<style>
body {
font-family: Arial, sans-serif;
}
type CanvasColor = string | 1 | 2 | 3 | 4 | 5 | 6;
interface Canvas {
nodes?: Node[];
edges?: Edge[];
}
type Node = TextNode | FileNode | LinkNode | GroupNode;
interface BaseNode {
document.addEventListener('alpine:init', () => {
window.Alpine.data('autocompleter', ({
selectedResults,
max,
min,
ownerId,
url,
elName,
filterEls = [],
addUrl = "",
//to be used in https://tr.wikipedia.org/wiki/T%C3%BCrkiye_Cumhuriyet_Merkez_Bankas%C4%B1_ba%C5%9Fkanlar%C4%B1_listesi
function parseDate(dateStr) {
const [dayStr, monthStr, yearStr] = dateStr.split(" ");
const parsedDate = new Date(parseInt(yearStr), months.indexOf(monthStr), parseInt(dayStr));
return isNaN(parsedDate.getDay()) ? new Date() : parsedDate;
}
const months = ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'];

Keybase proof

I hereby claim:

  • I am egeozcan on github.
  • I am egeozcan (https://keybase.io/egeozcan) on keybase.
  • I have a public key whose fingerprint is B7D3 8012 A7FB B92F B91E 4DB0 CE52 5F56 D0B5 C80A

To claim this, I am signing this object:

@egeozcan
egeozcan / caesarCipher.js
Last active August 2, 2018 16:47
Caesar cipher algorithm in javascript
String.prototype.caesarCipher = function(level) {
function nextLetter(s){
return s.replace(/([a-zA-Z])[^a-zA-Z]*$/, function(a){
var c= a.charCodeAt(0);
switch(c){
case 90: return 'A';
case 122: return 'a';
default: return String.fromCharCode(++c);
}
});
@egeozcan
egeozcan / CountingMinutesI.js
Created May 15, 2012 12:08
Minute difference between two arbitrary string values
function CountingMinutesI(str) {
var times = str.replace(";\"","").split("-").map(function(t) {
t = t.split(":");
var h = parseInt(t[0], 10);
var m = parseInt(t[1], 10);
var am = t[1].indexOf("am") > 0;
if(h === 12) h = 0;
var mins = m + h * 60;
if(!am) mins += 720;
return mins;
@egeozcan
egeozcan / solution.js
Created March 12, 2012 08:49
Answer to 6th problem on project Euler
var i, n, sum = 0;
for(i = 1; i < 100; i++) {
for(n = 100; n > i; n--) {
sum += n * i
}
}
console.log("result is: " + (sum * 2));
@egeozcan
egeozcan / solution.js
Created February 10, 2012 10:54
Project Euler Problem 5 - JavaScript Solution
var from = 1, target = 20, primes = {}, result = 1;
for(var divider = from; divider <= target; divider++) {
(function(newTarget) {
var i = 2, dividersPrimes = {};
while(i <= newTarget) {
while(newTarget % i === 0) {
newTarget = newTarget / i;
if(!dividersPrimes[i]) {
dividersPrimes[i] = 1;
@egeozcan
egeozcan / solution.js
Last active September 30, 2015 12:27
Project Euler Problem 4 - JavaScript Solution
console.time("p");
console.log(function () {
var x, y, z, i = 999, latestPalindrome = 0, palindromeDivider = 0;
for (x = 9; x > 0; x--) {
for (y = 9; y >= 0; y--) {
for (z = 9; z >= 0; z--) {
latestPalindrome = 100001 * x + 10010 * y + 1100 * z;
for (i = 999; i >= 100; i--) {
if (latestPalindrome % i === 0) {
palindromeDivider = latestPalindrome / i