Skip to content

Instantly share code, notes, and snippets.

@kakha13
kakha13 / Preventing-Puppeteer-Detection.md
Last active October 17, 2022 23:56 — forked from tegansnyder/Preventing-Puppeteer-Detection.md
Preventing Puppeteer Detection

I’m looking for any tips or tricks for making chrome headless mode less detectable. Here is what I’ve done so far:

Set my args as follows:

const run = (async () => {

    const args = [
        '--no-sandbox',
        '--disable-setuid-sandbox',
        '--disable-infobars',
@kakha13
kakha13 / Modal.vue
Created August 4, 2022 20:52
Nuxt3 Modal
************* inside main page *************
<template>
<div>
<Modal :open="modalOpen" @update:open="newValue => modalOpen = newValue" />
<button @click="openModal = true">Show Modal</button>
</div>
</template>
<script setup>
const modalOpen = ref(false)
@kakha13
kakha13 / ns-block-rotate-phone.js
Created February 12, 2022 00:18
Nativescript block rotate on Phone
if(Device.deviceType == "Phone") {
const activity = Application.android.startActivity;
activity.setRequestedOrientation(android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
}
@kakha13
kakha13 / browser-barcode-reader.js
Last active September 15, 2021 20:24
Read Barcode in browser from image element
var imageEl = document.getElementById("test_image"); // image element
// check compatibility
if (!("BarcodeDetector" in window)) {
console.log("Barcode Detector is not supported by this browser.");
} else {
console.log("Barcode Detector supported!");
// create new detector
var barcodeDetector = new BarcodeDetector(); // enable any supported barcode
@kakha13
kakha13 / nativescript-admob-banner-with-placeholder.md
Last active August 28, 2021 17:46
Nativescript ADMOB Banner with Placeholder

XML:

<Placeholder @creatingView="creatingView" id="bannerView" />

Method:

creatingView(args) { if (global.isIOS) { let bannerView;
@kakha13
kakha13 / nativescrtip-android-statusbar-transparent
Last active April 1, 2021 18:24
Nativescript - Change android statusbar color 100% transparent
const View = android.view.View;
const window = Application.android.startActivity.getWindow();
const decorView = window.getDecorView();
window.clearFlags(android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
window.setStatusBarColor(0x000000);
@kakha13
kakha13 / SMART_BANNER_height
Last active July 16, 2021 23:28
How to get nativescript-plugin-firebase admob SMART_BANNER height
First we are getting screen size and then doing calculations with SMART_BANNER logics
const platform = require("platform") // import this
......
const screenHeightDp =platform.screen.mainScreen.heightPixels / platform.screen.mainScreen.scale; // height divided by scale
const BannerHeight = screenHeightDp > 720 ? 90 : screenHeightDp > 400 ? 50 : 32; // doing calculations as smart banner works
console.log(BannerHeight); // this is our banner height
@kakha13
kakha13 / Delete duplicate rows from table
Created January 23, 2014 13:48
Delete duplicate rows from table, removing duplicate rows
-- BY Kakha Giorgashvili
-- First you are creating new table "new_table" or what you want than choose columns from table where is your duplicate columnes and then GROUP BY this Column
CREATE TABLE new_table as SELECT * FROM arafinansuri GROUP BY tel;
@kakha13
kakha13 / Select Older than 1 day rows
Last active December 28, 2015 23:19
Select from Table row from user that was recorded more than one day ago.
-- BY Kakha Giorgashvili
-- Select Older than 1 day rows
SELECT
*
FROM
column_name
WHERE
USER = '1234'
AND added_time < DATE_ADD(NOW(), INTERVAL - 1 DAY)
@kakha13
kakha13 / Rating System Query
Last active December 28, 2015 23:19
100% cool rating system query for SQL that will give you right result. Score and Timer calculation Rating
-- BY Kakha Giorgashvili (KAKHA13)
-- Rating system query
-- score = Users Score
-- timer = Interval from begining to end
-- 1.8 is gravity what helps query to get 100% right result
SELECT
*,
(`score` - 1) / POWER(`timer`, 1.8) AS rating
FROM