Solutions to problems or quirks I shouldn't have.
Stack overflow in React (`Maximum call stack size exceeded`)
Triggered this one a week ago with something like the following (pseudocode):class MyComponent extends React.Component {| ## Open GitKraken using the current repo directory. | |
| ## For when you want a prettier view of your current repo, | |
| ## but prefer staying in the cli for most things. | |
| ## This will break if GitKraken ever removes the -p flag. | |
| ## If you're not using OSX, the path is definitely different. | |
| kraken () { | |
| ~/Applications/GitKraken.app/Contents/MacOS/GitKraken -p $(pwd) | |
| } |
| resource "aws_api_gateway_rest_api" "myApi" { | |
| name = "myApi-${var.env}" | |
| description = "My awesome API (${var.env} environment)" | |
| } | |
| resource "aws_api_gateway_deployment" "myApi" { | |
| depends_on = [ | |
| "aws_api_gateway_integration.myApi_myEndpoint_post", | |
| "aws_api_gateway_integration_response.myApi_myEndpoint_post", | |
| "aws_api_gateway_integration_response.myApi_myEndpoint_post_400", |
| // this is an ingenius hack that allows us to run Phaser without a browser | |
| // ... and yes, it took some time to figure out how to do this | |
| var Canvas = require('canvas') | |
| , jsdom = require('jsdom') | |
| , document = jsdom.jsdom(null) | |
| , window = document.parentWindow | |
| , Phaser; | |
| // expose a few things to all the modules |
| <html> | |
| <head> | |
| <title>How to create an interactive heatmap with Leaflet.js</title> | |
| <meta charset="utf-8"> | |
| <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" /> | |
| <script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script> | |
| <script src="leaflet-heat.js"></script> | |
| <style type="text/css"> | |
| html, body, #map{ | |
| height: 100%; |
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>AWS IoT Pub/Sub Demo</title> | |
| </head> | |
| <body> | |
| <h1>AWS IoT Pub/Sub Demo</h1> | |
| <form> | |
| <button type="button" id="connect">connect!</button> |
| module.exports = (file, api, options) => { | |
| const j = api.jscodeshift; | |
| const root = j(file.source); | |
| // We have to add "use strict" for node to play nice | |
| // Taken from https://github.com/cpojer/js-codemod/blob/master/transforms/use-strict.js | |
| const hasStrictMode = body => | |
| body.some( | |
| statement => j.match(statement, { | |
| type: 'ExpressionStatement', |
| # This script is the **correct** way to allow installation and use | |
| # of npm executables without sudo. | |
| # Declare where you want your global packages installed to. | |
| npm config set prefix '~/.local/share/npm' | |
| # Ensure the directory exists. | |
| mkdir -p ~/.local/share/npm | |
| # Change `.zshrc` to `.bashrc` if appropriate, but consider instead |
This post has moved to my personal blog: http://maximilianschmitt.me/posts/iojs-command-line-apps-nodejs/