Skip to content

Instantly share code, notes, and snippets.

View barbagrigia's full-sized avatar

Vlad Trukhin barbagrigia

View GitHub Profile
@samselikoff
samselikoff / cloudSettings
Last active January 10, 2024 21:52
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-05-01T19:06:41.818Z","extensionVersion":"v3.4.3"}
<?php
ini_set('pcre.backtrack_limit', '10000000');
$url = 'https://ru.tradingview.com/chart/VIX/veShLNLq-vix/'; // Ссылка на торговую идею trading view
$filename = dirname(__FILE__) . '/candles.json'; // Путь к файлу, в который будут сохранены свечи
$html = file_get_contents($url);
if (empty($html)) {
@sochix
sochix / app.js
Created April 16, 2019 15:48
Proper way to measure request duration in a Node.js + Express application
const app = require('express')()
const getDurationInMilliseconds = (start) => {
const NS_PER_SEC = 1e9
const NS_TO_MS = 1e6
const diff = process.hrtime(start)
return (diff[0] * NS_PER_SEC + diff[1]) / NS_TO_MS
}

Algorithmic layouts

You are looking at the most important, and most abundant thing on the web. You can't see it, unfortunately, because it's very small… aaaaand it's invisible — so having a magnifying glass doesn't really help here. But still.

I'm talking, of course, about U+0020; not to be confused with the band U2, who are just as ubiquitous, but far less useful.

This unicode point, representing the humble space character, is between every word, in every run of text, on every page of the web. And it has a very special characteristic: it's not sticky like glue. If two words are neighbors but there's not enough room for both of them, the space will free the second word to wrap around and start a new line.

Before getting into flexible containers, viewport meta tags, and @media breakpoints this humble character is what makes the web fundamentally 'responsive'. That is: able to change the layout of its content to suit different devices, contexts, and settings. Browser text does this automa

@theKashey
theKashey / Title.js
Created December 26, 2018 05:56
Set document title from react node
class Title extends React.PureComponent {
domNode = document.createElement('div');
// ^ it's not added to the document
componentDidMount() {
this.componentDidUpdate();
}
componentDidUpdate() {
document.title = this.domNode.textContent || ':(';

Unusual Shapes

Ask any of my friends, and they'll tell you I'm a big fan of shapes. Here are some of my all time favorites:

  • The circle
  • The hexagon
  • The triangle
  • The 'play button' (a triangle on its side)
  • The square
  • The fast square (a skewed square)
import * as React from "react";
import * as Vue from "vue/dist/vue";
import VueElement from "./VueElement";
import { PropertyControls, ControlType } from "framer";
// Define type of property
interface Props {
text: string;
}
@deyixtan
deyixtan / sublime_text_patch.md
Last active July 26, 2024 10:35
Sublime Text Patching Guide

Automated Patching

Download slt.py python script (supports multiple build) from this repository.

Usage

python slt.py <"sublime_text file path">


Manual Patching

@mixin spacing($type: 'xl', $property: 'margin-top') {
#{$property}: map-get($margins, $type);
#{$property}: var(--margin-#{$type});
}

Step 1

Create a new directory.

$ mkdir micro-api
$ cd micro-api

Step 2