CSS For Fast Scroll – No Lags!

Pure CSS (no JavaScript!) tricks to allow you a faster, more reactive page.

Lags while scrolling native pages
are caused by an overly complex styles (usually “zero css” or “normalize css”)
overriding the proper definitions.

Continue reading

Solved: CMD – Comma And Apostrophe In File Name

working with com.whatsapp_2.17.35' 8-452027_minAPI15(armeabi,armeabi-v7a,mips,x86)(nodpi)_apkmirror.com.apk,
the %1, %~1 tries to parse a list of arguments
and will give you: com.whatsapp_2.17.35' 8-452027_minAPI15(armeabi.

%~s1 will fail too.

A workaround:
gulp the entire thing,
and re-parse content into short-path for easier usage.

@echo off
::                              enable Unicode support for path/file-name.
chcp 65001 2>nul >nul

::                              single arg - workaround weird file-name.
set "ARG=%*"
for /f %%a in ("%ARG%") do ( set 'ARG=%%~fsa' )

pure CMD:
the code above will generate a fully-qualified,
short (8.3-DOS like) path.

if you do need to pass more than one argument,
this is not the solution for you.

– – – – – –

The above code does not always works
since it will turn off any tries to parse single argument from the string,

Passing %* to other programs as an argument will always work,
but built-in handling of file-names, with apostrophes will still fail,
due to “by design” issues in CMD (wrapping phrases uses apostrophes..)

instead, try passing %* to GetShortPathName.exe from github.com/eladkarako/GetShortPathName,
with the additional processing allowing empty-strings/empty-character (\0) and Windows API.
it will return a short 8.3 version of the path (relative or full),
if you want a fully qualified path try using GetFullPathName.exe from github.com/eladkarako/GetFullPathName.

You can use your choice of implementations, that simple one is written in VB6.

JavaScript Snippet – A Human-Readable Memory-Formatter, Add Commas To A Number By Regular-Expression

function human_readable_bytes_size(bytes, decimals, sap) {
  decimals = "number" === typeof decimals ? decimals : 2;
  sap = "string" === typeof sap ? sap : "";

  var 
    size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
  , factor = Math.floor(  (String(bytes).length - 1) / 3  )
  ;
  
  bytes = bytes / Math.pow(1024, factor);  //calc
  bytes = Math.floor(bytes * Math.pow(10, decimals)) / Math.pow(10, decimals);  //round digits
  
   
  return String(bytes) + sap + size[factor];
}



human_readable_bytes_size(29)
//"29B"
human_readable_bytes_size(29000000000000000)
//"25.75PB"
human_readable_bytes_size(2900000000000)
//"2.63TB"
human_readable_bytes_size(290000000000)
//"270.08GB"
human_readable_bytes_size(290000000000,5)
//"270.08354GB"
human_readable_bytes_size(290000000000,5,"---")
//"270.08354---GB"

also available on GitHub: https://github.com/eladkarako/javascript_human_readable_bytes_size

Would you like the PHP version? – http://icompile.eladkarako.com/php-snippet-a-human-readable-memory-formatter-add-commas-to-a-number-by-regular-expression/


This is a variation with comma-separation (only for the integer part since the fraction part looks weird w/ commas..)

function human_readable_bytes_size(bytes, digits, sap, is_comma_sap) {  "use strict";
  digits       = "number"  === typeof digits        ? digits         :  2;
  sap          = "string"  === typeof sap           ? sap            : "";
  is_comma_sap = "boolean" === typeof is_comma_sap  ? is_comma_sap   : false;

  var  size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
     , factor = Math.floor(  (String(bytes).length - 1) / 3  )
     ;

  bytes = bytes / Math.pow(1024, factor);  //calc
  bytes = Math.floor(bytes * Math.pow(10, digits)) / Math.pow(10, digits);  //round digits
  
  if(true === is_comma_sap){
    bytes = String(bytes).split(".");
    bytes[0] = bytes[0].replace(/(\d)(?=(\d{3})+$)/g, "$1,");
    bytes = bytes.join(".");
  }

  return String(bytes) + sap + size[factor];
}

since it is very rare (actually improbable) to use the comma-feature when measuring to the largest scale available,
– In my project https://github.com/eladkarako/any2base64 I’m using a slightly different variation that actually ‘reduce a scale by one’ meaning, instead of using 1GB it will use 1024MB (or 1000-MiB..
* [1] [2])

It works nicely, and sometimes helps to comprehend byte sizes more clearly… Ahhh.. human perspective! ;] ;]


Update:

Here is another variation:
1. it breaks with an error, which is useful for simpler to use within try/catch
without need to pre-check the input is valid.
2. it allows a full/long description.

function human_readable_bytes_size(bytes, decimals, sap, is_desc_short) {
  bytes          = Number(bytes);                                              //normalize input.
  decimals       = "number"  === typeof decimals      ? decimals      : 2;     //
  sap            = "string"  === typeof sap           ? sap           : "";    //
  is_desc_short  = "boolean" === typeof is_desc_short ? is_desc_short : true;  //

  if(true === /NaN/i.test(String(bytes)))                         //handle invalid input.
    throw new Error("\"bytes\" Input-Argument Is NOT A Number.");

  var factor     = Math.floor(  (String(bytes).length - 1) / 3  )
     ,desc_short = ['B',     'kB',        'MB',        'GB',        'TB',        'PB',        'EB',       'ZB',         'YB']
     ,desc_long  = ['Bytes', 'KiloBytes', 'MegaBytes', 'GigaBytes', 'TeraBytes', 'PetaBytes', 'ExaBytes', 'ZettaBytes', 'YottaBytes']
     ;

  bytes = bytes / Math.pow(1024, factor);  //calc
  bytes = Math.floor(bytes * Math.pow(10, decimals)) / Math.pow(10, decimals);  //round digits

  return  String(bytes)
        + sap
        + (true === is_desc_short ? desc_short[factor] : desc_long[factor])
        ;
}

and using it with:

console.log(
  human_readable_bytes_size(10000000000000,3," ",false)
);

//will give you "9.095 TeraBytes"

and

human_readable_bytes_size("a10000000000000",3," ",false)

//will give you something like...
//Uncaught Error: "bytes" Input-Argument Is NOT A Number.

CrossDomain.xml And ClientAccessPolicy.xml – Extremely Permissive

CrossDomain.xml

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <site-control permitted-cross-domain-policies="all"/>
  <allow-access-from domain="*" to-ports="*" secure="false"/>
  <allow-http-request-headers-from domain="*" headers="*" secure="false"/>
</cross-domain-policy>

ClientAccessPolicy.xml

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

Some notes:
– Now days only Flash, Flex and Silverlight have any use for it.
encoding="utf-8", encoding="utf8", encoding="ISO-8859-1" or encoding="US-ASCII" doesn’t really matter. You should probabbly only use ASCII encoded files (4-bit).
– Serve your file with media-type (mimetype) HTTP header of Content-Type: text/x-cross-domain-policy,
(but text/plain, text/xml, application/xml or application/xhtml+xml would probably work too…)
– If you want to place those XML files anywhere- not only the root of the domain, but sub-domain or any path/sub-directory, you should make-sure your server sends X-Permitted-Cross-Domain-Policies HTTP header, with the value all, you only need to send it with the index and the xml files,
but you can send it with all of the resources using Header set X-Permitted-Cross-Domain-Policies "all" (APACHE/.htaccess) which may be more easy.

Alternative policy file-schemas
Generic DTD – http://www.adobe.com/xml/dtds/cross-domain-policy.dtd
Generic XSD – http://www.adobe.com/xml/schemas/PolicyFile.xsd
HTTP XSD – http://www.adobe.com/xml/schemas/PolicyFileHttp.xsd
HTTPS XSD – http://www.adobe.com/xml/schemas/PolicyFileHttps.xsd
FTP XSD – http://www.adobe.com/xml/schemas/PolicyFileFtp.xsd
Socket XSD – http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd


For best results you can add your server some permissive HTTP CORS headers for a more modern, HTML5 permissive resource access.

Segoe-UI For The Web From Skype

