Skip to content

Instantly share code, notes, and snippets.

View mightyaleksey's full-sized avatar
☂️
I'm learning to have fun besides work

Aleksey Litvinov mightyaleksey

☂️
I'm learning to have fun besides work
View GitHub Profile

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@tfry-git
tfry-git / Demo.html
Last active June 15, 2024 12:55
**Fast** javascript pixel accurate collision detection
<html>
<body>
<p>
The actual canvas, where drawing happens. Mouse over to move the green open circle object.
</p>
<canvas id="canvas" width=200 height=200></canvas>
<p id="result">
</p>
<p id="timing">
@standinga
standinga / Swift Playground Audio playing audio files with AVAudioPlayerNode on top of AVPlayer or on top of another AVAudioPlayerNode.swift
Last active October 31, 2023 07:33
Swift Playground Audio playing audio files with AVAudioPlayerNode on top of AVPlayer or on top of another AVAudioPlayerNode
import AVFoundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
class AudioPlayer {
var topAudioFiles: [AVAudioFile] = []
var engine:AVAudioEngine
var backgroundAudioNode: AVAudioPlayerNode
var backgroundAudioFile: AVAudioFile
@maxatwork
maxatwork / Shaders.md
Last active May 11, 2022 02:30
Simple image processing shaders

Примеры можно попробовать в редакторе http://www.kickjs.org/tool/shader_editor/shader_editor.html

Значения uniform задаются на вкладке Uniforms (не забываем жать Update).

Вершинный шейдер

Общий для всех шейдеров:

precision highp float;

Uninstall brew package and dependencies

Remove package's dependencies (does not remove package):

brew deps [FORMULA] | xargs brew remove --ignore-dependencies

Remove package:

@eevee
eevee / perlin.py
Last active February 25, 2025 13:47
Perlin noise in Python
"""Perlin noise implementation."""
# Licensed under ISC
from itertools import product
import math
import random
def smoothstep(t):
"""Smooth curve with a zero derivative at 0 and 1, making it useful for
interpolating.
@stollcri
stollcri / chrome_HSTS_clear.md
Last active January 4, 2024 05:09
Clear 307 HSTS redirects in Google Chrome

To clear 307 HSTS redirects in Google Chrome (if you experimenting with SSL -- you probably wouldn't want to do this for a site that you do not opperate, since it is there to protect you), go to the following URL and delete the site.

chrome://net-internals/#hsts

@istarkov
istarkov / 00 README.md
Last active April 2, 2024 20:18
How to style React components

How to style React components

If you use sass and css-modules and want to restyle some base component without changing its code. (base component already use css-modules and exposes styles property)

I know two way how to do it.

  1. Using composes css-modules operator. Just extend classes you need, then in javascript code combine both styles as {...baseStyle, ...myStyleSimple}
@paulirish
paulirish / what-forces-layout.md
Last active April 28, 2025 06:24
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent