Skip to content

Instantly share code, notes, and snippets.

View ozknozsrt's full-sized avatar
🚀
Focusing

Özkan ÖZSERT ozknozsrt

🚀
Focusing
View GitHub Profile
@ozknozsrt
ozknozsrt / app.js
Last active January 16, 2024 16:48 — forked from itzikbenh/app.js
WordPress API - how to fetch and paginate posts with Vue.js
import Vue from 'vue';
import posts from './components/posts.vue';
window.axios = require('axios');
window.Vue = Vue;
Vue.component('posts', posts);
const app = new Vue({
el: '#app',
@ozknozsrt
ozknozsrt / findGrandParent.js
Created November 8, 2023 14:26
findGrandParent
function findGrandParent(array, id) {
// Diziyi her bir eleman için döngüye sok
for (let i = 0; i < array.length; i++) {
// Eğer elemanın id'si aranan id ile eşitse, elemanı, üst nesneyi ve üst nesnenin üst nesnesini döndür
if (array[i].StepId === id) {
return { item: array[i], parent: array, grandParent: array.parent };
}
// Eğer elemanın Steps adında bir özelliği varsa, recursive olarak fonksiyonu çağır
if (array[i].Steps) {
// Recursive çağrı yapmadan önce, dizinin üst nesnesini Steps özelliğine ata
@ozknozsrt
ozknozsrt / index.js
Created September 5, 2023 10:36
window-onbeforeunload-not-working-on-the-ipad
// https://stackoverflow.com/questions/3239834/window-onbeforeunload-not-working-on-the-ipad
if (typeof (onbeforeunloadCallBack) === "function") {
//newWindow.onbeforeunload = function (param) {
// onbeforeunloadCallBack(param);
//}
var isOnIOS = navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPhone/i);
var eventName = isOnIOS ? "pagehide" : "beforeunload";
<!-- SmtpJs -->
<script src="https://smtpjs.com/v3/smtp.js"></script>
<script>
$('.btn-submit').click(function () {
/*var maillist = [
'****@***.com',
'****@***.com',
];*/
@ozknozsrt
ozknozsrt / index.js
Created June 8, 2023 07:24
knockout js ko component example
// wwwroot/js/ui-components klasörü açıp içinde her component'e özel dosyalar olabilir:
// alert-message.js
ko.components.register('alert-message', {
viewModel: function (params) {
var self = this;
self.css = params.css;
self.icon = params.icon;
self.text = params.text;
self.title = translate(`global.${self.icon}`);
},
@ozknozsrt
ozknozsrt / My fav reset and responsive css
Created May 12, 2017 16:23
My fav reset and responsive css
@charset "utf-8";
/* CSS Document */
html, form {
width: 100%;
height: 100%;
}
body {
width: 100%;
height: 100%;
margin: 0;
@ozknozsrt
ozknozsrt / index.html
Created October 6, 2016 08:04
Google Map Directions Api (Yol Tarifi)
http://www.dijitalders.com/rs/ic/google_map_30_ile_directions_yol_tarifi_kullanimi__4708_0.png
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false">
@ozknozsrt
ozknozsrt / sayi_okunusu.py
Created August 30, 2017 11:26
python sayının okunuşu
birler = ["","Bir","İki","Üç","Dört","Beş","Altı","Yedi","Sekiz","Dokuz"]
onlar = ["","On","Yirmi","Otuz","Kırk","Elli","Altmış","Yetmiş","Seksen","Doksan"]
def okunus(sayı):
birinci = sayı % 10
ikinci = sayı // 10
return onlar[ikinci] + " " + birler[birinci]
@ozknozsrt
ozknozsrt / jsActivexObject.js
Created February 8, 2018 12:47
Force Open The Different Browser
<hta:application applicationname="HTA Test" scroll="yes" singleinstance="yes">
<script type="text/javascript">
function openURL()
{
var shell = new ActiveXObject("WScript.Shell");
shell.run("Firefox http://www.google.com");
}
</script>
</head>
<body>
@ozknozsrt
ozknozsrt / script.js
Created September 16, 2022 13:00
click outside with javascript composedPath()
const box = document.querySelector(".box");
document.addEventListener("click", function(e) {
if(e.composedPath().includes(box)) {
console.log("clicked inside it!")
} else {
console.log("clicked outside it!")
}
})