Skip to content

Instantly share code, notes, and snippets.

@osbulbul
osbulbul / main.js
Last active February 2, 2022 16:10
//Lib
import Phaser from "phaser";
//Scenes
import playGame from "./playGame";
//Find the perfect ratio
let width = 720;
let height = 1280;
let perfectRatio = width / height;
@osbulbul
osbulbul / posts-search-replace.php
Created November 24, 2018 11:45
This is plugin that helps you to search and replace any post content. Put this file to wp-content/mu-plugins folder and edit as you wish. Refresh the page and delete file after you see "success" on page.
<?php
/*
Plugin Name: Posts Search Replace
Description: This plugin helps you to search and replace any post content.
Version: 0.1.0
Author: Oz
*/
$post_type = "page"; //use page or post or any post type you created
$filter_type = "include"; //use exclude or include
@osbulbul
osbulbul / BatteryManagerDemo.js
Last active December 2, 2017 23:49
BatteryManager Example
navigator.getBattery().then(function(battery){
function currentBatteryInfo(){
console.log("Battery charging: "+battery.charging);
console.log("Remaining time to fully charge: "+battery.chargingTime);
console.log("Remaining time to discharge: "+battery.dischargingTime);
console.log("Battery level: "+battery.level*100+"%");
}
currentBatteryInfo();
battery.addEventListener('chargingchange', function(){
@osbulbul
osbulbul / gist:4745060
Last active December 2, 2017 23:51
[Placeholder Example] English : After you load your jquery file paste this code in to your scripts file and you can use with $(".clear").clearAll(); ---- and the new function clear all inputs which have clear class for you. Also if users leave blank your inputs function automatically give the first value.|||||||||||||||||||||||Turkish : Jquery d…
$.fn.clearAll = function() {
this.each(function(){
var $this = $(this);
var resultText = '';
var oldText = $this.val();
$this.on('focus',function(){
resultText = ($this.val() === oldText) ? '' : $this.val();
$this.val(resultText);
});