Install Skype,
once done look for Skype.msi around your PC. Either %TEMP% or %ProgramData%\Skype\{ ...a long string of characters... } would be most likely to have it, download 7-Zip and open Skype.msi,
look for Product.cab (open it) and login.cab (open it too),
select all of the content, drag&drop it to your desktop.

Sometimes you’ll find the login.cab‘s content has already extracted to %UserProfile%\AppData\Local\Skype\Apps\login\ or %LocalAppData%\Skype\Apps\login\, it is usually happens after you first login to your account, as a cache (but the MSI-extraction method above is better..)

The fonts and css folders is what your want, you can use it for testing and private stuff on your PC. For the web you should probably buy a server-licence from M$…

Here are some screenshots:


Edit:This trick will work for old installation of Skype,
version 74.85.102 from April 2015 will do just fine,
you’ll probably won’t be able to extract the login.cab,
or have a login folder in newer versions.
Try using FileHippo.

also available here: gist.github.com/eladkarako/93b8ca176eb150bd7408f107e9f2d59e.

Android Custom Ringtone

Samsung/HTC/LG all have a configuration entry for setting a custom ringtone,
heck! you can even select a MP3 file out of your External-SDCard!

For ROMs such as AOSP or LineageOS, you will have to walk through some extra steps in-order to add some custom sounds.

Continue reading

Java And UTF-8

When running a java application,
make sure to use -Dfile.encoding=UTF8,
for an 8-bit Unicode-support.

Interaction with standard input/output
requires setting the output’s code-page too.

For Windows run: chcp 65001 before you execute java.

For Unix/Linux: export LC_ALL="en_US.UTF-8".


Here is an example of a Windows batch-file named apktool.cmd,
that wraps around a jar-program named apktool.jar:

@echo off
chcp 65001 2>nul >nul
call java.exe "-d64 -Xverify:none -Duser.language=en -Dfile.encoding=UTF8" -jar "%~dp0\apktool.jar" %*

and here is why it is important to specify the output’s encoding: github.com/iBotPeaches/Apktool/issues/1595


Reader classes are now covered, for Writer classes make sure to explicit use UTF-8.
prefer using OutputStreamWriter (instead of FileWriter which does not support explicit charset):

BufferedWriter out = new BufferedWriter(
                       new OutputStreamWriter(
                         new FileOutputStream(path)
                        ,"UTF-8"
                       )
                     );

Some swear by explicit providing and additional reader/writer set,
so here is that too:

 OutputStreamWriter char_output = new OutputStreamWriter(
     new FileOutputStream("some_output.utf8"),
     Charset.forName("UTF-8").newEncoder() 
 );

 InputStreamReader char_input = new InputStreamReader(
     new FileInputStream("some_input.utf8"),
     Charset.forName("UTF-8").newDecoder() 
 );

which can be specified to handle input-error, which is sometime useful..

CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder();
encoder.onMalformedInput(CodingErrorAction.REPORT);
encoder.onUnmappableCharacter(CodingErrorAction.REPORT);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("jedis.txt"),encoder));

Everything here is considered quite-safe to use,
since 8-bit Unicode (UTF-8) will still allow a fallback to displaying
characters out-of US-ASCII (for example) without the need for adding an
extra BOM bits, unlike UTF-16…

Enjoy!

Modification For default.prop (“from boot”) / build.prop (“from system”)

Done for cm_golden-userdebug 7.1.2 NJH47F db0312e049 release-keys/RR-N-v5.8.4-20170821-golden/rr7.1_golden.nova.20170822.zipNougat 7.1.2 (Resurrection Remix) 20170822, for Samsung Galaxy S3-Mini NFC (I8190N).
The base of the partition-structure is from I8190NXXAMI1_I8190NILOAMJ2_HOME.

It will disable the Security-Enhanced Linux (SELinux)🔗︎ and newly Android 7.0 added dalvik's ART Just-In-Time (JIT)🔗︎, the SELinux will be set to permissive settings, just in-case it will be enabled in the future. The modification will allow mtp and adb access from boot and recovery, so you could access your phone at that stage too, it will resolve some WiFi and cast problems and will allow ADB access without annoying popups (default allowed), knox is disabled too but it won’t do much on the custom ROM (unless you’ll be manually download KNOX to access Samsung-pay, which in this case it could be useful to keep it anyway).

Continue reading

Manually Removing Fonts From Windows, And Refreshing The Windows Font-Cache Storage File

*Close/save any opened documents and programs since this process will require a restart at some point,
plus programs/documents may attach hooks, locking the font-folder and its content.

First, stop the services FontCache3.0.0.0 (Windows Presentation Foundation Font Cache 3.0.0.0) and FontCache (Windows Font Cache Service), and set the their startup-type to “disabled” (just for those few moments…)

Stopping those services, will allow you an easier access to the C:\Windows\Fonts folder,
without those processes constantly accessing the fonts-folder.

next use task-manager to stop explorer.exe processes, which will unhook most of the hooks set to the C:\Windows\Fonts folder (including the files inside it..)

Use unlocker to unlock any of the remaining hooks,
and any way of browsing for files such as FAR-commander or even Locate32, to help you delete any of the font files you want.

It is best to make a backup-copy of the entire folder, including all of the files inside,
just in-case.

Use CCleaner to automatically clean-up any registry-entries for the deleted-font files,

We’re almost done, and now it is time to delete the static-cache files for the font-folder,
so new ones will be created for the new folder-content.

Remove (or rename their extensions to .old) both FNTCACHE.DAT and StaticCache.dat which you’ll find under C:\Windows\System32\ and C:\Windows\SysWOW64\.

*Generating the new cache-files will be done automatically the next time the cache-services will start-up,
but we’ll let them start automatically after the next PC-restart.

Before restarting your PC,
switch the startup-type of both FontCache3.0.0.0 and FontCache to “automatic”,
without actually restarting them by yourself.

Quickly press [WINDOWS]+[R], to open-up the “run” dialog-box,
type restart -f -r -t 00 and press [ENTER].

The next time the computer will be up,
after you’ll log-into your account, the new cache-files will be created.

Ps.
You may even want to refresh the icon-cache for your desktop icons and such,
by running the following command: ie4uinit.exe -ClearIconCache (you’ll have to wait few moments for it to finish). No need to restart afterwards.

The entire process takes few moments but it will speed up your Windows-PC,
especially if you’ll end-up deleting a lot of unneeded font-files.


Here is a way of doing the same process, automatically,
and much faster…

Continue reading

Aria2C Batch File For Quick Download

Copy to following CMD batch-file content into a new file,
and name it aria2download.cmd.

Place the file in the same folder as your aria2c.exe,
make sure it is your system-PATH,

and you can now enter aria2download "http..your-url..."
for a quick file-download to the current folder you are in.

All the important-switches are already set, such as maximum split value, and maximum connections per-server for ultra-fast download and an extra permissive-SSL to allow you to download from secure-servers without certificate verifying and a browser-like useragent and referrer value to generate a compatible download session with servers that often will block download-managers. You can easily personalise the batch-file to include an additional headers, authentications, etc…

Continue reading

JS-Snippet – ReLink URLs For A Quick Download From GitHub

Naturally GitHub is not “THE” place for binary files sharing,
but it used quite often as one (yep! even Google does it..).

It is a great place to put files.. by downloading it,
is not always the fastest way, unless the author had some basic understanding,
and provided you with direct-links to the files, which may be easily put in the README..

Anyway…
this is probably what you’ll normally do..

walking through:

https://github.com/google/fonts/blob/master/apache/opensans/OpenSans-Bold.ttf
https://github.com/google/fonts/blob/master/apache/opensans/OpenSans-Bold.ttf?raw=true
https://raw.githubusercontent.com/google/fonts/master/apache/opensans/OpenSans-Bold.ttf

Since the structure of the direct-download links is known,
at least for now (it did changed few times before..)
you can “fix” the links, to point to the direct URL..

btw.:
not only does it relink, so you can click and download
or copy the links to your download-manager (one by one),
it also generates a links, and outputs it to the console.

amm…naturally it is an ad-hoc solution..

NodeList.prototype.map = Array.prototype.map;

