Skip to content

Instantly share code, notes, and snippets.

@focus-at
focus-at / +layout.svelte
Last active March 13, 2023 09:41
svelte navigate with View Transitions API
...
// Импортируем и запускаем
import { usePageTransition } from '$lib/page-transition';
usePageTransition();
...
@focus-at
focus-at / boilerplate.css
Created January 16, 2022 22:03 — forked from cameroooon/boilerplate.css
A CSS boilerplate
/*
=============================================================================
NORMALIZE (using HTML5 Boilerplate)
=============================================================================
*/
/* HTML5 element display
========================================================================== */
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
audio[controls], canvas, video { display: inline-block; *display: inline; *zoom: 1; }
{
"UserInfo": {
"id": "#{USER_ID}",
"email": "#{USER_EMAIL}",
"first_name": "#{USER_FIRST_NAME}",
"last_name": "#{USER_LAST_NAME}",
"name": "#{USER_NAME}",
"picture": "#{USER_PROFILE_PICTURE}",
"roles": {
"#{ROLE_NAME}": "#{ROLE_ID}"
const pMap = require('p-map')
const axios = require('axios')
const https = require('https')
const camelCase = require('camelcase')
const { mapKeys, isPlainObject, trimEnd } = require('lodash')
const TYPE_AUTHOR = 'author'
const TYPE_ATTACHEMENT = 'attachment'
class WordPressSource {
@focus-at
focus-at / background.js
Created December 6, 2021 23:19 — forked from muralikg/background.js
puppeteer screen capture demo. Currently records 10 second video. Change the timeout in background.js with your own logic to stop the recording when necessary. Try with `node export.js`
/* global chrome, MediaRecorder, FileReader */
chrome.runtime.onConnect.addListener(port => {
let recorder = null
port.onMessage.addListener(msg => {
console.log(msg);
switch (msg.type) {
case 'REC_STOP':
console.log('Stopping recording')
if (!port.recorderPlaying || !recorder) {
@focus-at
focus-at / Vector2.js
Created December 5, 2021 23:52 — forked from Dalimil/Vector2.js
Basic Vector2 JavaScript Math Helper Class
function Vector2(x, y) {
this.x = (x === undefined) ? 0 : x;
this.y = (y === undefined) ? 0 : y;
}
Vector2.prototype = {
set: function(x, y) {
this.x = x || 0;
this.y = y || 0;
},
@focus-at
focus-at / nginx-tuning.md
Created December 15, 2019 08:07 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@focus-at
focus-at / pluralize-ru.js
Created July 26, 2019 21:09 — forked from znechai/pluralize-ru.js
JavaScript - Plural forms for russian words
/**
* Plural forms for russian words
* @param {Integer} count quantity for word
* @param {Array} words Array of words. Example: ['депутат', 'депутата', 'депутатов'], ['коментарий', 'коментария', 'комментариев']
* @return {String} Count + plural form for word
*/
function pluralize(count, words) {
var cases = [2, 0, 1, 1, 1, 2];
return count + ' ' + words[ (count % 100 > 4 && count % 100 < 20) ? 2 : cases[ Math.min(count % 10, 5)] ];
}
@focus-at
focus-at / .gitignore
Created June 29, 2019 05:56 — forked from weaver/.gitignore
Express + Formidable, works with bodyParser and sets req.body correctly.
node_modules
// See https://github.com/dialogflow/dialogflow-fulfillment-nodejs
// for Dialogflow fulfillment library docs, samples, and to report issues
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
// Copyright 2017-2018, Google, Inc.