Skip to content

Instantly share code, notes, and snippets.

View znewbiez1001's full-sized avatar
💭
I'm looking for Remote jobs (Full-stack Node / Elixir / Golang / Vue...)

znewbiez1001

💭
I'm looking for Remote jobs (Full-stack Node / Elixir / Golang / Vue...)
View GitHub Profile
@xorvo
xorvo / elixir-hls-server-demo.livemd
Last active April 11, 2024 17:23
Elixir HLS Server Example

HLS Server Demo - My TV Station

Mix.install([
  {:plug_cowboy, "~> 2.6"}
])
defmodule Benchmarks do
@warmup 0.05
@time 0.05
@memory_time 0.5
@parallel 1
@inputs (
(0..20)
|> Enum.map(fn size -> {to_string(size), (1..size) |> Enum.shuffle |> List.to_tuple} end)
)
@RobertAKARobin
RobertAKARobin / bounce.scss
Created July 6, 2021 08:01
SCSS bounce mixin
@use 'sass:map';
@use 'sass:math';
@function roundTo($num, $places: 2) {
$factor: 100 * $places;
@return math.round($num * $factor) / $factor;
}
@mixin bounce(
$acceleration: null,
@ef4
ef4 / examples.md
Last active May 23, 2024 04:31
Webpack 5 Node Polyfills Upgrade Cheatsheet

Webpack 5 Node Polyfills Upgrade Cheatsheet

Webpack 4 automatically polyfilled many Node APIs in the browser. This was not a great system, because it could lead to surprisingly giant libraries getting pulled into your app by accident, and it gave you no control over the exact versions of the polyfills you were using.

So Webpack 5 removed this functionality. That means you need to make changes if you were relying on those polyfills. This is a quick reference for how to replace the most common patterns.

List of polyfill packages that were used in webpack 4

For each automatically-polyfilled node package name on the left, this shows the name of the NPM package that was used to polyfill it on the right. Under webpack 5 you can manually install these packages and use them via resolve.fallback.

Phoenix 1.4.x to 1.5.0 upgrade instructions

Phoenix 1.5 requires Elixir >= 1.7. Be sure your existing version is up to date by running elixir -v on the command line.

Install the new phx.new project generator

$ mix archive.uninstall phx_new
$ mix archive.install hex phx_new 1.5.0
@chrismccord
chrismccord / phx-1.4-upgrade.md
Last active June 16, 2023 06:22
Phoenix 1.3.x to 1.4.0 Upgrade Guides

Phoenix 1.4 ships with exciting new features, most notably with HTTP2 support, improved development experience with faster compile times, new error pages, and local SSL certificate generation. Additionally, our channel layer internals receiveced an overhaul, provided better structure and extensibility. We also shipped a new and improved Presence javascript API, as well as Elixir formatter integration for our routing and test DSLs.

This release requires few user-facing changes and should be a fast upgrade for those on Phoenix 1.3.x.

Install the new phx.new project generator

The mix phx.new archive can now be installed via hex, for a simpler, versioned installation experience.

To grab the new archive, simply run:

@nghiaht
nghiaht / generate_rsa_keypair.sh
Created September 13, 2018 03:30
Generate RSA keypair (public, private + pkcs8) using openssl command
# Private key
openssl genpkey -algorithm RSA -out private.pem -pkeyopt rsa_keygen_bits:2048
# Public key
openssl rsa -pubout -in private.pem -out public_key.pem
# Private key in pkcs8 format (for Java maybe :D)
openssl pkcs8 -topk8 -in private.pem -out private_key.pem
## nocrypt (Private key does have no password)
@gaearon
gaearon / modern_js.md
Last active April 18, 2024 15:01
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@gembin
gembin / rsa_private_public_key.md
Last active March 6, 2024 10:36
Use RSA private key to generate public key?

To encrypt something using RSA algorithm you need modulus and encryption (public) exponent pair (n, e). That's your public key. To decrypt something using RSA algorithm you need modulus and decryption (private) exponent pair (n, d). That's your private key.

To encrypt something using RSA public key you treat your plaintext as a number and raise it to the power of e modulus n:

ciphertext = ( plaintext^e ) mod n

To decrypt something using RSA private key you treat your ciphertext as a number and raise it to the power of d modulus n:

plaintext = ( ciphertext^d ) mod n
@markhilton
markhilton / mdbootstrap-laravel-spark.md
Last active May 18, 2022 08:54
How to install mdbootstrap in Laravel Spark framework

How to install mdbootstrap in Laravel Spark framework

Those steps were followed in order to install mdbootstrap in Laravel Spark 6.0 framework.

STEP 1: install dependencies

npm i mdbootstrap
npm i node-waves