Skip to content

Instantly share code, notes, and snippets.

View caglarorhan's full-sized avatar
🤿
diving to the codes :)

Çağlar ORHAN caglarorhan

🤿
diving to the codes :)
View GitHub Profile
@caglarorhan
caglarorhan / imgTracker.js
Created September 6, 2021 18:17
Image as a tracker for WDC
const WDS_sidebanner = {
lifeHour: 1,
mSecondAnHour: 3600000,
mSecondToNow: new Date().getTime(),
expDateTime() {
return this.mSecondToNow + (this.lifeHour * this.mSecondAnHour)
},
createSideBanner(sideBannerData) {
const sideBanner = document.createElement('div');
const bannerClosingButton = document.createElement('span');
@caglarorhan
caglarorhan / SimpleModal.html
Last active June 30, 2021 10:07
Simple Modal Window Creator
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Simple Modal</title>
<link rel="stylesheet" href="public/stylesheets/modal.css">
<script src="public/javascripts/modalWindowCreator.js"></script>
</head>
<body>
<button onclick="modalWindowCreator()">JUST CREATE</button>
@caglarorhan
caglarorhan / async.js
Created June 10, 2021 00:09
async_basics_1
a();
let test =()=>{
return new Promise((res,rej)=>{
setTimeout(()=>{
res('Time is out!')
},5000)
})
}
@caglarorhan
caglarorhan / migratoryBirdObvervation.js
Created February 16, 2021 22:47
MigratoryBirdObservation problem from HackerRank
function migratoryBirds(arr=[1,2,3,4,5,4,3,2,1,3,4]) {
let typesOccurs = {};
arr.forEach(item=>{
if(typesOccurs[item]){
typesOccurs[item]=Number(typesOccurs[item])+1
}else{
typesOccurs[item]=1
}
});
console.log(typesOccurs);
@caglarorhan
caglarorhan / WDC_box.js
Last active November 18, 2020 22:20
WDC_box library
const WDC_box = {
expDateTime(lifeHour) {
return new Date().getTime() + (lifeHour * 3600000)
},
vw() {
return Math.min(document.documentElement.clientWidth, window.innerWidth)
},
vh() {
return Math.min(document.documentElement.clientHeight, window.innerHeight)
},
@caglarorhan
caglarorhan / WDS_sidebanner.js
Last active November 10, 2020 05:00
WDS_sidebanner box
const WDS_sidebanner = {
lifeHour: 1,
mSecondAnHour: 3600000,
mSecondToNow: new Date().getTime(),
expDateTime (){return this.mSecondToNow + (this.lifeHour * this.mSecondAnHour)},
createSideBanner(sideBannerData) {
const sideBanner = document.createElement('div');
const bannerClosingButton = document.createElement('span');
sideBanner.id = "sidebanner_"+sideBannerData.content_id;
const vw = Math.min(document.documentElement.clientWidth, window.innerWidth);
@caglarorhan
caglarorhan / WDS_modal.js
Last active November 11, 2020 02:38
Modal popup basic structure
const WDS_modal = {
lifeHour: 1,
mSecondAnHour: 3600000,
mSecondToNow: new Date().getTime(),
expDateTime (){return this.mSecondToNow + (this.lifeHour * this.mSecondAnHour)},
createModal(modalData){
const backDrop = document.createElement('div');
const modal = document.createElement('div');
const modalClosingButton = document.createElement('span');
backDrop.id = "modal_"+ modalData.content_id.toString();
@caglarorhan
caglarorhan / WDS_topBanner.js
Last active November 8, 2020 19:43
Creating a top banner box
const WDC_banner ={
lifeHour: 1,
mSecondAnHour: 3600000,
mSecondToNow: new Date().getTime(),
expDateTime (){return this.mSecondToNow + (this.lifeHour * this.mSecondAnHour)},
placeTheBanner(bannerData){
const bannerClosingButton = document.createElement('span');
const topBanner = document.createElement('div');
topBanner.innerHTML= bannerData.content;
topBanner.id= "banner_"+ bannerData.content_id.toString();
@caglarorhan
caglarorhan / win10SpotlightImages.js
Last active September 1, 2020 03:53
WindowsSpotlightImages
async function compile(){
let payload ={curPageNumber:1, thisPagesImageList:[], maxPageNumber:2};
let curPageNumber=0;
let maxPageNumber=1;
let imgList=[];
while(curPageNumber<=maxPageNumber){
let returnedObject = await linkInPage(payload);
curPageNumber = parseInt(returnedObject.curPageNumber);
maxPageNumber = parseInt(returnedObject.maxPageNumber);
imgList = imgList.concat(returnedObject.thisPagesImageList);
@caglarorhan
caglarorhan / popup.js
Created August 30, 2020 06:40
To add css files into tabs from popup.js of browser (Chrome) extensions programmatically.
chrome.tabs.insertCSS({file:'dark.css'});