Skip to content

Instantly share code, notes, and snippets.

View alxmal's full-sized avatar

Alexandr Malafeev alxmal

View GitHub Profile
@alxmal
alxmal / util-elastic-collision.js
Created October 7, 2017 16:35 — forked from christopher4lis/util-elastic-collision.js
A set of utility functions used to reproduce the effect of elastic collision within HTML5 canvas. Used in the Chris Courses tutorial video on collision detection: https://www.youtube.com/watch?v=789weryntzM
/**
* Rotates coordinate system for velocities
*
* Takes velocities and alters them as if the coordinate system they're on was rotated
*
* @param Object | velocity | The velocity of an individual particle
* @param Float | angle | The angle of collision between two objects in radians
* @return Object | The altered x and y velocities after the coordinate system has been rotated
*/
@alxmal
alxmal / _mixins.styl
Created June 22, 2018 10:17 — forked from dmitrykuznetsovdev/_mixins.styl
mixins.stylus
// Display:
// appearance
// box-align
// box-flex
// box-sizing
// box-orient
// box-pack
// display-box
// overflow-sroll
// user-select
@alxmal
alxmal / MANUAL.md
Created August 27, 2018 13:06 — forked from s-lyn/MANUAL.md
Deploy nodejs app with gitlab.com and pm2

Deploy nodejs app with gitlab.com and pm2

This manual is about setting up an automatic deploy workflow using nodejs, PM2, nginx and GitLab CI. It is tested on:

  • Target server: Ubuntu 16.04 x64. This is suitable for Ubuntu 14.x.
  • Windows 10 on my PC to work.
@alxmal
alxmal / media-query.css
Created January 15, 2019 12:29 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@alxmal
alxmal / GLSL-Noise.md
Created December 5, 2023 10:05 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@alxmal
alxmal / list-of-curl-options.txt
Created December 6, 2023 11:02 — forked from eneko/list-of-curl-options.txt
List of `curl` options
$ curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
@alxmal
alxmal / magic_jq_task.sh
Created December 6, 2023 19:58 — forked from dishbreak/magic_jq_task.sh
Easy way in Bash to check that a binary is installed.
#!/bin/bash
# Exit on the first command that returns a nonzero code.
set -e
# Function that checks if a given executable is on the path. If it isn't, prints an install message and exits.
# Usage: check_binary EXECUTABLE_NAME INSTALL_MESSAGE
check_binary() {
if ! which "$1" > /dev/null; then
# Using a subshell to redirect output to stderr. It's cleaner this way and will play nice with other redirects.
@alxmal
alxmal / particles.html
Created January 8, 2024 10:55 — forked from laurent-h/particles.html
Particles
<!doctype html>
<html lang="en">
<head>
<title>Particles</title>
<meta charset="utf-8">
<meta name="author" content="Laurent Houdard | cables.and.pixels">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<style>
body { margin: 0; overflow: hidden; }
@alxmal
alxmal / esm-package.md
Created April 16, 2024 10:43 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@alxmal
alxmal / nginx.service
Created September 19, 2024 20:24 — forked from clemensg/nginx.service
Example nginx service file for systemd
[Unit]
Description=NGINX HTTP and reverse proxy server
After=syslog.target network.target nss-lookup.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/bin/kill -s HUP $MAINPID