a/o 2020-05-29
--
- Restart with Cmd-R or Cmd-D
- Erase drive / 3x if second-hand
- Reinstall MacOS
[alias] | |
verbs = !git log --pretty=format:'%s' | cut -d \" \" -f 1 | sort | uniq -c | sort -nr |
// String utils | |
// | |
// resources: | |
// -- mout, https://github.com/mout/mout/tree/master/src/string | |
/** | |
* "Safer" String.toLowerCase() | |
*/ | |
function lowerCase(str) { | |
return str.toLowerCase(); |
Secure sessions are easy, but not very well documented. | |
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy: | |
The desired configuration for using NginX as an SSL proxy is to offload SSL processing | |
and to put a hardened web server in front of your Node.js application, like: | |
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [PUBLIC INTERNET] <-> [CLIENT] | |
Edit for express 4.X and >: Express no longer uses Connect as its middleware framework, it implements its own now. |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>HMAC-SHA256 Example</title> | |
</head> | |
<body> | |
<script src="http://crypto.stanford.edu/sjcl/sjcl.js"></script> | |
<script> | |
var sharedSecret, query, signature, hmac, xhr; |
ZIP,LAT,LNG | |
00601,18.180555, -66.749961 | |
00602,18.361945, -67.175597 | |
00603,18.455183, -67.119887 | |
00606,18.158345, -66.932911 | |
00610,18.295366, -67.125135 | |
00612,18.402253, -66.711397 | |
00616,18.420412, -66.671979 | |
00617,18.445147, -66.559696 |
// === Arrays | |
var [a, b] = [1, 2]; | |
console.log(a, b); | |
//=> 1 2 | |
// Use from functions, only select from pattern | |
var foo = () => [1, 2, 3]; |
A quick overview of the node.js streams interface with basic examples.
This is based on @brycebaril's presentation, Node.js Streams2 Demystified
Streams are a first-class construct in Node.js for handling data.
Think of them as as lazy evaluation applied to data.
import { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |
const Promise = require('bluebird'); | |
const React = require('react'); | |
const superagent = require('superagent'); | |
const assign = require('lodash/object/assign'); | |
const isArray = require('lodash/lang/isArray'); | |
const isFunction = require('lodash/lang/isFunction'); | |
const isObject = require('lodash/lang/isArray'); | |
const isString = require('lodash/lang/isString'); | |
const log = require('debug')('component:await'); |