├── public ├── robots.txt ├── _headers ├── assets │ └── favicon.png └── _redirects ├── .ruby-version ├── .node-version ├── src ├── components │ ├── gaEnabled.tsx │ ├── V2017Sheet │ │ ├── NoticeBox.astro │ │ ├── SearchFooter.astro │ │ ├── RelatedPostItem.astro │ │ └── SearchForm.script.ts │ ├── V2017 │ │ ├── PushButton.astro │ │ └── CarbonBox.astro │ ├── V2017Home │ │ ├── FeaturedPages.astro │ │ ├── PageListItem.astro │ │ └── Announcements.astro │ ├── SEO │ │ └── SEO.astro │ ├── BaseLayout.astro │ └── SocialList.astro ├── env.d.ts ├── sass │ ├── 2017 │ │ ├── placeholders │ │ │ └── push-button.scss │ │ ├── utils │ │ │ ├── _font-size.scss │ │ │ ├── _gutter.scss │ │ │ ├── _section-gutter.scss │ │ │ ├── _section-with-container.scss │ │ │ └── _heading-style.scss │ │ ├── markdown │ │ │ ├── a-em.scss │ │ │ ├── ul.scss │ │ │ ├── headings.scss │ │ │ └── p.scss │ │ ├── _utils.scss │ │ └── components │ │ │ ├── announcements-list.scss │ │ │ ├── related-posts-area.scss │ │ │ ├── pre-footer.scss │ │ │ ├── related-posts-group.scss │ │ │ ├── notice-box.scss │ │ │ ├── comments-section.scss │ │ │ ├── intro-content.scss │ │ │ ├── related-post-list.scss │ │ │ ├── hint-mark.scss │ │ │ ├── comments-area.scss │ │ │ ├── search-footer.scss │ │ │ ├── h2-section.scss │ │ │ ├── push-button.scss │ │ │ ├── autocomplete.scss │ │ │ ├── home-button.scss │ │ │ ├── missing-message.scss │ │ │ ├── back-button.scss │ │ │ ├── comments-details.scss │ │ │ ├── h3-section-list.scss │ │ │ ├── main-heading.scss │ │ │ ├── related-posts-callout.scss │ │ │ ├── pages-list.scss │ │ │ ├── related-posts-section.scss │ │ │ ├── related-post-item.scss │ │ │ └── announcements-item.scss │ └── full.scss ├── styles │ └── CommonStyles.ts ├── ruby │ ├── kramdown.rb │ ├── cache_kramdown.rb │ └── renderer.rb ├── pages │ ├── test_scenarios │ │ └── seo_tags_test.astro │ ├── searchindex.json.ts │ ├── __tests__ │ │ ├── searchindex.json.test.ts │ │ └── sitemap.xml.test.ts │ ├── [...slug].astro │ ├── sitemap.xml.ts │ └── 404.astro ├── scripts │ └── v2017 │ │ ├── helpers │ │ ├── preview.js │ │ ├── qs.js │ │ ├── data.js │ │ ├── dismiss.js │ │ ├── inject_disqus.js │ │ └── store.js │ │ ├── _utils.scss │ │ └── behaviors_2 │ │ ├── no-preview.js │ │ ├── dismissable.js │ │ ├── dismiss.js │ │ ├── disqus.js │ │ └── anchors.js ├── analytics │ ├── CloudflareAnalytics.astro │ └── GoogleAnalytics.astro ├── lib │ ├── domutils │ │ └── onScrollVisible.ts │ ├── links.ts │ ├── page │ │ └── accessors.ts │ ├── fuseSearch │ │ ├── __snapshots__ │ │ │ └── fuseSearch.test.ts.snap │ │ ├── fuseSearch.test.ts │ │ └── fuseSearch.ts │ └── seo │ │ └── jsonJd.test.ts └── types │ ├── JsonLdDocument.ts │ └── SheetFrontmatter.ts ├── jinja2.md ├── sh.md ├── .prettierignore ├── jade.md ├── package.md ├── Gemfile ├── .github ├── images │ ├── screenshot.png │ └── gitpod_preview_tut.png └── workflows │ └── build.yml ├── postcss.config.js ├── .vscode ├── extensions.json ├── markdown.code-snippets └── launch.json ├── phoenix-ecto@1.3.md ├── .prettierrc ├── tests ├── basic.md └── keywords_test.md ├── index.md ├── index@2016.md ├── jquery-cdn.md ├── strftime.md ├── tsconfig.json ├── vite.config.js ├── sh-pipes.md ├── .gitignore ├── freenode.md ├── nodejs-assert.md ├── Gemfile.lock ├── nocode.md ├── passenger.md ├── simple_form.md ├── browser-sync.md ├── man.md ├── appcache.md ├── rack-test.md ├── emacs.md ├── ansible-examples.md ├── datetime.md ├── perl-pie.md ├── nock.md ├── ansible-roles.md ├── mixpanel.md ├── cidr.md ├── ncftp.md ├── rake.md ├── html-share.md ├── inkscape.md ├── playwright.config.ts ├── ubuntu.md ├── html-microformats.md ├── js-speech.md ├── postgresql.md ├── premailer.md ├── frequency-separation-retouching.md ├── animated_gif.md ├── analytics.md ├── ledger-query.md ├── phoenix@1.2.md ├── handlebars.js.md ├── social-images.md ├── harvey.js.md ├── google-webfonts.md ├── nodejs-path.md ├── ruby21.md ├── saucelabs.md ├── virtual-dom.md ├── watchman.md ├── spreadsheet.md ├── gh-pages.md ├── ledger-csv.md ├── css-antialias.md ├── ansi.md ├── vagrant.md ├── zombie.md ├── commander.js.md ├── rename.md ├── top.md ├── applinks.md ├── immutable.js.md ├── ie_bugs.md ├── astro.config.mjs ├── elixir-metaprogramming.md ├── flashlight.md ├── sql-join.md ├── qunit.md ├── znc.md ├── cordova.md ├── siege.md ├── README.md ├── analytics.js.md ├── less.md ├── haml.md ├── mocha.md ├── js-lazy.md ├── nodejs-process.md ├── jquery.md ├── vimscript-snippets.md ├── bookshelf.md ├── rubygems.md ├── weinre.md ├── blessed.md ├── js-appcache.md ├── tape.md ├── .eslintrc.cjs ├── chunky_png.md ├── pass.md ├── ets.md ├── dom-selection.md ├── mocha-tdd.md ├── ledger-periods.md ├── macos-mouse-acceleration.md ├── scp.md ├── nopt.md ├── vows.md ├── modernizr.md ├── mocha-html.md ├── yaml.md ├── applescript.md ├── bolt.md ├── test └── e2eUtils.ts ├── make-assets.md ├── deis.md ├── parsimmon.md ├── css-system-font-stack.md ├── google_analytics.md ├── ledger-examples.md ├── clip.md ├── jscoverage.md ├── rst.md ├── web-workers.md ├── browserify.md ├── imagemagick.md ├── ledger-format.md ├── machinist.md ├── AGENTS.md ├── c_preprocessor.md ├── bundler.md ├── nodejs.md ├── meow.md ├── js-model.md ├── weechat.md ├── deku.md ├── tomdoc.md ├── mocha-blanket.md ├── watchexec.md ├── dom-range.md ├── linux.md ├── nodejs-fs.md ├── projectionist.md ├── rails-tricks.md ├── kramdown.md ├── tailwind.config.mjs ├── umdjs.md ├── tar.md ├── rtorrent.md ├── yargs.md ├── sequelize.md ├── moment.md └── awscli.md /public/robots.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 3.2.2 2 | -------------------------------------------------------------------------------- /.node-version: -------------------------------------------------------------------------------- 1 | 22.21.1 2 | -------------------------------------------------------------------------------- /src/components/gaEnabled.tsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /src/sass/2017/placeholders/push-button.scss: -------------------------------------------------------------------------------- 1 | // noop 2 | -------------------------------------------------------------------------------- /jinja2.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: jinja 3 | category: python 4 | redirect_to: /jinja 5 | --- 6 | -------------------------------------------------------------------------------- /public/_headers: -------------------------------------------------------------------------------- 1 | /_astro/* 2 | Cache-Control: public, max-age=31536000, immutable 3 | -------------------------------------------------------------------------------- /sh.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Shell scripting 3 | category: CLI 4 | redirect_to: /bash 5 | --- 6 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | src/sass/vendor 2 | vendor 3 | .cache 4 | dist 5 | *.md 6 | pnpm-lock.yaml 7 | -------------------------------------------------------------------------------- /jade.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Jade 3 | category: JavaScript libraries 4 | redirect_to: /pug 5 | --- 6 | -------------------------------------------------------------------------------- /package.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: package.json 3 | category: Hidden 4 | redirect_to: /package.json 5 | --- 6 | -------------------------------------------------------------------------------- /public/assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rstacruz/cheatsheets/master/public/assets/favicon.png -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | gem "minitest" 3 | gem "kramdown" 4 | gem "kramdown-parser-gfm" 5 | -------------------------------------------------------------------------------- /src/sass/2017/utils/_font-size.scss: -------------------------------------------------------------------------------- 1 | @mixin font-size($n) { 2 | @include ms-respond(font-size, $n); 3 | } 4 | -------------------------------------------------------------------------------- /.github/images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rstacruz/cheatsheets/master/.github/images/screenshot.png -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {} 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["astro-build.astro-vscode"], 3 | "unwantedRecommendations": [] 4 | } 5 | -------------------------------------------------------------------------------- /src/styles/CommonStyles.ts: -------------------------------------------------------------------------------- 1 | export const typeStyles = { 2 | manrope: 'font-manrope font-extrabold tracking-[-0.02em]' 3 | } 4 | -------------------------------------------------------------------------------- /.github/images/gitpod_preview_tut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rstacruz/cheatsheets/master/.github/images/gitpod_preview_tut.png -------------------------------------------------------------------------------- /src/ruby/kramdown.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative 'renderer' 4 | puts Renderer.render(input: $stdin.read) 5 | -------------------------------------------------------------------------------- /phoenix-ecto@1.3.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Phoenix: Ecto models" 3 | category: Hidden 4 | redirect_to: /phoenix-ecto 5 | deprecated: true 6 | --- 7 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "trailingComma": "none", 5 | "plugins": ["prettier-plugin-astro"] 6 | } 7 | -------------------------------------------------------------------------------- /src/pages/test_scenarios/seo_tags_test.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import SEO from '~/components/SEO/SEO.astro' 3 | --- 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/basic.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Basic test" 3 | category: Hidden 4 | --- 5 | 6 | ### Introduction 7 | 8 | This is a test cheatsheet. It's used as a reference for automated tests. 9 | -------------------------------------------------------------------------------- /.vscode/markdown.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Test snip": { 3 | "prefix": ["about"], 4 | "body": "Copyright. Foo Corp 2028", 5 | "description": "Adds copyright...", 6 | "scope": "markdown" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/sass/2017/markdown/a-em.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * For links with sources, eg, 3 | * [Foo](foo.com) _(foo.com)_ 4 | */ 5 | 6 | .MarkdownBody.MarkdownBody { 7 | a + em { 8 | opacity: 0.5; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/scripts/v2017/helpers/preview.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks if we're in preview mode (?preview=1). 3 | */ 4 | 5 | export function isPreview() { 6 | return window.location.search.indexOf('preview=1') !== -1 7 | } 8 | -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | --- 2 | full_title: "Devhints — TL;DR for developer documentation" 3 | description: "A ridiculous collection of web development cheatsheets" 4 | layout: 2017/home 5 | og_type: website 6 | type: home 7 | --- 8 | -------------------------------------------------------------------------------- /src/sass/2017/utils/_gutter.scss: -------------------------------------------------------------------------------- 1 | @mixin gutter($property, $multiplier: 1) { 2 | #{$property}: $gut * $multiplier; 3 | 4 | @media (max-width: 480px) { 5 | #{$property}: $gut-small * $multiplier; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /index@2016.md: -------------------------------------------------------------------------------- 1 | --- 2 | full_title: "Devhints — for web development and more" 3 | description: "TL;DR for developer documentation - a ridiculous collection of cheatsheets" 4 | layout: home 5 | type: home 6 | og_type: website 7 | --- 8 | -------------------------------------------------------------------------------- /src/sass/2017/utils/_section-gutter.scss: -------------------------------------------------------------------------------- 1 | @mixin section-gutter($property, $multiplier: 1) { 2 | #{$property}: 16px * $multiplier; 3 | 4 | @media (max-width: $area-width + 32px) { 5 | #{$property}: 8px * $multiplier; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/sass/2017/utils/_section-with-container.scss: -------------------------------------------------------------------------------- 1 | @mixin section-with-container { 2 | & > .container { 3 | @include gutter(padding-left); 4 | @include gutter(padding-right); 5 | max-width: $area-width; 6 | margin: 0 auto; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /jquery-cdn.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: jQuery CDN 3 | category: JavaScript libraries 4 | tags: [Archived] 5 | --- 6 | 7 | ### Google jQuery 8 | 9 | ```html 10 | 11 | ``` 12 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "command": "./node_modules/.bin/astro dev", 6 | "name": "Development server", 7 | "request": "launch", 8 | "type": "node-terminal" 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /src/components/V2017Sheet/NoticeBox.astro: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | --- 4 | 5 | 8 | 9 | 13 | -------------------------------------------------------------------------------- /strftime.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: strftime format 3 | weight: -5 4 | updated: 2017-11-27 5 | tags: [Featurable] 6 | intro: | 7 | The strftime format is the standard date formatting for UNIX. It's used in C, Ruby, and more. 8 | --- 9 | 10 | {% include common/strftime_format.md title="strftime" %} 11 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "astro/tsconfigs/strict", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "types": ["vitest/globals" /* https://vitest.dev/config/#globals */], 6 | "plugins": [{ "name": "@astrojs/ts-plugin" }], 7 | "paths": { 8 | "~/*": ["src/*"] 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/analytics/CloudflareAnalytics.astro: -------------------------------------------------------------------------------- 1 | --- 2 | type Props = { token: string } 3 | const props = Astro.props as Props 4 | const { token } = props 5 | --- 6 | 7 | 12 | -------------------------------------------------------------------------------- /tests/keywords_test.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Intro test 3 | category: Hidden 4 | updated: 2020-07-05 5 | keywords: 6 | - Variables 7 | - Functions 8 | - Interpolation 9 | - Brace expansions 10 | - Loops 11 | - Conditional execution 12 | - Command substitution 13 | --- 14 | 15 | ### Example test 16 | This page has keywords. 17 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { fileURLToPath, URL } from 'url' 2 | import { defineConfig } from 'vitest/config' 3 | 4 | export default defineConfig({ 5 | test: { 6 | globals: true, 7 | environment: 'jsdom' 8 | }, 9 | resolve: { 10 | alias: { 11 | '~': fileURLToPath(new URL('./src', import.meta.url)) 12 | } 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /sh-pipes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Shell: named pipes" 3 | category: CLI 4 | --- 5 | 6 | ### Named pipes 7 | 8 | ```sh 9 | diff <(ls ./old) <(ls ./new) 10 | ``` 11 | 12 | This creates a virtual file with the contents of the output of `ls ./old`. 13 | 14 | ### References 15 | 16 | * [Named pipe](https://en.wikipedia.org/wiki/Named_pipe) _(wikipedia.org)_ 17 | -------------------------------------------------------------------------------- /src/sass/2017/_utils.scss: -------------------------------------------------------------------------------- 1 | // Vendor 2 | @import './variables'; 3 | @import '../vendor/ionicons-inline/ionicons'; 4 | @import '../vendor/modularscale/modularscale'; 5 | 6 | // Utilities 7 | @import './utils/font-size'; 8 | @import './utils/gutter'; 9 | @import './utils/heading-style'; 10 | @import './utils/section-gutter'; 11 | @import './utils/section-with-container'; 12 | -------------------------------------------------------------------------------- /src/sass/2017/components/announcements-list.scss: -------------------------------------------------------------------------------- 1 | .announcements-list { 2 | & { 3 | position: fixed; 4 | left: 0; 5 | bottom: 0; 6 | max-width: 420px; 7 | padding: 0; 8 | z-index: 10; 9 | } 10 | 11 | @media (min-width: 481px) { 12 | padding: 16px; 13 | } 14 | 15 | @media (min-width: 769px) { 16 | padding: 32px; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/sass/2017/components/related-posts-area.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Related posts 3 | */ 4 | 5 | .related-posts-area { 6 | & { 7 | @include section-with-container; 8 | padding-top: 16px; 9 | padding-bottom: 16px; 10 | background: $gray-bg; 11 | } 12 | 13 | @media (min-width: 481px) { 14 | padding-top: 64px; 15 | padding-bottom: 64px; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # build output 2 | dist/ 3 | # generated types 4 | .astro/ 5 | 6 | # dependencies 7 | node_modules/ 8 | 9 | # logs 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | pnpm-debug.log* 14 | 15 | 16 | # environment variables 17 | .env 18 | .env.production 19 | 20 | # macOS-specific files 21 | .DS_Store 22 | 23 | .cache 24 | 25 | # playwright 26 | test-results 27 | -------------------------------------------------------------------------------- /src/sass/2017/components/pre-footer.scss: -------------------------------------------------------------------------------- 1 | /* 2 | content: ''; 3 | * Spacer before footer 4 | */ 5 | 6 | .pre-footer { 7 | & { 8 | padding: 32px; 9 | padding-top: 24px; 10 | padding-bottom: 48px; 11 | text-align: center; 12 | } 13 | 14 | & > .icon::before { 15 | content: ''; 16 | @include ion-ios-flash(32px, $base-mute); 17 | opacity: 0.25; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/sass/2017/components/related-posts-group.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Group 3 | */ 4 | 5 | .related-posts-group { 6 | & > h3 { 7 | @include font-size(1); 8 | color: $base-a; 9 | margin: 0; 10 | padding: 0; 11 | margin-bottom: 16px; 12 | padding-bottom: 16px; 13 | border-bottom: solid 1px $dark-line-color; 14 | line-height: 1.2; 15 | font-weight: 400; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/sass/2017/utils/_heading-style.scss: -------------------------------------------------------------------------------- 1 | @mixin heading-style { 2 | margin: 0; 3 | padding: 0; 4 | margin-bottom: 16px + 8px; 5 | margin-top: 64px; 6 | position: relative; 7 | 8 | @media (max-width: 768px) { 9 | margin-bottom: 8px; 10 | margin-top: 32px; 11 | } 12 | 13 | @media (max-width: 480px) { 14 | margin-bottom: 8px; 15 | margin-top: 32px; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /freenode.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Freenode 3 | tags: [WIP] 4 | --- 5 | 6 | ### IRC server 7 | 8 | ``` 9 | irc.freenode.net 10 | ``` 11 | 12 | ### NickServ commands 13 | 14 | ``` 15 | /msg nickserv identify [nick] 16 | /msg nickserv info 17 | ``` 18 | 19 | ### Add a nick 20 | 21 | ``` 22 | /nick newnick 23 | /msg nickserv identify 24 | /msg nickserv group 25 | ``` 26 | -------------------------------------------------------------------------------- /nodejs-assert.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: assert 3 | category: Node.js 4 | --- 5 | 6 | ### Assertions 7 | 8 | ```js 9 | assert(val) 10 | assert.equal(actual, expected) 11 | assert.notEqual(a, e) 12 | ``` 13 | 14 | ```js 15 | assert.deepEqual(a, e) 16 | assert.notDeepEqual(a, e) 17 | ``` 18 | 19 | ```js 20 | assert.throws(fn) 21 | ``` 22 | 23 | ### References 24 | 25 | - http://nodejs.org/api/assert.html 26 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | kramdown (2.4.0) 5 | rexml 6 | kramdown-parser-gfm (1.1.0) 7 | kramdown (~> 2.0) 8 | minitest (5.18.0) 9 | rexml (3.2.5) 10 | 11 | PLATFORMS 12 | aarch64-linux-android 13 | x86_64-linux 14 | 15 | DEPENDENCIES 16 | kramdown 17 | kramdown-parser-gfm 18 | minitest 19 | 20 | BUNDLED WITH 21 | 2.4.1 22 | -------------------------------------------------------------------------------- /nocode.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Nocode 3 | updated: 2018-03-17 4 | intro: | 5 | [Nocode](https://github.com/kelseyhightower/nocode) is the best way to write secure and reliable applications. Write nothing; deploy nowhere. 6 | --- 7 | 8 | ## Nothing 9 | {: .-one-column} 10 | 11 |































