- Incremental progress over big bangs - Small changes that compile and pass tests
- Learning from existing code - Study and plan before implementing
- Pragmatic over dogmatic - Adapt to project reality
- Clear intent over clever code - Be boring and obvious
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env zsh | |
| export CLICOLOR=1 | |
| export DOTFILES=$HOME/.dotfiles | |
| export EDITOR=vim | |
| export FZF_DEFAULT_COMMAND='rg --files --hidden --follow --no-ignore-vcs --glob "!{**/node_modules/*,.git/*,public/*}"' | |
| export GIT_EDITOR=nvim | |
| export INCLUDES=$HOME/.local/share/dotfiles | |
| export KEYTIMEOUT=1 | |
| export LC_ALL=en_US.UTF-8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // TODO: make `pages` optional and measure the div when unspecified, this will | |
| // allow more normal document flow and make it easier to do both mobile and | |
| // desktop. | |
| import { | |
| createContext, | |
| useCallback, | |
| useContext, | |
| useEffect, | |
| useMemo, | |
| useRef, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useCallback, useMemo } from "react" | |
| import LanguageKeysDe from "./de" | |
| import LanguageKeys, { LangProps } from "./en" | |
| /** | |
| Full example here: | |
| https://codesandbox.io/s/simple-react-typescript-i18n-w0ut6 | |
| **/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require('fs'); | |
| const fetch = require('node-fetch'); | |
| const FormData = require('form-data'); | |
| const filePath = `path/to/file.ext`; | |
| const form = new FormData(); | |
| const stats = fs.statSync(filePath); | |
| const fileSizeInBytes = stats.size; | |
| const fileStream = fs.createReadStream(filePath); | |
| form.append('field-name', fileStream, { knownLength: fileSizeInBytes }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //note: month is 0 based, just like Dates in js | |
| function getWeeksInMonth(year, month) { | |
| const weeks = [], | |
| firstDate = new Date(year, month, 1), | |
| lastDate = new Date(year, month + 1, 0), | |
| numDays = lastDate.getDate(); | |
| let dayOfWeekCounter = firstDate.getDay(); | |
| for (let date = 1; date <= numDays; date++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Ultra lightweight Github REST Client */ | |
| // original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb | |
| const token = 'github-token-here' | |
| const githubClient = generateAPI('https://api.github.com', { | |
| headers: { | |
| 'User-Agent': 'xyz', | |
| 'Authorization': `bearer ${token}` | |
| } | |
| }) |
NewerOlder