Skip to content

Instantly share code, notes, and snippets.

🐝
https://twitter.com/freaqbee

Sasha Zmts zmts

🐝
https://twitter.com/freaqbee
Block or report user

Report or block zmts

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zmts
zmts / fingerprint.md
Created Oct 16, 2019
Get browser fingerprint example (fingerprintjs2)
View fingerprint.md

Get browser fingerprint example (fingerprintjs2)

import * as Fingerprint2 from 'fingerprintjs2'

function getFingerprint () {
  return new Promise((resolve, reject) => {
    const options = {
      excludes: {
        plugins: true,
@zmts
zmts / js_type.md
Created Aug 3, 2019
Object type vs Array type. Handle JavaScript types
View js_type.md

Object type vs Array type. Handle JavaScript types

Object.prototype.toString.call(true) // [object Boolean]
Object.prototype.toString.call('hello') // [object String]
Object.prototype.toString.call(10) // [object Number]
Object.prototype.toString.call({}) // [object Object]
Object.prototype.toString.call([]) // [object Array]
Object.prototype.toString.call(null) // [object Null]
Object.prototype.toString.call(undefined) // [object Undefined]
View s3_aws-sdk_digitalocean.md

Configure AWS SDK with Digital Ocean endpoint

const AWS = require('aws-sdk')
const spacesEndpoint = new AWS.Endpoint('nyc3.digitaloceanspaces.com');

const s3 = new AWS.S3({
    endpoint: spacesEndpoint,
    accessKeyId: 'ACCESS_KEY',
    secretAccessKey: 'SECRET_KEY'
@zmts
zmts / postgresql-set-id-seq.sql
Created Apr 25, 2019 — forked from henriquemenezes/postgresql-set-id-seq.sql
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
View postgresql-set-id-seq.sql
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
@zmts
zmts / countries.sql
Last active May 1, 2019 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
View countries.sql
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@zmts
zmts / makeArray.md
Created Apr 2, 2019
Create array with specific size Javascript
View makeArray.md

Create array with specific size Javascript

[  ...Array(10).keys() ] // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
View 1.md

Есть такой закон систем: ни одна сложная система, которая работает, не может быть создана с нуля; все сложные системы, которые работают, «вырастают» из простых систем, которые работают.

https://t.me/ProductsAndStartups/104

@zmts
zmts / Knex_create_table_if_not_exists.md
Created Mar 22, 2019
Knex: create table if not exists
View Knex_create_table_if_not_exists.md

Knex: Create table if not exists

const Knex = require('knex')
const config = require('./config')
const knex = Knex(config.knex)

async function createSchema () {
  const hasTable = await knex.schema.hasTable('videoRequests')
  if (!hasTable) {
View seo_links.md
@zmts
zmts / vue_nginx.md
Last active Mar 11, 2019
Deploy Vue.js on custom route via NGINX
View vue_nginx.md

Deploy Vue.js on custom route via NGINX

Необходимо реализовать такой роутинг через NGINX

  • /a/* (user dashboard, SPA/Vue.js)
  • /* (все кроме /a/* тулит на proxy pass в Nuxt SSR)

Конфиг NGINX'a

map $sent_http_content_type $expires {
    "text/html" epoch;
You can’t perform that action at this time.