Skip to content

Instantly share code, notes, and snippets.

View dbunt1tled's full-sized avatar
👀

deni dbunt1tled

👀
View GitHub Profile
@dbunt1tled
dbunt1tled / emojis.json
Created January 3, 2025 19:37 — forked from oliveratgithub/emojis.json
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family: woman, woman, girl, girl", "shortname": ":woman_woman_girl_girl:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F467", "html": "👩‍👩‍👧‍👧", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family: woman, woman, girl, boy", "shortname": ":woman_woman_girl_boy:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F466", "html": "👩‍👩‍👧‍👦", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family: woman, woman, boy, boy", "shortname": ":woman_woman_boy_boy:", "unicode": "1F469 200D 1F469 200D 1F466 200D 1F466", "html": "👩‍👩‍👦‍👦", "category": "People & Body (family)", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family: man, woman, girl, girl", "shortname": ":man_woman_girl_girl:", "unicode": "1F468 200D 1F469 200D 1F467 200D 1F467", "html": "👨‍👩&z
@dbunt1tled
dbunt1tled / openssl.md
Created December 29, 2024 07:38
Create Self Signed Certificate using OpenSSL on a Mac

Create Self Signed Certificate using OpenSSL on a Mac

Introduction

Every now and then I need to create a self signed certificate in azure for something. In my particular case its Azure B2C. I am using a mac so its not simply just running something like

New-SelfSignedCertificate `
    -KeyExportPolicy Exportable `
    -Subject "CN=yourappname.yourtenant.onmicrosoft.com" `
 -KeyAlgorithm RSA `
@dbunt1tled
dbunt1tled / Trampoline.php
Last active November 9, 2024 07:29
Complex recursion
<?php
// https://3v4l.org/aev4d from meetup Пыхап
declare(strict_types=1);
/**
* @template-covariant A
*/
interface Trampoline {}
/**
@dbunt1tled
dbunt1tled / iterable.php
Created February 10, 2020 09:09
iterable arrays
<?php
function iterable_map(iterable $list, callable $operation) : iterable
{
foreach ($list as $k => $v) {
yield $operation($k, $v);
}
}
function iterable_filter(iterable $list, callable $filter) : iterable
{
<?php
//------------------------------------------------------------------------------
function dmword($string, $is_cyrillic = true)
{
static $codes = array(
'A' => array(array(0, -1, -1),
'I' => array(array(0, 1, -1)),
'J' => array(array(0, 1, -1)),
@dbunt1tled
dbunt1tled / truncate.php
Created September 12, 2019 10:21
truncate string with save word
<?php
function truncate($string, $len, $wordsafe = TRUE, $dots = TRUE)
{
if (mb_strlen($string) <= $len)
{
return $string;
}
$dots AND $len -= 4;
if ($wordsafe)
{
@dbunt1tled
dbunt1tled / inArrayInsensitive.php
Created September 12, 2019 10:15
insensitive comparing in_array
<?php
function in_arrayi($needle, $haystack)
{
return in_array(strtolower($needle), array_map('strtolower', $haystack));
}
@dbunt1tled
dbunt1tled / multipleCombitionInArray.php
Created September 12, 2019 10:12
show all combinations between arrays
<?php
function get_combinations($arrays) {
$result = array(array());
foreach ($arrays as $property => $property_values) {
$tmp = array();
foreach ($result as $result_item) {
foreach ($property_values as $property_value) {
$tmp[] = array_merge($result_item, array($property => $property_value));
}
}
@dbunt1tled
dbunt1tled / JaccardIndex.php
Created September 12, 2019 09:07
Коофициент сходства (Жаккара)
<?php
//https://ru.wikipedia.org/wiki/%D0%9A%D0%BE%D1%8D%D1%84%D1%84%D0%B8%D1%86%D0%B8%D0%B5%D0%BD%D1%82_%D0%96%D0%B0%D0%BA%D0%BA%D0%B0%D1%80%D0%B0
function getSimilarityCoefficient( $item1, $item2, $separator = "," ) {
$item1 = explode( $separator, $item1 );
$item2 = explode( $separator, $item2 );
$arr_intersection = array_intersect( $item1, $item2 );
$arr_union = array_unique(array_merge( $item1, $item2 ));
$coefficient = count( $arr_intersection ) / count( $arr_union );
return $coefficient;
@dbunt1tled
dbunt1tled / getPrivateProperty.php
Created August 22, 2019 07:45
Get private property whithouth Reflection
<?php
function inspect($object, $property) {
return (function () use ($property) {
return $this->$property;
})->call($object);
}