Skip to content

Instantly share code, notes, and snippets.

Avatar

Vasily Asakasinsky asakasinsky

View GitHub Profile
@asakasinsky
asakasinsky / Apple_mobile_device_types.txt
Created Oct 22, 2021 — forked from adamawolf/Apple_mobile_device_types.txt
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
View Apple_mobile_device_types.txt
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@asakasinsky
asakasinsky / what-forces-layout.md
Created Oct 22, 2021 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
View Why is SELECT * considered harmful?.md

There are really three major reasons:

  • Inefficiency in moving data to the consumer. When you SELECT *, you're often retrieving more columns from the database than your application really needs to function. This causes more data to move from the database server to the client, slowing access and increasing load on your machines, as well as taking more time to travel across the network. This is especially true when someone adds new columns to underlying tables that didn't exist and weren't needed when the original consumers coded their data access.
  • Indexing issues. Consider a scenario where you want to tune a query to a high level of performance. If you were to use *, and it returned more columns than you actually needed, the server would often have to perform more expensive methods to retrieve your data than it otherwise might. For example, you wouldn't be able to create an index which simply covered the columns in your SELECT list, and even if you did (including all columns [shudder]),
@asakasinsky
asakasinsky / ID.js
Created Sep 17, 2019 — forked from gordonbrander/ID.js
ID - a unique ID/name generator for JavaScript
View ID.js
// Generate unique IDs for use as pseudo-private/protected names.
// Similar in concept to
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>.
//
// The goals of this function are twofold:
//
// * Provide a way to generate a string guaranteed to be unique when compared
// to other strings generated by this function.
// * Make the string complex enough that it is highly unlikely to be
// accidentally duplicated by hand (this is key if you're using `ID`
View добавление альтернативных версий php для консоли, установленных ispmanager
update-alternatives --install /usr/bin/php php /opt/php72/bin/php 20
update-alternatives --install /usr/bin/phpize phpize /opt/php72/bin/phpize 20
update-alternatives --install /usr/bin/pear pear /opt/php72/bin/pear 20
update-alternatives --install /usr/bin/peardev peardev /opt/php72/bin/peardev 20
update-alternatives --install /usr/bin/pecl pecl /opt/php72/bin/pecl 20
update-alternatives --install /usr/bin/phar phar /opt/php72/bin/phar 20
update-alternatives --install /usr/bin/phar.phar phar.phar /opt/php72/bin/phar.phar 20
update-alternatives --install /usr/bin/php-cgi php-cgi /opt/php72/bin/php-cgi 20
update-alternatives --install /usr/bin/php-config php-config /opt/php72/bin/php-config 20
update-alternatives --install /usr/bin/phpdbg phpdbg /opt/php72/bin/phpdbg 20
@asakasinsky
asakasinsky / downloadString.js
Created Jan 23, 2018 — forked from danallison/downloadString.js
download string as text file
View downloadString.js
function downloadString(text, fileType, fileName) {
var blob = new Blob([text], { type: fileType });
var a = document.createElement('a');
a.download = fileName;
a.href = URL.createObjectURL(blob);
a.dataset.downloadurl = [fileType, a.download, a.href].join(':');
a.style.display = "none";
document.body.appendChild(a);
a.click();
@asakasinsky
asakasinsky / elasticsearch-bootstrap-data-node.sh
Created Jan 17, 2018 — forked from ruanbekker/elasticsearch-bootstrap-data-node.sh
Bootstrap Elasticsearch Data Node on Ubuntu 16.04
View elasticsearch-bootstrap-data-node.sh
#!/bin/bash
apt update && apt upgrade -y
apt install software-properties-common python-software-properties apt-transport-https -y
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list
add-apt-repository ppa:webupd8team/java -y
apt update
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections
apt install oracle-java8-installer -y
apt install elasticsearch -y
@asakasinsky
asakasinsky / tailc
Created Jan 11, 2018 — forked from liufuyang/tailc
Color output of linux tail command
View tailc
#!/bin/bash
# save this file as tailc then
# run as: $ tailc logs/supplier-matching-worker.log Words_to_highlight
file=$1
if [[ -n "$2" ]]; then
color='
// {print "\033[37m" $0 "\033[39m"}
/(WARN|WARNING)/ {print "\033[1;33m" $0 "\033[0m"}
/(ERROR|CRIT)/ {print "\033[1;31m" $0 "\033[0m"}
View Queue.php
<?php
namespace Lib;
use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Exception\AMQPTimeoutException;
use PhpAmqpLib\Message\AMQPMessage;
/**
* Class Queue
View check-dn-reg.sh
#!/bin/bash
# Если параметр не указан, выводим подсказку и завершаем работу
if [ "$1" == "" ]
then
cat << EOF
Script that monitors how many days left until domain registration ends.
Usage: $(basename $0) domain.name