I hereby claim:
- I am bigab on github.
- I am adamlbarrett (https://keybase.io/adamlbarrett) on keybase.
- I have a public key whose fingerprint is ED95 FF07 C17A 96ED 6506 D8CB 90F7 8A7F 7822 FA8C
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Thinking about how to secure the refresh-token for the web gave me an idea for what I think would be a pretty good set up for issueing JWT access-tokens and refresh-tokens.
refresh-tokens are issued by a central stateful server (backed by a DB), that maintains a black list.
When deciding on which code style to use, under different circumstances (i.e. number of parameters, return value, etc.) a good solid rule for consistency and terseness is: Always use the minimum required syntax for the situation
The minimum does not include variable/parameter names, which should should be semantic to the meaning or general depending on how the function will be used. Using an unused parameter name to save one char (like _ => 2*2) is confusing and should be avoided.
With this rule in mind we end up with this:
// no params
() => {} // "noop" no parameters, no operations, no return value
() => value + 1 // no parameters, one line operation, a return value (that is not an object)| var gulp = require('gulp'); | |
| var sass = require('gulp-sass'); | |
| gulp.task('style', function() { | |
| return gulp.src('style.scss') | |
| .pipe(sass({ | |
| includePaths: ["node_modules/bootstrap/scss"] | |
| })) | |
| .pipe(gulp.dest('./')); | |
| }); |
| function calculateWrappingPaperNeeds(input) { | |
| return input.split('\n') | |
| .reduce((sqFt, eq) => { | |
| var d = eq.split('x'); | |
| var l = d[0], w = d[1], h = d[2]; | |
| sqFt += 2*l*w + 2*w*h + 2*h*l; | |
| sqFt += Math.min(l*w, w*h, h*l); // little extra | |
| return sqFt; | |
| }, 0); | |
| } |
Using CanJS and the sortable-plugin, having live sortable lists becomes easy, leading to an simple and expressive template that just works.
A Pen by Adam Barrett on CodePen.
| { | |
| // http://eslint.org/docs/rules/ | |
| "ecmaFeatures": { | |
| "arrowFunctions": true, // enable arrow functions | |
| "modules": true, // enable modules | |
| "binaryLiterals": false, // enable binary literals | |
| "blockBindings": true, // enable let and const (aka block bindings) | |
| "classes": true, // enable classes | |
| "defaultParams": true, // enable default function parameters |
| /* A pretty nav */ | |
| body { | |
| color: #eee; | |
| background: rgba(0, 0, 0, 0.8); | |
| font-family: sans-serif; | |
| font-size: 24px; | |
| } | |
| nav { | |
| text-align: right; |