Skip to content

Instantly share code, notes, and snippets.

View nicholaswmin's full-sized avatar
💭
I may be slow to respond.

Nicholas Kyriakides nicholaswmin

💭
I may be slow to respond.
View GitHub Profile
@nicholaswmin
nicholaswmin / excessive-abstraction.rb
Last active November 5, 2024 12:19
Excessive abstraction/indirection in Ruby
# Problem set: I need to instantiate `Pages` from `Files`,
# picked up using the standard `File.read` method.
#
# For whatever reason, the `path` is the filename.
# and the `data` are the contents of the File.
# ----
# Modelling:
#
# To decouple the persistence layer and the domain layer,
# I introduce a new class `Entry` which acts as an intermediary.
@nicholaswmin
nicholaswmin / authors.md
Last active November 16, 2024 03:45
reading

reading list

Software Architecture

Minimalism

Set of philosophies that treat the YAGNI and KISS principles,
as must haves requirements troughout the entire lifecycle.

@nicholaswmin
nicholaswmin / CONTRIBUTING.md
Last active October 9, 2024 19:56
minimal rulesets

Contributions

The key words must, must not, required, shall, shall not
should, should not, recommended, may, and optional in this
document are to be interpreted as described in [RFC 2119][rfc-2119].

  • The runtime, source code & Github defaults are the only 1st-class citizens.
    Anything else, including process & conventions are undesirable dependencies.
  • Dependencies should be lightweight, familiar to use & well-defined.
  • A robust & well-defined test suite is more valuable than the code.
@nicholaswmin
nicholaswmin / install-cc-hook.sh
Last active July 21, 2024 02:31
Conventional Commits message linter as a "commit-msg" Git hook
#!/bin/bash
# Conventional Commits "commit-msg" git hook #
#
# Installs a "Conventional Commit" commit-msg Git hook
# See more: https://www.conventionalcommits.org/
#
# Usage:
# - Copy this file to your repo
# - Run it once: bash install-cc-hook.sh
@nicholaswmin
nicholaswmin / README.md
Last active October 6, 2024 21:09
A shell function that removes a key from a JSON file

Readme

Important:

I wrote this function to manipulate my package.json.
This is a suboptimal solution; the correct way is via the official [npm-pkg][pkg].

Authors

@nicholaswmin

@nicholaswmin
nicholaswmin / sublime-like-atom.json
Created April 29, 2024 15:42
Theme Override to color a Sublime Text 4 tree view in orange/green/red for modified/added/deleted files
// Activate the 'Default Dark' theme and then customise it
// Drop this in the editor
{
"extends": "Default Dark.sublime-theme",
"variables": {
"vcs_untracked": "var(--greenish)",
"vcs_modified": "var(--orangish)",
"vcs_missing": "var(--redish)",
"vcs_staged": "var(--bluish)",
"vcs_added": "var(--greenish)",
@nicholaswmin
nicholaswmin / polymerES6.html
Last active April 24, 2016 08:15
Polymer element using ES6
<base href="https://polygit.org/components/">
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>
<link href="polymer/polymer.html" rel="import">
<link href="paper-input/paper-input.html" rel="import">
<dom-module id="x-example">
<template>
<paper-input value="{{name::input}}"></paper-input>
<h4>{{name}}</h4>
@nicholaswmin
nicholaswmin / paperKMeans.js
Last active April 16, 2016 18:10
Clustering Paper.js Elements together using the K-means algorithm.
/**
* Clusters a number of Paper Elements as Paper Groups.
* Clustering is based on distance between elements,
* using K-means clustering.
* - This method DOES NOT preserve z-order of items, so use with caution
*
*
* - Dependent on clusterfck.js.
* See: https://github.com/NathanEpstein/clusters
* and download browser .js file.
@nicholaswmin
nicholaswmin / catmull-rom.js
Last active November 14, 2024 13:25
catmull-rom
// The "Catmull-Rom" Interpolating Splines in ES6
// - Authors: Nicholas Kyriakides (2017) & Unknown
// - From "A class of local interpolating splines"
// - by Catmull, Edwin; Rom, Raphael
// - University of Utah, 1974
//
//
// Barnhill, Robert E.; Riesenfeld, Richard F. (eds.).
// Computer Aided Geometric Design.
//