git diff --no-prefix > [path file name]
patch -p0 < [path file name]
It sometimes happen you need change code on a machine from which you cannot push to the repo.
You’re ready to copy/paste what diff
outputs to your local working copy.
You think there must be a better way to proceed and you’re right. It’s a simple 2 steps process:
1. Generate the patch:
git diff > some-changes.patch
// Lighten a colour | |
@function tint($color, $percentage) { | |
@return mix(white, $color, $percentage); | |
} | |
// Darken a colour | |
@function shade($color, $percentage) { | |
@return mix(black, $color, $percentage); | |
} |
Just migrated it from Codepen.io to markdown. Credit goes to David Conner.
Working with DOM | Working with JS | Working With Functions |
---|---|---|
Accessing Dom Elements | Add/Remove Array Item | Add Default Arguments to Function |
Grab Children/Parent Node(s) | Add/Remove Object Properties | Throttle/Debounce Functions |
Create DOM Elements | Conditionals |
{ | |
"workbench.colorCustomizations": { | |
"terminal.foreground": "#839496", | |
"terminal.background": "#002833", | |
"terminal.ansiBlack": "#003541", | |
"terminal.ansiBlue": "#268bd2", | |
"terminal.ansiCyan": "#2aa198", | |
"terminal.ansiGreen": "#859901", | |
"terminal.ansiMagenta": "#d33682", | |
"terminal.ansiRed": "#dc322f", |
I followed the instructions in this blog post Multiple Fonts: Alternative to Operator Mono in VSCode, but did not see any changes made to VS Code. After digging a bit, I discovered that all the CSS class names had changed. They’re now e.g. .mtk13, .mtk16 { … }
.
{ "vscode_custom_css.imports": [ "file:///Users/Brian/Desktop/vscode-style.css" ] }
JavaScript is one of the top programming languages today. It can also be confusing for developers coming from C, Java or PHP backgrounds. Worse still are the numerous frameworks (such as Angular and React) that make it difficult to decide what to learn and how to use the language.
In this short talk/demo, we'll look at the best practices in JavaScript programming. We'll explain using simple examples. This is for beginners and intermediate JS programmers. You must be familiar with JS syntax. We'll not cover DOM access, jQuery, Node.js or JS frameworks.
The recommendations here assume that you use a transpiler such as Babel so that code can work on older browsers. Therefore we freely use syntax from recent ECMAScript standards.
export default function ({$axios, app}) { | |
$axios.onResponseError(error => { | |
const code = parseInt(error.response && error.response.status); | |
let originalRequest = error.config; | |
if ([401, 403].includes(code)) { | |
originalRequest.__isRetryRequest = true; | |
let refresh_token = app.$auth.getRefreshToken(app.$auth.$storage.state.strategy).replace('Bearer ', ''); |