Skip to content

Instantly share code, notes, and snippets.

View dfenerski's full-sized avatar

Dimitar Fenerski dfenerski

View GitHub Profile
@htammen
htammen / gist:b276475267d6af00e23de6b1cce218d5
Created September 11, 2019 07:07
UI5 Input control email validation
<Input id="email1"
value="{path: '/email1', type: 'sap.ui.model.type.String', constraints: {search: '^((?!\\.)[\\w-_.]*[^.])(@\\w+)(\\.\\w+(\\.\\w+)?[^.\\W])$'}}"
type="Email"
></Input>
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@davidfurlong
davidfurlong / JSON.stringify-replacer-sort-keys.js
Last active March 6, 2025 02:17
JSON.stringify replacer function for having object keys sorted in output (supports deeply nested objects)
// Spec http://www.ecma-international.org/ecma-262/6.0/#sec-json.stringify
const replacer = (key, value) =>
value instanceof Object && !(value instanceof Array) ?
Object.keys(value)
.sort()
.reduce((sorted, key) => {
sorted[key] = value[key];
return sorted
}, {}) :
value;
@wojteklu
wojteklu / clean_code.md
Last active March 30, 2025 22:46
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

function Add-EnvPath {
param(
[Parameter(Mandatory=$true)]
[string] $Path,
[ValidateSet('Machine', 'User', 'Session')]
[string] $Container = 'Session'
)
if ($Container -ne 'Session') {