12 | -------------------------------------------------------------------------------- /passenger.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Phusion Passenger 3 | tags: [WIP] 4 | --- 5 | 6 | ### Enabling Phusion passenger 7 | 8 | ``` 9 | server { 10 | listen 80; 11 | server_name www.yourhost.com; 12 | root /somewhere/public; # <--- be sure to point to 'public'! 13 | passenger_enabled on; 14 | autoindex on; # Show directory listings 15 | } 16 | ``` 17 | 18 | This is an example nginx configuration. 19 | -------------------------------------------------------------------------------- /simple_form.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SimpleForm 3 | tags: [WIP] 4 | --- 5 | 6 | ### Inputs 7 | 8 | ```ruby 9 | <%= f.input :email, required: false, autofocus: true %> 10 | <%= f.input :password, required: false %> 11 | <%= f.input :remember_me, as: :boolean %> 12 | <%= f.button :submit, "Sign in" %> 13 | ``` 14 | 15 | ### Adding a wrapper 16 | 17 | ```ruby 18 | simple_form_for @x, wrapper: :small 19 | ``` 20 | -------------------------------------------------------------------------------- /src/sass/2017/components/notice-box.scss: -------------------------------------------------------------------------------- 1 | .notice-box { 2 | & { 3 | margin-bottom: 24px; 4 | color: $base-mute; 5 | } 6 | 7 | @media (max-width: 480px) { 8 | margin-bottom: 16px; 9 | } 10 | 11 | &::before { 12 | content: ''; 13 | @include ion-md-information-circle(24px, $base-mute3); 14 | margin-right: 8px; 15 | } 16 | 17 | & > a { 18 | text-decoration: none; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /browser-sync.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Browsersync 3 | category: JavaScript libraries 4 | --- 5 | 6 | ### About 7 | {: .-intro} 8 | 9 | `npm i -g browser-sync` 10 | 11 | * [browsersync.io](https://browsersync.io) 12 | 13 | ### Start a server 14 | 15 | ```sh 16 | browser-sync start --server --files='**/*.html, **/*.css' 17 | ``` 18 | 19 | ### Options 20 | 21 | ```sh 22 | --port=N 23 | --proxy="http://127.0.0.1:3000" 24 | ``` 25 | -------------------------------------------------------------------------------- /src/components/V2017/PushButton.astro: -------------------------------------------------------------------------------- 1 | --- 2 | export type Props = { 3 | class?: string 4 | } 5 | const props = Astro.props as Props 6 | --- 7 | 8 |
9 | 10 |
11 | 12 | 17 | -------------------------------------------------------------------------------- /src/scripts/v2017/_utils.scss: -------------------------------------------------------------------------------- 1 | // Vendor 2 | @import '../_sass/2017/variables.scss'; 3 | @import '../_sass/vendor/ionicons-inline/ionicons.scss'; 4 | 5 | // Utilities 6 | @import '../_sass/2017/utils/_font-size.scss'; 7 | @import '../_sass/2017/utils/gutter.scss'; 8 | @import '../_sass/2017/utils/heading-style.scss'; 9 | @import '../_sass/2017/utils/section-gutter.scss'; 10 | @import '../_sass/2017/utils/section-with-container.scss'; 11 | -------------------------------------------------------------------------------- /man.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Man 3 | category: CLI 4 | --- 5 | 6 | ### Man paths 7 | 8 | | `1` | General User Commands | 9 | | `2` | System Calls | 10 | | `3` | Library Routines | 11 | | `4` | Special Files and Sockets | 12 | | `5` | File formats and Conventions | 13 | | `6` | Games and Fun Stuff | 14 | | `7` | Miscellaneous Documentation | 15 | | `8` | System Administration | 16 | | `9` | Kernel and Programming Style | 17 | | `n` | Tcl/Tk | 18 | -------------------------------------------------------------------------------- /src/scripts/v2017/behaviors_2/no-preview.js: -------------------------------------------------------------------------------- 1 | import { isPreview } from '../helpers/preview' 2 | 3 | /* 4 | * Behavior: Things to remove when preview mode is on 5 | */ 6 | 7 | export function setupNoPreview() { 8 | document.querySelectorAll('[data-js-no-preview]').forEach((el) => { 9 | if (isPreview()) { 10 | el.parentNode.removeChild(el) 11 | document.documentElement.classList.add('PreviewMode') 12 | } 13 | }) 14 | } 15 | -------------------------------------------------------------------------------- /appcache.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Appcache 3 | category: HTML 4 | --- 5 | 6 | ### Format 7 | 8 | ``` 9 | CACHE MANIFEST 10 | # version 11 | 12 | CACHE: 13 | https://www.google.com/jsapi 14 | /assets/app.js 15 | /assets/bg.png 16 | 17 | NETWORK: 18 | * 19 | ``` 20 | 21 | Note that Appcache is deprecated! 22 | 23 | See: [Using the application cache](https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache) _(developer.mozilla.org)_ 24 | -------------------------------------------------------------------------------- /rack-test.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: rack-test 3 | category: Ruby libraries 4 | --- 5 | 6 | ### Methods 7 | 8 | ```ruby 9 | get 'url' 10 | post 'url', 'name' => 'john' 11 | put 12 | patch 13 | delete 14 | options 15 | head 16 | ``` 17 | 18 | ```ruby 19 | authorize 'user', 'pass' 20 | env 'rack.session', csrf: 'token' 21 | header 'Content-Type', 'text/html' 22 | ``` 23 | 24 | See [rack/test.rb](https://github.com/brynary/rack-test/blob/master/lib/rack/test.rb). 25 | -------------------------------------------------------------------------------- /emacs.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Emacs 3 | category: CLI 4 | --- 5 | 6 | ### Movements 7 | 8 | ^n ^p # up/down 9 | ^f ^b # left/right 10 | 11 | ^v Mv # up/down page 12 | 13 | ^a ^e # begin/end of line 14 | Ma Me # begin/end of sentence 15 | 16 | ### Basic 17 | 18 | ^x ^f # find file 19 | ^x ^s # save file 20 | 21 | ### Command line 22 | 23 | Mx 24 | 25 | ### Packages 26 | 27 | Mx package-install RET evil RET 28 | -------------------------------------------------------------------------------- /ansible-examples.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Ansible examples 3 | category: Ansible 4 | --- 5 | 6 | ### Examples 7 | 8 | * [Ruby installation](https://github.com/chelsea/ansible-example-ruby/blob/master/roles/webserver/tasks/main.yml) _(github.com)_ 9 | * [Postgres installation](https://github.com/chelsea/ansible-example-ruby/blob/master/roles/db/tasks/main.yml) _(github.com)_ 10 | * [GitLab installation](https://github.com/tingtun/ansible-playbook-gitlab) _(github.com)_ 11 | -------------------------------------------------------------------------------- /datetime.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Date & time formats 3 | weight: -5 4 | updated: 2017-11-27 5 | tags: [Featurable] 6 | --- 7 | 8 | ## Common time formats 9 | {: .-one-column} 10 | 11 | - [UNIX strftime](./strftime) - Used by Ruby, `date`, and more 12 | - [Moment.js](./moment#formatting) - Used by Moment.js, date-fns, and more 13 | 14 | {% include common/strftime_format.md title="strftime format" %} 15 | 16 | {% include common/moment_format.md title="Moment.js format" %} 17 | -------------------------------------------------------------------------------- /src/pages/searchindex.json.ts: -------------------------------------------------------------------------------- 1 | import { buildFuseIndex } from '~/lib/fuseSearch/fuseSearch' 2 | import { getPages } from '~/lib/page' 3 | 4 | /* 5 | * Returns a search index that can be hydrated later 6 | */ 7 | 8 | export async function GET() { 9 | const result = buildFuseIndex(await getPages()) 10 | return new Response(JSON.stringify(result), { 11 | status: 200, 12 | headers: { 13 | 'Content-Type': 'application/json' 14 | } 15 | }) 16 | } 17 | -------------------------------------------------------------------------------- /perl-pie.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Perl-pie 3 | category: Development 4 | --- 5 | 6 | ### About 7 | {: .-intro} 8 | 9 | Use `perl` to search and replace across many files. 10 | 11 | ### Search and replace 12 | 13 | ```sh 14 | perl -p -i -e 's/hello/hola/g' *.txt 15 | ``` 16 | 17 | ### Back-referencing 18 | 19 | Use `\1` et al. 20 | 21 | ```sh 22 | # '@include align-items(center);' => 'align-items: center;' 23 | perl -p -i -e "s/\@include (align-items)\((.*)\);/\1: \2;/g" 24 | ``` 25 | -------------------------------------------------------------------------------- /src/sass/2017/components/comments-section.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Disqus 3 | */ 4 | 5 | .comments-section { 6 | & { 7 | display: flex; 8 | } 9 | 10 | // Mobile: full width 11 | @media (max-width: 768px) { 12 | & > .comments { 13 | flex: 1 0 100%; 14 | width: 100%; 15 | } 16 | } 17 | 18 | // Desktop: partial width 19 | @media (min-width: 769px) { 20 | & > .comments { 21 | flex: 0 1 66%; 22 | min-width: 300px; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/components/V2017Home/FeaturedPages.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import type { SheetPage } from '~/lib/page' 3 | import PageListItem from './PageListItem.astro' 4 | 5 | export type Props = { 6 | pages: SheetPage[] 7 | } 8 | 9 | const props = Astro.props as Props 10 | --- 11 | 12 | {props.pages.map((page) => )} 13 | 14 | 18 | -------------------------------------------------------------------------------- /src/sass/2017/components/intro-content.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * A prelude/intro to the article 3 | */ 4 | 5 | .intro-content { 6 | // Horizontal line, but I don't like how it looks! 7 | // &::before { 8 | // content: ''; 9 | // display: block; 10 | // margin-bottom: 16px; 11 | // height: 1px; 12 | // background: linear-gradient(to right, $dark-line-color, transparent 50%); 13 | 14 | // @media (min-width: 769px) { 15 | // margin-bottom: 32px; 16 | // } 17 | // } 18 | } 19 | -------------------------------------------------------------------------------- /src/scripts/v2017/helpers/qs.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Helper: minimal qs implementation 3 | */ 4 | 5 | export default function qs(search) { 6 | search = search.substr(1) 7 | const parts = search.split('&').map((p) => p.split('=')) 8 | return parts.reduce((result, part) => { 9 | result[part[0]] = qsdecode(part[1]) 10 | return result 11 | }, {}) 12 | } 13 | 14 | export function qsdecode(string) { 15 | if (!string) string = '' 16 | string = string.replace(/\+/g, ' ') 17 | return string 18 | } 19 | -------------------------------------------------------------------------------- /nock.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Nock 3 | category: JavaScript libraries 4 | --- 5 | 6 | ### Nock 7 | 8 | ```js 9 | scope = nock('http://foo.com') 10 | scope = nock('http://foo.com', { allowUnmocked: true }) 11 | ``` 12 | 13 | ```js 14 | nock('http://foo.com') 15 | .get('/user') 16 | .reply(200, { id: 1234 }) 17 | ``` 18 | 19 | ### Filtering 20 | 21 | ```js 22 | nock('http://foo.com') 23 | .filteringPath(/[&\?]token=[^&]*/g, '') 24 | .get('/user') 25 | 26 | // catches "/user?token=..." as well 27 | ``` 28 | -------------------------------------------------------------------------------- /src/sass/2017/components/related-post-list.scss: -------------------------------------------------------------------------------- 1 | .related-post-list { 2 | &, 3 | & > li { 4 | margin: 0; 5 | padding: 0; 6 | list-style-type: none; 7 | } 8 | 9 | & { 10 | display: flex; 11 | margin: -4px; 12 | flex-wrap: wrap; 13 | } 14 | 15 | @media (max-width: 768px) { 16 | flex-wrap: wrap; 17 | } 18 | 19 | & > .item { 20 | flex: 1 1 auto; 21 | margin: 4px; 22 | 23 | @media (min-width: 481px) { 24 | flex: 1 1 40%; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ansible-roles.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Ansible roles 3 | category: Ansible 4 | --- 5 | 6 | ### Structure 7 | 8 | roles/ 9 | common/ 10 | tasks/ 11 | handlers/ 12 | files/ # 'copy' will refer to this 13 | templates/ # 'template' will refer to this 14 | meta/ # Role dependencies here 15 | vars/ 16 | defaults/ 17 | main.yml 18 | 19 | ### References 20 | 21 | * http://www.ansibleworks.com/docs/playbooks_roles.html 22 | -------------------------------------------------------------------------------- /mixpanel.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Mixpanel 3 | category: Analytics 4 | --- 5 | 6 | ### Identify 7 | 8 | ```js 9 | mixpanel.identify('284') 10 | mixpanel.people.set({ $email: 'hi@gmail.com' }) 11 | ``` 12 | 13 | ```js 14 | // Set common properties 15 | mixpanel.register({ age: 28, gender: 'male' }) 16 | ``` 17 | 18 | ### Track events 19 | 20 | ```js 21 | mixpanel.track('Login success') 22 | mixpanel.track('Search', { query: 'cheese' }) 23 | ``` 24 | 25 | ### References 26 | 27 | * 28 | -------------------------------------------------------------------------------- /src/sass/2017/components/hint-mark.scss: -------------------------------------------------------------------------------- 1 | .hint-mark { 2 | & { 3 | cursor: help; 4 | } 5 | 6 | & > i::before { 7 | content: '?'; 8 | font-size: 11px; 9 | font-weight: bold; 10 | font-style: normal; 11 | } 12 | 13 | & > i { 14 | display: inline-block; 15 | width: 16px; 16 | height: 16px; 17 | line-height: 16px - 4px; 18 | text-align: center; 19 | border-radius: 50%; 20 | background: rgba($base-b3, 0.3); 21 | color: $base-mute; 22 | margin: 0 0.4em; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /cidr.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CIDR 3 | category: Misc 4 | updated: 2018-05-14 5 | --- 6 | 7 | ### CIDR ranges 8 | 9 | | Range | First IP | Last IP | 10 | | --- | --- | --- | 11 | | **10.0.0.0/24** | 10.0.0.0 | 10.0.0.255 | 12 | | **10.0.0.0/16** | 10.0.0.0 | 10.0.255.255 | 13 | | **10.0.0.0/8** | 10.0.0.0 | 10.255.255.255 | 14 | | **0.0.0.0/0** | (all) | (all) | 15 | 16 | ### Resources 17 | 18 | - [CIDR range calculator](http://ipaddressguide.com/cidr#range) _(ipaddressguide.com)_ 19 | -------------------------------------------------------------------------------- /src/scripts/v2017/behaviors_2/dismissable.js: -------------------------------------------------------------------------------- 1 | import { getData } from '../helpers/data' 2 | import { isDismissed } from '../helpers/dismiss' 3 | import { isPreview } from '../helpers/preview' 4 | 5 | export function setupDismissable() { 6 | document.querySelectorAll('[data-js-dismissable]').forEach((el) => { 7 | const id = getData(el, 'js-dismissable').id || '' 8 | 9 | if (isPreview() || isDismissed(id)) { 10 | el.parentNode.removeChild(el) 11 | } else { 12 | el.classList.remove('-hide') 13 | } 14 | }) 15 | } 16 | -------------------------------------------------------------------------------- /ncftp.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ncftp 3 | category: CLI 4 | --- 5 | 6 | ### Bookmarking 7 | 8 | ```bash 9 | $ ncftp 10 | $ open -u username ftp.host.com 11 | $ bookmark bookmarkname 12 | ``` 13 | 14 | ### Mass download 15 | 16 | ```bash 17 | $ ncftpget -R bookmarkname /www/ . 18 | ``` 19 | 20 | ### Mass upload 21 | 22 | ```bash 23 | $ ncftpput -R bookmarkname /www/ . 24 | ``` 25 | 26 | ### Upload just the changed files 27 | 28 | ```bash 29 | $ git show --pretty="format:" --name-only HEAD~1 30 | $ ncftpget -R -C log bookmarkname /www/ . 31 | ``` 32 | -------------------------------------------------------------------------------- /rake.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Rake 3 | category: Ruby 4 | --- 5 | 6 | ### Basic syntax 7 | 8 | ```rb 9 | namespace :foo do 10 | desc "Description" 11 | task :bar do 12 | ... 13 | end 14 | 15 | task :baz => :dependency do 16 | end 17 | 18 | task :baz => [:dep1, :dep2, :dep3] do 19 | end 20 | end 21 | 22 | # rake foo:bar 23 | ``` 24 | 25 | ### Rake task with arguments 26 | 27 | ```rb 28 | desc "Do something" 29 | task :workit, [:id] => :environment do |_, args| 30 | id = args[:id] 31 | end 32 | 33 | # rake workit[234] 34 | ``` 35 | -------------------------------------------------------------------------------- /src/pages/__tests__/searchindex.json.test.ts: -------------------------------------------------------------------------------- 1 | import { GET } from '../searchindex.json' 2 | 3 | test('has data', async () => { 4 | const response = await GET() 5 | const data = await response.json() 6 | expect(typeof data.index).toEqual('object') 7 | expect(Array.isArray(data.index.records)).toBeTruthy() 8 | expect(Array.isArray(data.rows)).toBeTruthy() 9 | 10 | for (const row of data.rows) { 11 | expect(typeof row.title).toBeTruthy() // some titles are numbers? 12 | expect(typeof row.slug).toEqual('string') 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /html-share.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Share links 3 | category: HTML 4 | updated: 2017-09-04 5 | --- 6 | 7 | ## Share links 8 | {: .-one-column} 9 | 10 | Facebook: 11 | {:.-setup} 12 | 13 | ```html 14 | 15 | ``` 16 | 17 | Twitter: 18 | {:.-setup} 19 | 20 | ```html 21 | 22 | ``` 23 | 24 | Google Plus: 25 | {:.-setup} 26 | 27 | ```html 28 | 29 | ``` 30 | -------------------------------------------------------------------------------- /inkscape.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Inkscape 3 | category: Apps 4 | tags: [WIP] 5 | --- 6 | 7 | ### All 8 | 9 | | `-` _/_ `=` | Zoom in/out 10 | | `3` _/_ `4` | Zoom to selection / drawing 11 | | `5` _/_ `6` | Zoom to page / page width 12 | {: .-shortcuts} 13 | 14 | ### Select tool (F1) 15 | 16 | | `[ ]` | Rotate 17 | {: .-shortcuts} 18 | 19 | ### Edit path (F2) 20 | 21 | | `Ctrl` | constraint 22 | {: .-shortcuts} 23 | 24 | ### Dragging an anchor handle 25 | 26 | | `Ctrl` | snap to 15 degrees 27 | | `Alt` | ? 28 | {: .-shortcuts} 29 | 30 | ### Bezier (Shift F6) 31 | -------------------------------------------------------------------------------- /src/scripts/v2017/helpers/data.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Stores and retrieves data from an element. Works like jQuery.data(). 3 | */ 4 | 5 | export function data(el, key, val) { 6 | if (typeof val !== 'undefined') { 7 | return getData(el, key) 8 | } else { 9 | return setData(el, key, val) 10 | } 11 | } 12 | 13 | export function getData(el, key) { 14 | const str = el.getAttribute('data-' + key) 15 | return JSON.parse(str || '{}') 16 | } 17 | 18 | export function setData(el, key, val) { 19 | el.setAttribute('data-' + key, JSON.stringify(val)) 20 | } 21 | -------------------------------------------------------------------------------- /src/components/V2017Home/PageListItem.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import type { SheetPage } from '../../lib/page' 3 | 4 | export type Props = { 5 | page: SheetPage 6 | class?: string 7 | } 8 | const props = Astro.props as Props 9 | const page = props.page 10 | const url = `/${page.slug}` 11 | --- 12 | 13 | 14 | 15 | {page.slug} 16 | 17 | {page.frontmatter.title ?? page.slug} 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/sass/2017/components/comments-area.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Disqus 3 | */ 4 | 5 | .comments-area { 6 | & { 7 | margin: 32px 0 16px 0; 8 | } 9 | 10 | // Container 11 | & > .container { 12 | @include gutter(padding-left); 13 | @include gutter(padding-right); 14 | max-width: $area-width; 15 | margin: 0 auto; 16 | } 17 | 18 | // Horizontal line 19 | & > .container::before { 20 | content: ''; 21 | display: block; 22 | background: linear-gradient(to right, $dark-line-color 50%, transparent); 23 | height: 1px; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /playwright.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from '@playwright/test' 2 | 3 | const port = process.env.PORT ?? 4321 4 | 5 | const isCI = Boolean(process.env.CI) 6 | 7 | export default defineConfig({ 8 | testMatch: /.*\.e2e\.[^.]*/, 9 | webServer: { 10 | command: `npm run dev -- --port ${port}`, 11 | url: `http://localhost:${port}/`, 12 | reuseExistingServer: !isCI /* Spawn dev server on CI */ 13 | }, 14 | expect: { 15 | timeout: isCI ? 5000 : 2500 /* default: 5000 */ 16 | }, 17 | use: { 18 | baseURL: `http://localhost:${port}/` 19 | } 20 | }) 21 | -------------------------------------------------------------------------------- /src/lib/domutils/onScrollVisible.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Trigger a `callback` when an `element` is made visible. 3 | */ 4 | 5 | export function onScrollVisible(element: HTMLElement, callback: () => void) { 6 | if (typeof IntersectionObserver !== 'function') { 7 | callback() 8 | return 9 | } 10 | 11 | const observer = new IntersectionObserver((entries) => { 12 | entries.forEach((entry) => { 13 | if (entry.isIntersecting) { 14 | callback() 15 | observer.unobserve(element) 16 | } 17 | }) 18 | }) 19 | observer.observe(element) 20 | } 21 | -------------------------------------------------------------------------------- /ubuntu.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Ubuntu 3 | --- 4 | 5 | ### Aptitude stuff 6 | 7 | aptitude search mysql # Look for something 8 | dpkg -S `which tsclient` # What package does it belong to? 9 | dpkg -L aria2c # What does this package provide? 10 | dpkg -i *.deb # Install a deb file 11 | dpkg -s nodejs # Show info 12 | 13 | dpkg --get-selections # list installed packages 14 | 15 | ### Apt archives path 16 | 17 | /var/cache/apt/archives 18 | 19 | ### List services 20 | 21 | service --status-all 22 | -------------------------------------------------------------------------------- /html-microformats.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Microformats 3 | category: HTML 4 | --- 5 | 6 | ### Author 7 | 8 | ``` html 9 | 14 | ``` 15 | 16 | ### Time 17 | 18 | ``` html 19 | 20 | ``` 21 | -------------------------------------------------------------------------------- /src/pages/[...slug].astro: -------------------------------------------------------------------------------- 1 | --- 2 | import V2017Sheet from '~/components/V2017Sheet.astro' 3 | import { getPages } from '~/lib/page' 4 | import type { SheetPage } from '~/lib/page' 5 | 6 | export type Props = { 7 | page: SheetPage 8 | } 9 | 10 | const props = Astro.props as Props 11 | 12 | export async function getStaticPaths() { 13 | const pages = await getPages() 14 | 15 | return Promise.all( 16 | Object.values(pages).map((page) => { 17 | return { props: { page }, params: { slug: page.slug } } 18 | }) 19 | ) 20 | } 21 | --- 22 | 23 | 24 | -------------------------------------------------------------------------------- /js-speech.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: JavaScript speech synthesis 3 | category: JavaScript 4 | weight: -1 5 | --- 6 | 7 | ## SpeechSynthesisUtterance 8 | {: .-one-column} 9 | 10 | ```js 11 | function speak (message) { 12 | var msg = new SpeechSynthesisUtterance(message) 13 | var voices = window.speechSynthesis.getVoices() 14 | msg.voice = voices[0] 15 | window.speechSynthesis.speak(msg) 16 | } 17 | ``` 18 | 19 | ```js 20 | speak('Hello, world') 21 | ``` 22 | 23 | See: [SpeechSynthesisUtterance](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance) _(developer.mozilla.org)_ 24 | -------------------------------------------------------------------------------- /postgresql.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: PostgreSQL 3 | category: Databases 4 | --- 5 | 6 | ### Console 7 | 8 | $ psql #logs in to default database & default user 9 | $ sudo -u psql #logs in with a particular user 10 | 11 | Replace anything within `` accordingly 12 | 13 | ### Commands 14 | 15 | * Show roles: `\du` 16 | * Show tables: `\dt` 17 | * Show databases: `\l` 18 | * Connect to a database: `\c ` 19 | * Show columns of a table: `\d ` or `\d+
` 20 | * Quit: `\q` 21 | 22 | ### Creating database 23 | 24 | $ createdb databasename 25 | -------------------------------------------------------------------------------- /src/components/V2017/CarbonBox.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import { carbon } from '~/config' 3 | const useCarbon = carbon.enabled 4 | --- 5 | 6 |