Skip to content

Instantly share code, notes, and snippets.

Avatar
👷‍♂️
looking for a job

Rinat Valiullov RinatValiullov

👷‍♂️
looking for a job
View GitHub Profile
@Jack-Works
Jack-Works / 2018.js
Last active Jul 13, 2021
cRAzY eSnEXt (*all* proposals mixed in)
View 2018.js
#! Aaaaaaaaaaa this is JS!!!
// https://github.com/tc39/proposal-hashbang
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!!
// Created at Nov 23, 2018
for await(const x of (new A // https://github.com/tc39/proposal-pipeline-operator
|> do { // https://github.com/tc39/proposal-do-expressions
case(?) { // https://github.com/tc39/proposal-pattern-matching
when {val}: class {
@vipinrana
vipinrana / timing.js
Last active Nov 27, 2020
measuring different execution time in node js
View timing.js
const {performance} = require('perf_hooks');
// using hrtime API
const hrBefore = process.hrtime();
setTimeout(function () {
const hrAfter = process.hrtime(hrBefore);
console.log(`Using hrtime ${hrAfter[0] * 1e3 + hrAfter[1] / 1e6}ms`);
@zerkalica
zerkalica / readme.md
Last active Jun 26, 2021
Заметки о tsconfig
View readme.md

Признаки хорошо настроенного tsconfig

Все нижеперечисленное справедливо в основном для монорепы. В проектах, где используются алиасы в импортах между либами и все зависимости в инклудах, алгоритмы упрощаются и кол-во проблем должно быть меньше.

Надо проверять работу и в vscode и в webstorm, т.к. у последнего, поверх алгоритма tsserver, накладываются свои алгоритмы автоимпортов модулей. То, что работает в webstorm, может не работать в других ide, которые полагаются только на tsserver.

tsconfig считается настроенным, если:

  1. Проходит сборка через tsc --build для либ и webpack для приложух
  2. Чекаются типы в ide и tsc --noEmit, в том числе, в файлах, которые не попадают в сборку: тесты, storybook-файлы
@graninas
graninas / What_killed_Haskell_could_kill_Rust.md
Last active Oct 24, 2021
What killed Haskell, could kill Rust, too
View What_killed_Haskell_could_kill_Rust.md

At the beginning of 2030, I found this essay in my archives. From what I know today, I think it was very insightful at the moment of writing. And I feel it should be published because it can teach us, Rust developers, how to prevent that sad story from happening again.


What killed Haskell, could kill Rust, too

What killed Haskell, could kill Rust, too. Why would I even mention Haskell in this context? Well, Haskell and Rust are deeply related. Not because Rust is Haskell without HKTs. (Some of you know what that means, and the rest of you will wonder for a very long time). Much of the style of Rust is similar in many ways to the style of Haskell. In some sense Rust is a reincarnation of Haskell, with a little bit of C-ish like syntax, a very small amount.

Is Haskell dead?

@Nooshu
Nooshu / test-page-script.js
Created Feb 23, 2020
Simple sample script to test the font load modificaion technique
View test-page-script.js
// Test Page: https://keen-northcutt-3190bd.netlify.com/standard-load.html
// Paste below into the WPT Inject Script textarea.
(function(){
var montserratBold = new FontFace('montserratbold_italic', 'url(fonts/montserrat-bolditalic-webfont.woff2)', {
display: 'swap', // test the page using 'swap'
weight: '700'
});
document.fonts.add(montserratBold);
@Nooshu
Nooshu / simplified-wpt-font-injection.js
Created Feb 23, 2020
Simplified script for injecting fonts into WebPageTest
View simplified-wpt-font-injection.js
(function(){
// this will trigger a font load
var customFont1 = new FontFace('custom font name', 'url([FONT_URL_HERE])', {
display: 'block', // display setting to test here
weight: '700' // font-weight
// other font properties here
});
// IMPORTANT: add the font to the document
document.fonts.add(customFont1);
@Nooshu
Nooshu / wpt-font-injection.js
Created Feb 20, 2020
Modify `font-display` settings via WPT script injection
View wpt-font-injection.js
(function(){
// create our custom link tag for the stylesheet
var url = "https://www.example.com/static/app.css"; // IMPORTANT: this is the CSS that contains your @font-face rules
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.type = "text/css";
link.rel = "stylesheet"
link.href = url;
// append the stylesheet to the head
View regexp-global-sticky.md

Summary: .global (/g) and .sticky (/y)

/g /y /yg
.exec() at .lI or later at .lI same as /y
.test() at .lI or later at .lI same as /y
.replace() ignores & resets .lI at .lI /g w/o gaps
.replaceAll() ignores .lI TypeError /g w/o gaps
.search() no effect no effect no effect
.match() Array of group 0 captures like .exec() /g w/o gaps
View coc-settings.json
{
"suggest.noselect": false,
"coc.preferences.formatOnSaveFiletypes": [
"javascript",
"typescript",
"typescriptreact",
"json",
"javascriptreact",
"typescript.tsx",
"graphql"
View init.vim
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree'
"Plug 'tsony-tsonev/nerdtree-git-plugin'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter'