Skip to content

Instantly share code, notes, and snippets.

View belfie13's full-sized avatar
🤘

CIIDMike belfie13

🤘
  • B13
  • Australis
View GitHub Profile

[<<inyourface>>;id|item;*bold*;_ital_;{bg:cyan}]<-<>[a]^-.-++[b],[note:note]

Association schema

<?php
/**
* On every loop of `while(true)` we check:
* 1. If all elements in group have same head -> extract it to common head,
* 2. If all elements in group have same tail -> extract it to common tail,
* 3. If some elements have common head -> create sub group of this elements, and put there head as common head of group,
* 4. Same for tails.
* If none of previous happen - we stop loop.
* Then check if current group has empty entry and convert it to optional (like `(a|b|) -> (a|b)?`).
@belfie13
belfie13 / OOP.md
Last active September 8, 2022 19:10

Behavioural

Chain of responsibility

  • pass a request down a chain of objs until one handles the request.
  • handler objs either handle or forward a request.

Creation

@belfie13
belfie13 / JavaScript.html
Last active February 2, 2021 17:26
JavaScript snippets
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
@belfie13
belfie13 / breachquery.sh
Created September 23, 2020 16:47 — forked from nlitsme/breachquery.sh
query.sh for older bash versions - from magnet:?xt=urn:btih:7ffbcd8cee06aba2ce6561688cf68ce2addca0a3
#!/bin/bash
# query.sh from BreachCompilation - magnet:?xt=urn:btih:7ffbcd8cee06aba2ce6561688cf68ce2addca0a3
# works with older bash versions.
# patch by Willem <itsme@xs4all.nl>
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
if [ "$1" != "" ]; then
word1=$(echo $1 | tr A-Z a-z)
letter1=$(echo $word1|cut -b1)
if [[ $letter1 == [a-zA-Z0-9] ]]; then
@belfie13
belfie13 / composer_install.sh
Last active June 30, 2020 15:13
Composer installation without using wget (not on macOS by default)
#!/usr/bin/env sh
# Installation of __Composer__ to manage project dependancies
# save to and run script from `proj_path/scripts/` directory.
# verify download by checking file signature
EXPECTED_SIGNATURE="$(curl https://composer.github.io/installer.sig)"
# download the installer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
@belfie13
belfie13 / Container.php
Created June 30, 2020 13:43 — forked from MustafaMagdi/Container.php
PHP Dependency Injection Container
<?php
/**
* Class Container
*/
class Container
{
/**
* @var array
*/
@belfie13
belfie13 / InYourFaces.php
Created April 7, 2020 19:59
B13 GuitMuso
<?php
// Frequency hertz()
// PitchClass::A::B::C::D::E::F::G
// Accidental::NATURAL::SHARP::FLAT
// Octave number()
// Note pitchClass() accidental() octave()
# note is defined by frequency(Hz) but can translate into pitchClass/accidental/octave
# mode is made up of intervals
# scale is a mode starting from a tonic, or set of notes with key
@belfie13
belfie13 / Recurse through child nodes.js
Created March 11, 2020 21:27
JavaScript Examples from developer.mozilla.org
// The following function recursively calls a callback function for each node contained by a root node
// (including the root itself):
function eachNode(rootNode, callback)
{
if (!callback)
{
const nodes = []
eachNode(rootNode, function(node)
{
@belfie13
belfie13 / x-man-page.html
Last active March 11, 2020 21:06
open man pages in terminal.app on macOS?
<a href="x-man-page://netstat">man netstat</a>