npx create-react-app@next --scripts-version=@next --template=cra-template@next my-js-app
npx create-react-app@next --scripts-version=@next --template=typescript@next my-ts-app
### Keybase proof | |
I hereby claim: | |
* I am iansu on github. | |
* I am iansu (https://keybase.io/iansu) on keybase. | |
* I have a public key whose fingerprint is B381 B817 42ED D871 EA20 F75D 50B9 2C39 4854 3ABC | |
To claim this, I am signing this object: |
cd() { | |
if [[ $1 =~ ^[\.]{3,}$ ]]; then | |
# rewrite ... as ../../ etc. | |
directory="../" | |
depth=${#1} | |
for i in `seq 3 $depth`; do | |
directory+=../ | |
done |
for i in 1..100 | |
print "#{i} " | |
print "fizz" if i % 3 == 0 | |
print "buzz" if i % 5 == 0 | |
print "\n" | |
end |
_enter_dir() { | |
local git_root | |
git_root=$(git rev-parse --show-toplevel 2>/dev/null) | |
if [[ "$git_root" == "$PREV_PWD" ]]; then | |
return | |
elif [[ -n "$git_root" && -f "$git_root/.nvmrc" ]]; then | |
nvm use | |
NVM_DIRTY=1 | |
elif [[ "$NVM_DIRTY" == 1 ]]; then |
Create React App 4.0 is currently in alpha and supports using React 17 and the new JSX transform. To use it, follow these instructions.
Create a new app with npx create-react-app@next --scripts-version=@next --template=cra-template@next my-js-app
import Butter from 'buttercms'; | |
const butter = Butter('api_key'); | |
const getHomePage = async () => { | |
const homePage = await butter.page.retrieve('*', 'sample-page'); | |
return homePage.data.data; | |
}; |
Display the architecture (arm64
or x86
) of the current shell in your prompt using Starship. I use zsh as my shell but you should be able to adapt this for other shells. As a bonus this also shows you how to set up your path to work with both arm64 and x86 versions of Homebrew.
Add this to your ~/.zshrc
:
if [[ $(arch) == 'arm64' ]]; then
export PATH="$HOME/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
export SHELL_ARCH="arm64"
echo '=========== arm64 ============'
else
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
// Menu: npm | |
// Description: Search npm | |
// Author: Ian Sutherland | |
// Twitter: @iansu | |
await arg("Search query:", async () => { | |
let query = await arg("Search query:") | |
exec(`open https://www.npmjs.com/search?q=${query}`) | |
}) |