Skip to content

Instantly share code, notes, and snippets.

Husky

Husky makes it straightforward to implement git hooks. Work with a team and want to enforce coding standards across the team? No problem! Husky lets you require everyone to automatically lint and tests their code before committing or pushing to the repository.

https://github.com/typicode/husky

dotenv

Dotenv is a zero-dependency module that loads environment variables from a .env file into process.env. Storing configuration in the environment separate from code is based on The Twelve-Factor App methodology.

@SMoni
SMoni / README.md
Created February 17, 2020 06:27 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@SMoni
SMoni / Indirection Is Not Abstraction.md
Last active February 6, 2020 07:38
List from Zed Shaw (http://zedshaw.com/essays/indirection_is_not_abstraction.html) what an interface should/shouldn't do. Mind his definition of an interface from the original post.

An abstract interface should not require any configuration to use

Configuration should be done behind the scenes using an external resource like a property file, and should be done internally before anyone uses the interface.


An user of an abstract interface should not have to go through more than one function call in a chain to “find” any component they need

Remember that indirection is evil and only ends up adding to the cognitive complexity necessary to use something. You can find examples of this in normal GUIs when you are forced to go through a huge list of complicated steps across multiple interface to complete one task. A wizard is an example of an abstraction over these complicated steps, and it basically provides one access point to your task. The same idea applies to abstract interfaces: If the user has to call more than one function just to access a component or complete a task then you haven’t helped them at all.

@SMoni
SMoni / Get-ProcessMemory.ps1
Created December 29, 2018 11:55 — forked from jdhitsolutions/Get-ProcessMemory.ps1
A PowerShell function to display a snapshot of process memory usage based on the workingset value. The file includes a format.ps1xml file.
Function Get-ProcessMemory {
<#
.SYNOPSIS
Get a snapshot of a process' memory usage.
.DESCRIPTION
Get a snapshot of a process' memory usage based on its workingset value. You can get the same information using Get-Process or by querying the Win32_Process WMI class with Get-CimInstance. This command uses Invoke-Command to gather the information remotely. Many of the parameters are from that cmdlet.
Technically you can use wildcards with process names, but because of how the function aggregates data, you might not see the results you expect.
.EXAMPLE
PS C:\> get-processmemory code,powershell,powershell_ise
@SMoni
SMoni / filtered-table.vue
Last active October 28, 2018 20:07
Spike filtering table in vue
<template>
<div class="filtered-table">
<table>
<thead>
<tr class="columns">
<th v-for="column in columns" :key="column.name" class="column">{{ column.text }}</th>
</tr>
<tr class="filters">
<td v-for="column in columns" :key="column.name" class="filter">
<input @input="column.setTerms($event.target.value)"/>
@SMoni
SMoni / Was ist 5S.md
Last active December 23, 2015 23:49
Für’s Software-Engineering lassen sich die Methoden folgendermassen „übersetzen“ (nach Poppendieck, Mary; Poppendieck, Tom: Implementing Lean Software Developement.)
  • Sortiere aus Obsolete Dateien, Software usw. auf Arbeitsplatzrechnern und Server finden und entfernen oder archivieren.
  • Sauberkeit Den virtuellen und realen Arbeitsplatz säubern.
  • Systematisierung Ordner-Strukturen auf Arbeitsplatzrechnern und Servern vereinheitlichen.
  • Standardisierung Strukturen automatisiert anlegen, Coding-Richtlinien festlegen.
  • Selbstdisziplin Die Vorgehensweise leben.
@SMoni
SMoni / Prinzipien von Lean.md
Last active December 23, 2015 23:49
... nach Mary Poppendieck, Tom Poppendieck (2003), “Lean Software Development: An Agile Toolkit”
  • Qualität von Anfang an (Build Quality In)
  • Verschwendung vermeiden (Eliminate Waste)
  • Wissen erzeugen (Create Knowledge)
  • Entscheidungen so spät wie möglich (Defer Commitment)
  • Schnelles Liefern (Deliver Fast)
  • Respekt (Respect People)
  • Das Ganze optimieren (Optimize The Whole)
@SMoni
SMoni / Deutsche Kalenderwoche berechnen.js
Last active December 23, 2015 09:29
... mit JavaScript."Die Berechnung erfolgt nach dem C++-Algorithmus von Ekkehard Hess aus einem Beitrag vom 29.7.1999 in der Newsgroup borland.public.cppbuilder.language (freigegeben zur allgemeinen Verwendung)"
var getWeek = function() {
var a = Math.floor((14 - (this.getMonth())) / 12);
var y = this.getYear() + 4800 - a;
var m = (this.getMonth()) + (12 * a) - 3;
var jd = this.getDate() - 2 + Math.floor(((153 * m) + 2) / 5) + (365 * y) + Math.floor(y / 4) - Math.floor(y / 100) + Math.floor(y / 400) - 32045;
^ Offset auf Montag
var d4 = (jd + 31741 - (jd % 7)) % 146097 % 36524 % 1461;
var BlackBox = function() {
var self = this;
self._events = [];
self.Record = function(event) {
self._events.push(event);
self.Recorded(event);
};
@SMoni
SMoni / Chain.cs
Last active October 9, 2015 07:12
Simple Chaining... nothing more
class Chain<T> {
private Chain() { }
private readonly List<T> _Chain = new List<T>();
public static Chain<T> Start => new Chain<T>();
public Chain<T> this[T This_] {
get { this._Chain.Add(This_); return this; }