Skip to content

Instantly share code, notes, and snippets.

View qant's full-sized avatar
💫
Permanent study state

Anton qant

💫
Permanent study state
  • lusa realty, lusa legal, banisio
  • Испания
  • X @antseme
View GitHub Profile
@qant
qant / taxonomy-breadcrumbs.php
Created January 26, 2018 17:50
WordPress custom taxonomy breadcrumbs based on deepest term.
<?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 ) {
@qant
qant / fetchExamples.js
Created January 7, 2020 08:33 — forked from Remzi1993/fetchExamples.js
Examples of using native fetch
// 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 / eventLoop.js
Created February 2, 2020 10:17
Event loop javascript order
//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 / playwright-iphone11pro.js
Created May 12, 2020 15:16
Check url on iphone 11 pro with playwright (like puppeteer) in 3 browser
//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 / vanilla-js-cheatsheet.md
Created May 16, 2020 09:09 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
@qant
qant / example.txt
Created May 21, 2020 11:00
Translate text with google api for free
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 / docker.md
Created March 5, 2021 11:21 — forked from JacobFierro/docker.md
Docker Cheatsheet

Docker Cheatsheet

Docker info:

docker info

Containers

List Images:

@qant
qant / gist:01dea07fa9847c292225e57176c35712
Created March 7, 2021 12:23
Docker mysql how to import big sql dump (close to 1 gb)
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 / gulp-image-compressor-page-peed-google.txt
Created March 9, 2021 13:39
Gulp image compression for Page Speed of Google, 37% of compression aprox.
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 / google_translate.html
Created April 1, 2021 09:53 — forked from carolineschnapp/google_translate.html
Google Translate Embed Code
<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>