Skip to content

Instantly share code, notes, and snippets.

🎉
update all the dependencies!!

Yavuz Ege Özcan egeozcan

View GitHub Profile
View keybase.md

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 Aug 2, 2018
Caesar cipher algorithm in javascript
View caesarCipher.js
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
Minute difference between two arbitrary string values
View CountingMinutesI.js
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 Mar 12, 2012
Answer to 6th problem on project Euler
View solution.js
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 Feb 10, 2012
Project Euler Problem 5 - JavaScript Solution
View solution.js
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 Sep 30, 2015
Project Euler Problem 4 - JavaScript Solution
View solution.js
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
@egeozcan
egeozcan / solution.js
Created Feb 10, 2012
Project Euler Problem 3 - JavaScript Solution
View solution.js
var originalTarget = 600851475143;
var target = originalTarget;
var i = 2;
while(i<target) {
while(target%i === 0) {
(function(newtarget) {
console.log(target + " can be divided by " + i + " which gives us " + newtarget);
target = newtarget;
})(target / i)
}
You can’t perform that action at this time.