Skip to content

Instantly share code, notes, and snippets.

View m4tlch's full-sized avatar
🏠
Working from home

Paul Nike m4tlch

🏠
Working from home
  • Ukraine
View GitHub Profile
@m4tlch
m4tlch / Form.js
Created December 26, 2021 12:58 — forked from lorisleiva/Form.js
// resources/js/services/Form.js
import FormErrors from './FormErrors'
export default class {
constructor (initialData = {}, submitCallback = null) {
this._initialData = initialData
this._submitCallback = submitCallback
this.errors = new FormErrors()
@m4tlch
m4tlch / array-insert-after.php
Created November 9, 2021 21:34 — forked from wpscholar/array-insert-after.php
Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended to the end of the array.
<?php
/**
* Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended
* to the end of the array.
*
* @param array $array
* @param string $key
* @param array $new
*
@m4tlch
m4tlch / Info for PHPStorm.md
Created June 25, 2021 08:12 — forked from Pen-y-Fan/Info for PHPStorm.md
PHPStorm Tips, Tricks and setup

PHPStorm

PhpStorm Tips, ticks and standard setup

  1. Tips and Tracks for PHPStorm (PHPStorm Tips and Tricks.md)
  2. Standard setup for PHP projects (Standard.md)
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@m4tlch
m4tlch / respond_and_process.php
Created July 3, 2019 12:26 — forked from alexllnk/respond_and_process.php
PHP: Send response and continue processing
<?php
// Buffer all upcoming output...
ob_start();
// Send your response.
echo "Testing response";
// Get the size of the output.
$size = ob_get_length();
@m4tlch
m4tlch / flock-queue.php
Last active June 28, 2019 10:28 — forked from alexllnk/gist:9246d5bd28883bf356983579f5db0176
queue requests with flock
public function request_queue_handler(Request $request)
{
header($_SERVER['SERVER_PROTOCOL'].' 200 OK');
$amo_subdomain = $_POST['account']['subdomain'];
$path_structure = '../'.$amo_subdomain.'/queue_files';
$queue_file_prefix = $path_structure.'/queue_file_';
$queue_flag_file = $path_structure.'/queue_flag';
$lead_name = $_POST['leads']['add'][0]['name'];
@m4tlch
m4tlch / respond_and_process.php
Created June 13, 2019 16:15 — forked from kfriend/respond_and_process.php
PHP: Send response and continue processing
<?php
// Buffer all upcoming output...
ob_start();
// Send your response.
echo "Testing response";
// Get the size of the output.
$size = ob_get_length();
@m4tlch
m4tlch / checkbox.blade.php
Created March 19, 2019 19:21 — forked from skadimoolam/checkbox.blade.php
Customizable form partials for Laravel - https://laravelcollections.com
@php
$d = $d ?? null; // default value
@endphp
<div class="form-group row">
<label for="{{ $n }}" class="col-sm-4 col-form-label text-md-right"><b>{{ $l }}</b></label>
<div class="col-md-8">
<input id="{{ $n }}" type="checkbox" class="form-control" name="{{ $n }}" value="1" @if(old($n, $d) == '1') checked @endif>
@if ($errors->has($n))
<small class="text-danger">{{ $errors->first($n) }}</small>
@m4tlch
m4tlch / jira_letsencrypt.md
Created December 23, 2018 20:52 — forked from dborin/jira_letsencrypt.md
HOWTO Configure Atlassian Jira to use Letsencrypt certificate

HOWTO Configure Atlassian Jira to use Letsencrypt certificate with default Tomcat

This is a primer for installing a Letsencrypt certificate on a Jira server that is running the Jira provided, default Tomcat for serving webpages.

I found lots of information about how to do it using a free-standing Tomcat or nginx, but nothing about this particular combination. I hope it helps you!

Obviously, in all the examples, you need to replace jira.example.com with your own domain! And (duh) you need to use your own password, not 1234

You need to have installed Java (outside the scope of this document). Then in your user's shell RC file and probably root's RC file, add