Skip to content

Instantly share code, notes, and snippets.

Ahmet Hakan Beşel ahmethakanbesel

Block or report user

Report or block ahmethakanbesel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ahmethakanbesel
ahmethakanbesel / battery.js
Created Feb 10, 2018
Javascript Battery Level GUI
View battery.js
var pil = navigator.battery || navigator.webkitBattery || navigator.mozBattery;
function pilDurumu(pil) {
document.getElementById('seviye').innerHTML += ' %' + pil.level * 100;
document.getElementById('yuzde').value = pil.level * 100;
if (pil.charging === true) {
var durum = "Şarj oluyor";
} else {
var durum = "Şarjda değil";
}
View js-render-css.js
<script>
var loadDeferredStyles = function() {
var addStylesNode = document.getElementById("deferred-styles");
var replacement = document.createElement("div");
replacement.innerHTML = addStylesNode.textContent;
document.body.appendChild(replacement)
addStylesNode.parentElement.removeChild(addStylesNode);
};
var raf = requestAnimationFrame || mozRequestAnimationFrame ||
webkitRequestAnimationFrame || msRequestAnimationFrame;
@ahmethakanbesel
ahmethakanbesel / css-render.html
Created Sep 29, 2017
Oluşturmayı önleyen JavaScript ve CSS kodlarını ekranın üst kısmındaki içerikten kaldırın
View css-render.html
<noscript id="deferred-styles">
<link rel="stylesheet" type="text/css" href="stil.css"/>
</noscript>
View wordpress-javascript-defer.php
/*
* Defer Javascript
*/
add_filter( 'clean_url', function( $url )
{
if ( FALSE === strpos( $url, '.js' ) )
{
return $url;
}
return "$url' defer='defer";
@ahmethakanbesel
ahmethakanbesel / titresim.html
Last active Sep 8, 2017
Javascript navigator.vibration API Example
View titresim.html
<button onclick="titret(1000)">Titret</button>
<button onclick="titret([1000, 200, 1000, 2000, 400]);">Titret (3 defa aralıklı)</button>
<script>
function titret(sure) {
navigator.vibrate(sure);
console.log(sure + "ms");
}
</script>
@ahmethakanbesel
ahmethakanbesel / multi-submit-form.html
Created Aug 17, 2017
Separate Form Submit Buttons That Go To Different URLs
View multi-submit-form.html
<form action="dosya.php">
<input type="submit" value="Gönder">
<input type="submit" value="Gönder 2" formaction="dosya-2.php">
</form>
@ahmethakanbesel
ahmethakanbesel / disable-kbd.js
Created Aug 3, 2017
Pure Javascript Disable Key Binds and Keyboard Shortcuts
View disable-kbd.js
document.onkeydown = function (e) {
return false;
}
View esp8266-get-request.ino
#include <ESP8266WiFi.h>
const char* ssid = "SSID_adiniz";
const char* password = "WIFI_sifreniz";
const char* host = "facebook.com";
void setup() {
Serial.begin(115200);
delay(10);
@ahmethakanbesel
ahmethakanbesel / dosya-sil.php
Created Jul 3, 2017
PHP ile eski dosyaları silme (Delete files older than X in PHP)
View dosya-sil.php
<?php
/*
* Silinecek dosyaların bulunduğu dizin
*/
$dir = "klasor/dosyalar";
/*
* Dizindeki tüm dosyalara işlem uygulanır
*/
foreach (glob($dir."*") as $file) {
/*
@ahmethakanbesel
ahmethakanbesel / sekme.js
Last active Dec 15, 2019
Sekme değişince sayfa başlığını değiştirme (jQuery).
View sekme.js
<script type="text/javascript">
var title = document.title;
var alttitle = "Buraya gelir misin lütfen";
window.onblur = function () { document.title = alttitle; };
window.onfocus = function () { document.title = title; };
</script>
You can’t perform that action at this time.