Skip to content

Instantly share code, notes, and snippets.

View turbobabr's full-sized avatar
💭
¯\_(ツ)_/¯

Andrey Shakhmin turbobabr

💭
¯\_(ツ)_/¯
View GitHub Profile
@kargeor
kargeor / scripts.js
Created March 14, 2021 03:40
EasyEDA add wires for all pins
function getRandomId() {
return "gge" + Math.round(Math.random() * 10000000);
}
const ids = api('getSelectedIds');
const result = api('getSource', {type:'json'});
function addWire(x1, y1, x2, y2) {
gId = getRandomId();
result.wire[gId] = {
@shospodarets
shospodarets / Chrome headless Puppeteer- capture DOM element screenshot using
Last active July 29, 2024 05:58
Chrome headless Puppeteer- capture DOM element screenshot using
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Adjustments particular to this page to ensure we hit desktop breakpoint.
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1});
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'});
@aharshac
aharshac / Fetch URL title - Node.js
Last active February 25, 2021 06:47
Node.js snippet to fetch URL title
var request = require('request');
var cheerio = require('cheerio');
function fetchTitle(url, onComplete = null) {
request(url, function (error, response, body) {
var output = url; // default to URL
if (!error && response.statusCode === 200) {
var $ = cheerio.load(body);
console.log(`URL = ${url}`);
@zmts
zmts / tokens.md
Last active November 19, 2024 17:55
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@koenbok
koenbok / mac-tweaks.md
Last active April 23, 2022 22:37
My Favorite Mac Tweaks

Skip verifying disk images

defaults write com.apple.frameworks.diskimages skip-verify true

Always hide the Desktop

defaults write com.apple.finder CreateDesktop false; killall Finder

Make terminal logins fast

touch ~/.hushlogin

Disable most animations

@sam-artuso
sam-artuso / setting-up-babel-nodemon.md
Last active November 3, 2023 08:52
Setting up Babel and nodemon

Setting up Babel and nodemon

Inital set-up

Set up project:

mkdir project
cd project
npm init -y
@Qquanwei
Qquanwei / Koa video stream server
Last active November 26, 2018 01:21
video stream server
"use strict"
let koa = require('koa');
let Router = require('koa-router');
let fs = require('fs');
let assert = require('http-assert');
let sscanf = require('scanf').sscanf;
let app = new koa();
let router = new Router();
@JeOam
JeOam / Animation.md
Last active November 20, 2024 07:54
iOS Core Animation: Advanced Techniques, Part 1: The Layer Beneath

Author: https://www.cyanhall.com/

1. The Layer Tree

Core Animation's original name is Layer Kit

Core Animation is a compositing engine; its job is to compose different pieces of visual content on the screen, and to do so as fast as possible. The content in question is divided into individual layers stored in a hierarchy known as the layer tree. This tree forms the underpinning for all of UIKit, and for everything that you see on the screen in an iOS application.

In UIView, tasks such as rendering, layout and animation are all managed by a Core Animation class called CALayer. The only major feature of UIView that isn’t handled by CALayer is user interaction.

There are four hierarchies, each performing a different role:

Screencapture and animated gifs

I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).

Capturing (Easy)

  1. Launch quicktime player
  2. do Screen recording

screen shot 2014-10-22 at 11 16 23 am

@staltz
staltz / introrx.md
Last active November 20, 2024 15:03
The introduction to Reactive Programming you've been missing