var list = document.querySelectorAll('[href*="/blob/"]').map(function(a){
  var URL = a.href; //js-object .href includes the domain for relative URLs.

  //fix URL to point to the file, directly.
  URL = URL.replace(/http\:/g, "https:")                                                 //make sure it is https:
           .replace(/^https\:\/\/github.com\//gi, "https://raw.githubusercontent.com/")  //this is the current way to download
           .replace(/\/blob\//g, "/")                                                     //remove this too...
           ;
           
  a.setAttribute("href", URL);  //explicitly set "href" attribute.

  //will also help downloading.
  a.setAttribute("download", a.innerText.replace(/[\r\n]/g));
  a.setAttribute("type", "application/octet-stream");

  return URL;
});

console.log(list.join("\n"));

cURL – Latest Chromium Downloader

echo off
::stuff you can modify.
::--------------------------------------------------------------------------------
::                          http|https
set PROTOCOL=http
::                          snapshots|continuous
set BRANCH=snapshots
::                          Android|Arm|Linux|LinuxGit|LinuxGit_x64|Linux_ARM_Cross-Compile|Linux_ChromiumOS|Linux_ChromiumOS_Full|Linux_x64|Mac|MacGit|Win|WinGit|Win_x64|chromium-full-linux-chromeos
set OS=Win_x64
::                          mini_installer.exe|REVISIONS|chrome-win32-syms.zip|chrome-win32.zip|pnacl.zip|content-shell.zip|gcapi.zip|metrics-metadata.zip|remoting-host.msi|remoting-me2me-host-win.zip|devtools_frontend.zip|chrome-linux.zip|changelog.xml|chrome-android.zip
set FILE=mini_installer.exe
::--------------------------------------------------------------------------------


::stuff you should keep as is.
::--------------------------------------------------------------------------------
set URL_LASTCHANGE=%PROTOCOL%://storage.googleapis.com/chromium-browser-%BRANCH%/%OS%/LAST_CHANGE

set COMMAND_CURL_FORVERSION=curl.exe --silent --http2 --ipv4 --anyauth --insecure --location-trusted --ssl-allow-beast --ssl-no-revoke --url "%URL_LASTCHANGE%"

set VERSION=
for /f "tokens=*" %%a in ('call %COMMAND_CURL_FORVERSION% 2^>^&1') do (set VERSION=%%a)
::error handling
if ["%VERSION%"] == [""] ( goto NOVERSION )
set URL_DOWNLOAD=%PROTOCOL%://storage.googleapis.com/chromium-browser-%BRANCH%/%OS%/%VERSION%/%FILE%

echo.
echo Got Latest-Version: ^>%VERSION%^< ^[Branch:%BRANCH%/OS:%OS%^]
::--------------------------------------------------------------------------------


::you should enable one-of-your-prefered downloaders.
::goto DOWNLOAD_CURL
::goto DOWNLOAD_WGET
::goto DOWNLOAD_ORBITDOWNLOADER
goto DOWNLOAD_ARIA2C



::you should not reach here, unless
::you've forgot to enable one of the "downloader lines" (above)...
goto NODOWNLOADER


::--------------------------------------------------------------------------------
:NOVERSION
  echo ERROR: could not get the latest version...
  goto EXIT

:NODOWNLOADER
  echo ERROR: please enable one of the downloader lines..
  goto EXIT


:DOWNLOAD_CURL
  echo Start Download using cURL...
  call curl.exe --verbose --http2 --ipv4 --ignore-content-length ^
                --anyauth --insecure --location-trusted          ^
                --ssl-allow-beast --ssl-no-revoke --tcp-fastopen ^
                --tcp-nodelay --use-ascii --url "%URL_DOWNLOAD%"
  goto EXIT


:DOWNLOAD_WGET
  echo Start Download using wGET...
  call wget.exe --directory-prefix="." --debug --user-agent="Mozilla/5.0 Chrome" --continue ^
                --server-response --no-check-certificate --secure-protocol=auto  "%URL_DOWNLOAD%"
  goto EXIT


:DOWNLOAD_ARIA2C
  echo Start Download using Aria2C...
  call aria2c.exe --allow-overwrite=true         --auto-file-renaming=false         --check-certificate=false        ^
                  --check-integrity=false        --connect-timeout=120              --console-log-level=notice       ^
                  --continue=true                --dir="."                          --disable-ipv6=true              ^
                  --enable-http-keep-alive=true  --enable-http-pipelining=true      --file-allocation=prealloc       ^
                  --http-auth-challenge=false    --human-readable=true              --max-concurrent-downloads=16    ^
                  --max-connection-per-server=16 --max-tries=3                      --min-split-size=1M              ^
                  --retry-wait=1                 --rpc-secure=false                 --split=8                        ^
                  --timeout=120                  --user-agent="Mozilla/5.0 Chrome"  "%URL_DOWNLOAD%"
  goto EXIT


:DOWNLOAD_ORBITDOWNLOADER
  echo Start Download using OrbitDownloader...
  call "C:\Program Files (x86)\Orbitdownloader\orbitdm.exe" "%URL_DOWNLOAD%"
  goto EXIT


:EXIT  
  echo.
  echo Done.
  pause


::--------------------------------------------------------------------------------------------
::--------------------------------------------------------------------------------------------
::
::   - "http"           - http protocol is faster to connect and download with OrbitDownloader and wGet, it also means your PC won't preform certificate exchange with the remote machine.
::   - "snapshots"      - snapshots is newer, "continuous" is more stable (but might be very old).
::   - "OS" and "FILE"  - are what you want to download
::
::
:: snapshots    - newest (unstable) newest code-changes - passed unit-tests + compilation.
:: continuous   - old    (stable)                       - passed unit-tests + compilation + test-suits.
:: ------------------------------------------------------------------------------------------------------
::   branch   |  branch description           |  version-based build
:: ___________|_______________________________|_____________________________________________________________________________________________
::   Win_x64  |  Chromium Installer (64-bit)  |  storage.googleapis.com/chromium-browser-continuous/Win_x64/{version}/mini_installer.exe  
::   Win_x64  |  Chromium Package (64-bit)    |  storage.googleapis.com/chromium-browser-continuous/Win_x64/{version}/chrome-win32.zip    
::   Win      |  Chromium Installer (32-bit)  |  storage.googleapis.com/chromium-browser-continuous/Win/{version}/mini_installer.exe
::   Win      |  Chromium Package (64-bit)    |  storage.googleapis.com/chromium-browser-continuous/Win/{version}/chrome-win32.zip    
::
::
::------------------------------------------------------
::- SCRIPT WAS WRITTEN AND MAINTAINED BY ELAD KARAKO.  -
::- LAST UPDATED: JULY, 2017. FREE TO USE UNDER GNU.   -
::------------------------------------------------------

Download tools..

HTML5 Canvas Clear

function canvas_clear(canvas){      //clear canvas' path and content, reset tranform. return reference to same object.
  var context = canvas.getContext("2d");
  context.beginPath();
  context.setTransform(1, 0, 0, 1, 0, 0);
  context.clearRect(0, 0, canvas.width, canvas.height);
//canvas.width = canvas.width; //don't use!
  return canvas;
};

function canvas_clear_deep(canvas){       //clear canvas' path and content, reset tranform (as before).
  var tmp = canvas.cloneNode(true);       //  + NEW: unhook event-handlers (optional: attribute-events too)
                                          //  + update DOM with fresh-canvas.
                                          //  + clear unused memory.
                                          //  + return reference to fresh-canvas.

  /* //optionally enable this part to also remove inline(attribute)-events.
  NamedNodeMap.prototype.forEach = Array.prototype.forEach;     //optionally unhook inline(""attribute"")-event
  tmp.attributes.forEach(function(attribute){
                           if(false === /^on/i.test(attribute.nodeName)) return;
                           tmp.removeAttribute(attribute.nodeName);
                         });
  */

  tmp = canvas_clear(tmp);
  if(null !== canvas.parentElement){  //replace with fresh-canvas
    canvas.parentElement.replaceChild(tmp, canvas);
  }

  //cleanup
  canvas = canvas_clear(canvas);
  canvas = undefined;

  return tmp;
};

HTMLCanvasElement.prototype.clear      = function(){ return canvas_clear(this);      };
HTMLCanvasElement.prototype.clear_deep = function(){ return canvas_clear_deep(this); };

Also available on this gist: https://gist.github.com/eladkarako/a005225594ade65347e2f5ad4c55d131

And just use canvas.clear() or canvas.clear_deep() :]

Enjoy!

Yet Another Escape To Unicode

Preserve the full-meaning of the string, without encoding or breaking Unicode-pairs.

String.prototype.map                = Array.prototype.map;
String.prototype.to_char_code       = function(){ return (this+"").map(function(c){                return c.charCodeAt(0)                                                  });           };
String.prototype.escape_to_unicode  = function(){ return (this+"").to_char_code().map(function(i){ return "\u005Cu" + ("0000" + i.toString(16).toUpperCase()).substr(-4);  }).join("");  };

//test- run:   "שh🐀".escape_to_unicode();

another variation is using regular-expressing with attention to Unicode, meaning /u,
but it won’t work for you since you, still, might get a Unicode-pair (where you have to run charCodeAt(0) and charCodeAt(1).. etc…). Split by character (I’m using Array.map, but it is the same as using split("").map(...) will work around that, keeping the character whole (meaning not like the Unicode/ASCII-escape trick) but still breaking nicely characters, including breaking Unicode-pairs-
-to quickly get the \u.. equivalent of your string. :]

APKMirror.com Search

https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=YOUR_SEARCH_TERM

for example:
https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=whatsapp
or
https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=youtube
or
https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=swiftkey


naturally it would have been better if the website owners were embedding
the following script schema:

<script type="application/ld+json">
{
  "@context":           "http://schema.org"
, "@type":              "WebSite"
, "url":                "https://www.apkmirror.com/"
, "name":               "APKMirror - Free APK Downloads"
, "alternateName":      "Download Free Android APKs #APKPLZ"
, "logo":               "https://www.apkmirror.com/wp-content/themes/APKMirror/images/apple-touch-icon-180x180.png"
, "potentialAction": {  "@type": "SearchAction"
                     ,  "target": "https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s={search_term_string}"
                     ,  "query-input": "required name=search_term_string"
                     }
}
</script>

why it is important to a website to have this “thing” in the main index-page?
1. Desktop browsers (Chrome) will add the website with embedded search into the address-bar,
for example, I have (similar) application/ld+json in icompile.eladkarako.com,
which means I could start typing the URL following by SPACE and get a built-in search from within the browser:

2. it will work pretty well with mobile-browsers as well, saving typing and browsing-time to the website-visitor (which is a good thing).

3. it works well with Google search and other spiders, which will build-up a more efficient index/map of the website.

4. it is pretty much “the standard” (or at least a “best practice”) when designing a friendly, browse’able website.


once you’ve visited a website that has the application/ld+json code inside,
it should add it automatically to your website,
but you may also access that section, quite easily for manual editing:


Here are few more links :)
https://developers.google.com/search/docs/data-types/sitelinks-searchbox
https://schema.org/SearchAction
https://github.com/archon810/apkmirror-public/issues/18#issue-231810436

