Skip to content

Instantly share code, notes, and snippets.

@halaxa
halaxa / Enum.php
Last active December 16, 2016 08:00
Type safe enum implementation in PHP
<?php
abstract class Enum {
protected $value;
public function getValue()
{
return $this->value;
}
@halaxa
halaxa / JSON-JavaScript.json.js
Created December 16, 2016 07:59
JSON data extractor in JavaScript for JetBrains IntelliJ platform
/*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col) }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
*
* where:
@halaxa
halaxa / issue-to-pr.sh
Created September 30, 2021 17:15
Convert github issue to pull request via an API call
TOKEN= # Create github token here https://github.com/settings/tokens and check `repo` scope
USERNAME= # github user name
ISSUE_ID= # issue id without '#'
PR_HEAD= # usually your feature branch
PR_BASE= # usually `master`
REPO= # repository name
curl --user "$USERNAME:$TOKEN" \
--header "Accept: application/vnd.github.v3+json" \
--request POST \