| My thoughts on writing tiny reusable modules that each do just one | |
| thing. These notes were adapted from an email I recently sent. | |
| *** | |
| If some component is reusable enough to be a module then the | |
| maintenance gains are really worth the overhead of making a new | |
| project with separate tests and docs. Splitting out a reusable | |
| component might take 5 or 10 minutes to set up all the package | |
| overhead but it's much easier to test and document a piece that is |
| #!/bin/sh | |
| matches=$(git diff --cached | grep -E '\+.*?FIXME') | |
| if [ "$matches" != "" ] | |
| then | |
| echo "'FIXME' tag is detected." | |
| echo "Please fix it before committing." | |
| echo " ${matches}" | |
| exit 1 |
I hereby claim:
To claim this, I am signing this object:
| /** | |
| * Prop getter | |
| * @inspiredby https://blog.mariusschulz.com/2017/01/06/typescript-2-1-keyof-and-lookup-types | |
| */ | |
| function prop<T, K extends keyof T>(obj: T, key: K) { | |
| return obj.hasOwnProperty(key) ? obj[key] : undefined; | |
| } | |
| export function buildAddFieldParams(field: ModelFieldTypes, zone: 'DISCRETE' | 'CONTINUOUS' | 'AGGREGATE'): EncField { | |
| let lookup = { |
| { | |
| "name": "phantomjs-bug", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "start": "phantomjs script.js" | |
| }, | |
| "author": "", | |
| "license": "ISC", |
| /* | |
| +-----------------------------------------------------------------+ | |
| | Created by Chirag Mehta - http://chir.ag/projects/ntc | | |
| |-----------------------------------------------------------------| | |
| | ntc js (Name that Color JavaScript) | | |
| +-----------------------------------------------------------------+ | |
| All the functions, code, lists etc. have been written specifically | |
| for the Name that Color JavaScript by Chirag Mehta unless otherwise |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="https://code.jquery.com/jquery-3.0.0-alpha1.js"></script> | |
| <script src="https://cdn.jsdelivr.net/momentjs/2.10.6/moment-with-locales.min.js"></script> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| <style id="jsbin-css"> | |
| .day { |
| /* | |
| * An implementation of Ruby's string.succ method. | |
| * By Devon Govett | |
| * | |
| * Returns the successor to str. The successor is calculated by incrementing characters starting | |
| * from the rightmost alphanumeric (or the rightmost character if there are no alphanumerics) in the | |
| * string. Incrementing a digit always results in another digit, and incrementing a letter results in | |
| * another letter of the same case. | |
| * | |
| * If the increment generates a carry, the character to the left of it is incremented. This |
| // | |
| // Regular Expression for URL validation | |
| // | |
| // Author: Diego Perini | |
| // Updated: 2010/12/05 | |
| // License: MIT | |
| // | |
| // Copyright (c) 2010-2013 Diego Perini (http://www.iport.it) | |
| // | |
| // Permission is hereby granted, free of charge, to any person |