Skip to content

Instantly share code, notes, and snippets.

View humoyun's full-sized avatar
:atom:
Always Eager

Humoyun humoyun

:atom:
Always Eager
View GitHub Profile
@humoyun
humoyun / dom-traversal-with-generators.js
Created May 12, 2022 05:48
JavaScriptda ES6 iterator va generatorlar bilan ishlashga misollar
// DOM traversal
const parent = document.createElement("div");
parent.innerHTML = `
<div id="subTree">
<form>
<input type="text"/>
</form>
<p>Paragraph</p>
<span>Span</span>
</div>
@humoyun
humoyun / frontend-ws-connection.ts
Created May 6, 2021 00:43 — forked from jsdevtom/frontend-ws-connection.ts
kubernetes-ingress websockets with nodejs
export const ws = webSocket<WebsocketMessage>(`wss://${location.hostname}:${location.protocol === 'https:' ? 443 : 80}/ws/`);
export const wsObserver = ws
.pipe(
retryWhen(errors =>
errors.pipe(
delay(1000)
)
)
);
@humoyun
humoyun / doSegmentsIntersect.js
Created May 2, 2021 04:13 — forked from lengstrom/doSegmentsIntersect.js
Algorithm for checking whether two line segments intersect, written in Javascript.
function intersect(x1, y1, x2, y2, x3, y3, x4, y4){
var a1, a2, b1, b2, c1, c2;
var r1, r2 , r3, r4;
var denom, offset, num;
// Compute a1, b1, c1, where line joining points 1 and 2
// is "a1 x + b1 y + c1 = 0".
a1 = y2 - y1;
b1 = x1 - x2;
c1 = (x2 * y1) - (x1 * y2);
@humoyun
humoyun / ffmpeg.md
Created January 6, 2020 00:56 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@humoyun
humoyun / docker-help.md
Created October 12, 2019 13:04 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@humoyun
humoyun / SCSS.md
Created August 15, 2019 04:50 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@humoyun
humoyun / gist:9495abdf5c1b906b30ddd6528e3161e5
Created January 16, 2018 04:59 — forked from ichord/gist:9808444
demo of using pdf.js to extract pages to images
<script src="http://cdnjs.cloudflare.com/ajax/libs/processing.js/1.4.1/processing-api.min.js"></script><html>
<!--
Created using jsbin.com
Source can be edited via http://jsbin.com/pdfjs-helloworld-v2/8598/edit
-->
<body>
<canvas id="the-canvas" style="border:1px solid black"></canvas>
<input id='pdf' type='file'/>
<!-- Use latest PDF.js build from Github -->
@humoyun
humoyun / README.md
Created January 13, 2018 13:29 — forked from joyrexus/README.md
Node.js streams demystified

A quick overview of the node.js streams interface with basic examples.

This is based on @brycebaril's presentation, Node.js Streams2 Demystified

Overview

Streams are a first-class construct in Node.js for handling data.

Think of them as as lazy evaluation applied to data.

@humoyun
humoyun / tuning_storm_trident.asciidoc
Last active August 29, 2015 14:26 — forked from mrflip/tuning_storm_trident.asciidoc
Notes on Storm+Trident tuning

Tuning Storm+Trident

Tuning a dataflow system is easy:

The First Rule of Dataflow Tuning:
* Ensure each stage is always ready to accept records, and
* Deliver each processed record promptly to its destination