Skip to content

Instantly share code, notes, and snippets.

Avatar
💫
Permanent study state

Anton qant

💫
Permanent study state
View GitHub Profile
View google_translate.html
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
</script>
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
@qant
qant / gulp-image-compressor-page-peed-google.txt
Created Mar 9, 2021
Gulp image compression for Page Speed of Google, 37% of compression aprox.
View gulp-image-compressor-page-peed-google.txt
install node
install npm
put package.json
npm i
create _src/ and dest/ folders
put image files to _src/ folder
then "npx gulp" to run
@qant
qant / gist:01dea07fa9847c292225e57176c35712
Created Mar 7, 2021
Docker mysql how to import big sql dump (close to 1 gb)
View gist:01dea07fa9847c292225e57176c35712
docker ps (for get name of my container like "ant_database_1")
docker exec ant_database_1 sh -c 'exec mysql -D wordpress -uwordpress -pwordpress' < local.sql
* will not work because default max_allowed_packet in mysql configuration so:
docker exec -it ant_database_1 bash -c "echo 'max_allowed_packet = 1G' >> /etc/mysql/mysql.conf.d/mysqld.cnf"
Now it might work.
But to be shure i am prefere the way with copy and manual import inside the container
@qant
qant / docker.md
Created Mar 5, 2021 — forked from JacobFierro/docker.md
Docker Cheatsheet
View docker.md

Docker Cheatsheet

Docker info:

docker info

Containers

List Images:

@qant
qant / example.txt
Created May 21, 2020
Translate text with google api for free
View example.txt
Upload this file to your php app and run like this:
http://localhost/translate-text-google-api-free.php
OR with translating parameters http://localhost/translate-text-google-api-free.php?tl=ru
Also there is limit with 5000 simbols, and the google api can ban your ip if you will abise to much.
@qant
qant / vanilla-js-cheatsheet.md
Created May 16, 2020 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
View vanilla-js-cheatsheet.md
@qant
qant / playwright-iphone11pro.js
Created May 12, 2020
Check url on iphone 11 pro with playwright (like puppeteer) in 3 browser
View playwright-iphone11pro.js
//npm
const playwright = require("playwright");
const vp = { width: 375, height: 812 };
(async () => {
for (const browserType of ["webkit", "chromium", "firefox"]) {
const browser = await playwright[browserType].launch();
const context = await browser.newContext({
devices: ["iPhone 11 Pro"],
@qant
qant / eventLoop.js
Created Feb 2, 2020
Event loop javascript order
View eventLoop.js
//https://developer.mozilla.org/es/docs/Web/JavaScript/EventLoop
//https://www.youtube.com/watch?v=8aGhZQkoFbQ
console.log("1");
console.log("2");
console.log("3");
console.log("4");
console.log("5");
console.log("--------------");
@qant
qant / fetchExamples.js
Created Jan 7, 2020 — forked from Remzi1993/fetchExamples.js
Examples of using native fetch
View fetchExamples.js
// Config / constants
const baseUrl = 'http://localhost:4000' || 'example.herokuapp.com' // or use an environment variable like this: process.env.URL || 'http://localhost:4000'
const JWT = 'Whatever-token'
/*
* Examples of using native fetch
* REST API - CRUD convention (Create/POST, Read/GET, Update/modify/PUT/PATCH, Delete/DELETE)
*
**/
@qant
qant / taxonomy-breadcrumbs.php
Created Jan 26, 2018 — forked from saqibsarwar/cloudSettings
WordPress custom taxonomy breadcrumbs based on deepest term.
View taxonomy-breadcrumbs.php
<?php
if( !function_exists( 'inspiry_get_breadcrumbs_items' ) ) :
/**
* Returns a array of breadcrumbs items
*
* @param $post_id int Post id
* @param $breadcrumbs_taxonomy string Taxonomy name
* @return mixed|void
*/
function inspiry_get_breadcrumbs_items( $post_id, $breadcrumbs_taxonomy ) {