Skip to content

Instantly share code, notes, and snippets.

View alexey-kar's full-sized avatar

Alexey Karchevskii alexey-kar

View GitHub Profile
@alexey-kar
alexey-kar / Supervisor And Cron
Created March 12, 2024 08:27 — forked from abhitechno01/Supervisor And Cron
supervisor and cron commands
#########################
Supervisor
#########################
First install supervisor
apt install supervisor
Create a program then give permission to program
chmod +x <program_path>
@alexey-kar
alexey-kar / file_force_contents.php
Created November 19, 2020 10:00 — forked from ofca-snippets/file_force_contents.php
Extended version of php function "file_put_contents"
/**
* Extended version of function file_put_contents.
*
* This function will create all dirs in the path to the file,
* if they does not exists.
*
* @param string path to file
* @param string file content
* @param int flag taken by file_put_contents function
* @return bool false on failure, true on success
@alexey-kar
alexey-kar / sum
Last active June 17, 2020 07:25
Нужно написать функцию которая будет возвращать сумму чисел из строки n, куда входят только нечетные числа
{
class Test {
static assertEquals(test_value, should_value) {
return test_value === should_value;
}
}
const string_pyramid = `
1
@alexey-kar
alexey-kar / overlay.css
Created April 21, 2020 10:39 — forked from h4/overlay.css
Полупрозрачный оверлей
.overlay {
position: fixed;
z-index: 100;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: #000;
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=55);
opacity: 0.55;
https://stackoverflow.com/questions/16412047/parse-xml-namespaces-with-php-simplexml
<?php
$data = "http://alerts.weather.gov/cap/tx.php?x=1";
$entries = file_get_contents($data);
$entries = new SimpleXmlElement($entries);
if(count($entries)):
//echo "<pre>";print_r($entries);die;
//alternate way other than registring NameSpace
//$asin = $asins->xpath("//*[local-name() = 'ASIN']");
https://stackoverflow.com/questions/16412047/parse-xml-namespaces-with-php-simplexml
<?php
$data = "http://alerts.weather.gov/cap/tx.php?x=1";
$entries = file_get_contents($data);
$entries = new SimpleXmlElement($entries);
if(count($entries)):
//echo "<pre>";print_r($entries);die;
//alternate way other than registring NameSpace
//$asin = $asins->xpath("//*[local-name() = 'ASIN']");
<?php
/**
* @author: Sohel Rana
* @url: https://blog.sohelrana.me/parsing-xml-multiple-namespaces-using-php/
* @license: MIT
* Parsing XML with multiple namespaces using PHP
*/
$xmlString = "<en:Envelope xmlns:en=\"http://www.softcare.com/HIPAA/SC/Enrollment/0301\"
xmlns:sc=\"http://www.softcare.com/HIPAA/SC/0203\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
$activities = ActivityFeed::with('parentable')
->get()
->loadMorph('parentable', [
Event::class => ['calendar'],
Photo::class => ['tags'],
Post::class => ['author'],
]);
d3.xml(URL.createObjectURL(new Blob([this.file]))).then(x => {
console.log(x);
})
let t =`data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAwIiBoZWlnaHQ9IjQwMCIgdmlld0JveD0iLTEwIC0xMCAyMjAgMjIwIiBzdHlsZT0icGFkZGluZyA6IDEwcHgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgaWQ9InN2Z0dyb3VwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZm9udC1zaXplPSI5cHQiIHN0cm9rZT0iZ3JlZW4iIHN0cm9rZS13aWR0aD0iMC41bW0iIGZpbGw9Im5vbmUiIHN0eWxlPSJzdHJva2U6Z3JlZW47c3Ryb2tlLXdpZHRoOjAuNW1tO2ZpbGw6bm9uZSI+PGcgaWQ9IjAiPjxnIGlkPSJ0cmFwZXplIj48bGluZSBpZD0ibGluZTEiIGRhdGEtcm91dGU9IlsmcXVvdDttb2RlbHMmcXVvdDssJnF1b3Q7dHJhcGV6ZSZxdW90OywmcXVvdDtwYXRocyZxdW90OywmcXVvdDtsaW5lMSZxdW90O10iIHgxPSIwIiB5MT0iMjAwIiB4Mj0iMjAwIiB5Mj0iMjAwIiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiPjwvbGluZT48bGluZSBpZD0ibGluZTIiIGRhdGEtcm91dGU9IlsmcXVvdDttb2RlbHMmcXVvdDssJnF1b3Q7dHJhcGV6ZSZxdW90OywmcXVvdDtwYXRocyZxdW90OywmcXVvdDtsaW5lMiZxdW90O10iIHgxPSIyMDAiIHkxPSIyMDAiIHgyPSIxNzUiIHkyPSIwIiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiPjwvbGluZT48bGluZSBpZD0ibGluZTMiIGRhdGEtcm91dGU9IlsmcXVvdDttb2RlbHMmcXVvdDssJnF1b3Q7dHJhcGV6Z