Block Sockets? Ask Me How!

This Little Chrome Extension: https://github.com/eladkarako/Chrome-Extension-Socket-Killer
Acts As A Socket-Firewall, Blocking WebSocket Connections, Even Before Connecting!
As A Bonus, It Also Null’ifies The WebSocket Object-Constructor :]

Blocking websockets, prevents the next-gen. ads from infiltrating your- presumingly ads-protected, browser.

It will also improve your Ad-Blocking extensions, catching most ads, blocking more connections, etc..

Enjoy.

JavaScript Ninja – Crowd Wisdom eBay Enhancements

Making eBay Buying Safer, Using Wisdom Of The Crowd.

Protect Yourself Against:
– Untrustworthy sellers
Those will accept your money but will not send you anything.
– Bad-reputation sellers
without checking out their feedbacks.
– New and inexperienced sellers
without researching their profile.

– Only trust sellers with “a lot of buyers”.
– Avoid items with overpriced shipping.
– Sort by “number of sold items” – in additional to current sorted results.
Continue reading

Stuff You Should Exclude From Your Anti-Virus

It should be perfectly safe to exclude some folders from your anti-virus processing.
Have a look below, my notes/comments should help you understand the generic state-of mind and then you can apply the same reasoning to modify or add other items.

Continue reading