Use this package.json
for initializing new npm packages. It will make the
package a pure ESM package. Feel free to fork this and replace the author and/or
license information.
This file contains 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/css/bootstrap.min.css"> | |
<style> | |
.completed { text-decoration: line-through; } |
If you are using Grunt to run your tests and Travis-CI for your continuous integration, you will need to command Travis-CI to install the grunt-cli before running your test script(s). grunt-cli is meant to be a global package, so adding it to your dependencies or devDependencies is not ideal.
You'll need the following your package.json
...
- Test script command
- Grunt and any plugins as dependencies
Like so:
{
This file contains 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
function getFilledArray<T>(value: T, n: number): T[] { | |
return Array(n).fill(value); | |
} | |
let stringArray: string[]; | |
let numberArray: number[]; | |
let personArray: {name: string, age: number}[]; | |
let coordinateArray: [number, number][]; | |
// Write your code below: |
This file contains 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
cargo watch -c -w src -x run | |
# -c : Clear the terminal before each reload | |
# -w : Which files to watch | |
# -x : What command to execute | |
# cargo-watch must be installed. | |
cargo install cargo-watch |
This file contains 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
git clone myusername@myserver:/home/git/myrepo | |
# `myusername` is your username on the server which hosts a bare git repository | |
# `myserver` is a `Host` configured in `~/.ssh/config` on your local machine | |
# `/home/git/myrepo` is the path to the bare repository on the server |
This file contains 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 { useState } from 'react' | |
import { useRouter } from 'next/router'; | |
import { Listbox } from '@headlessui/react' | |
import { ChevronUpDownIcon } from '@heroicons/react/20/solid' | |
import queryString from "query-string"; | |
export interface FilterOption { | |
value: string; | |
label: string; | |
} |
The git pre-commit hook and the VS Code settings I use when developing Svelte apps.
Install the VS Code extension:
- Open VS Code
- Ctrl + Shift + X
- Search for "ESLint"
- Click the blue "Install" button
In your project, install the dependencies
This file contains 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
// A pattern I often find myself using consists of a report-type page that | |
// displays any amount of data. At the top of that page is a `<form>` containing | |
// one or more `<select>` elements whose purpose is to filter the data on the | |
// report. | |
// The form uses `method="GET"`, which is great to make sure that the URL stays | |
// in line with what the page shows. A user can bookmark/favorite the URL and | |
// come back to it later. A user can share the URL so other users can see | |
// exactly the same page. |
OlderNewer