start new:
tmux
start new with session name:
tmux new -s myname
# alias to edit commit messages without using rebase interactive | |
# example: git reword commithash message | |
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f" | |
# count total commits in a repo | |
git rev-list --all --count | |
# edit all commit messages | |
git rebase -i --root |
;;; runs eslint --fix on the current file after save | |
;;; alpha quality -- use at your own risk | |
(defun eslint-fix-file () | |
(interactive) | |
(message "eslint --fixing the file" (buffer-file-name)) | |
(shell-command (concat "eslint --fix " (buffer-file-name)))) | |
(defun eslint-fix-file-and-revert () | |
(interactive) |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Add React in One Minute</title> | |
</head> | |
<body> | |
<h2>Add React in One Minute</h2> | |
<p>This page demonstrates using React with no build tooling.</p> |
# Install ESLint and Babel ESLint
# Make sure to install at least v5.1.0 of ESLint
npm install --save-dev eslint babel-eslint
# Install the Airbnb configs (3 of them, listed below)
npx install-peerdeps --dev eslint-config-airbnb
# Install Prettier + ESLint config
npm install --save-dev --save-exact prettier eslint-config-prettier
For a while, JSX
and new es6 syntax had flaky support in emacs, but there's been huge work on a lot of packages. Using emacs for JavaScript with React, ES6, and Flow (or Typescript, etc) is really easy and powerful in Emacs these days.
This is how you can work on modern web development projects with full support for tooling like JSX, Flow types, live eslint errors, automatic prettier.js formatting, and more.
web-mode
web-mode
provides most of the underlying functionality, so a huge shout-out to the maintainer(s) there.
# Install ESLint and Babel ESLint
# Make sure to install at least v5.1.0 of ESLint
npm install --save-dev eslint babel-eslint
# Install the Airbnb configs (3 of them, listed below)
npx install-peerdeps --dev eslint-config-airbnb
# Install Prettier + ESLint config
npm install --save-dev --save-exact prettier eslint-config-prettier
This article aims at explaining lambda calculus in a more approachable less 'mathy' manner.
Memoization: Memoization is an optimization technique used primarily to speed up computer programs by caching the result of expensive function calls and returning the cached result when fed with the same input.
Pure Function: A pure function is a function whose computation does not depend on globally declared variables, it does no I/O or mutations. All it does is return a value after doing a bunch of computations on the arguments it recieves. For a given set of arguments, a pure function will always return the same value. Thus, a pure function is one that is memoizable.