Repository: rstacruz/cheatsheets Branch: master Commit: 6b3b35472a9b Files: 499 Total size: 2.2 MB Directory structure: gitextract_tlrt29kp/ ├── .eslintrc.cjs ├── .github/ │ └── workflows/ │ └── build.yml ├── .gitignore ├── .node-version ├── .prettierignore ├── .prettierrc ├── .ruby-version ├── .vscode/ │ ├── extensions.json │ ├── launch.json │ └── markdown.code-snippets ├── 101.md ├── AGENTS.md ├── CONTRIBUTING.md ├── Gemfile ├── README.md ├── _docs/ │ └── writing-guidelines.md ├── _includes/ │ └── common/ │ ├── moment_format.md │ └── strftime_format.md ├── absinthe.md ├── activeadmin.md ├── adb.md ├── analytics.js.md ├── analytics.md ├── angularjs.md ├── animated_gif.md ├── ansi.md ├── ansible-examples.md ├── ansible-guide.md ├── ansible-modules.md ├── ansible-roles.md ├── ansible.md ├── appcache.md ├── applescript.md ├── applinks.md ├── arel.md ├── astro.config.mjs ├── atom.md ├── awesome-redux.md ├── awscli.md ├── backbone.md ├── bash.md ├── blessed.md ├── bluebird.md ├── bolt.md ├── bookshelf.md ├── bootstrap.md ├── browser-sync.md ├── browserify.md ├── bulma.md ├── bundler.md ├── c_preprocessor.md ├── camp.md ├── canvas.md ├── capybara.md ├── cask-index.md ├── chai.md ├── cheatsheet-styles.md ├── chef.md ├── chunky_png.md ├── cidr.md ├── circle.md ├── claude-code.md ├── clip.md ├── co.md ├── command_line.md ├── commander.js.md ├── composer.md ├── cordova.md ├── cron.md ├── csharp7.md ├── css-antialias.md ├── css-flexbox.md ├── css-grid.md ├── css-system-font-stack.md ├── css-tricks.md ├── css.md ├── cssnext.md ├── curl.md ├── datetime.md ├── deis.md ├── deku.md ├── deku@1.md ├── devise.md ├── divshot.md ├── do.md ├── docker-compose.md ├── docker.md ├── dockerfile.md ├── dom-range.md ├── dom-selection.md ├── editorconfig.md ├── elixir-metaprogramming.md ├── elixir.md ├── emacs.md ├── ember.md ├── emmet.md ├── enzyme.md ├── enzyme@2.md ├── es6.md ├── ets.md ├── expectjs.md ├── express.md ├── exunit.md ├── factory_bot.md ├── fastify.md ├── ffaker.md ├── ffmpeg.md ├── figlet.md ├── find.md ├── firebase.md ├── firefox.md ├── fish-shell.md ├── flashlight.md ├── flow.md ├── flux.md ├── flynn.md ├── freenode.md ├── frequency-separation-retouching.md ├── gh-pages.md ├── git-branch.md ├── git-extras.md ├── git-log-format.md ├── git-log.md ├── git-revisions.md ├── git-tricks.md ├── gnupg.md ├── go.md ├── goby.md ├── google-webfonts.md ├── google_analytics.md ├── graphql.md ├── gremlins.md ├── grep.md ├── gulp.md ├── haml.md ├── handlebars.js.md ├── harvey.js.md ├── heroku.md ├── hledger.md ├── homebrew.md ├── html-email.md ├── html-input.md ├── html-meta.md ├── html-microformats.md ├── html-share.md ├── html.md ├── http-status.md ├── httpie.md ├── ie.md ├── ie_bugs.md ├── imagemagick.md ├── immutable.js.md ├── index.md ├── index@2016.md ├── inkscape.md ├── ios-provision.md ├── jade.md ├── jasmine.md ├── jekyll-github.md ├── jekyll.md ├── jest.md ├── jinja.md ├── jinja2.md ├── jquery-cdn.md ├── jquery.md ├── js-appcache.md ├── js-array.md ├── js-date.md ├── js-fetch.md ├── js-lazy.md ├── js-model.md ├── js-speech.md ├── jscoverage.md ├── jsdoc.md ├── jshint.md ├── knex.md ├── koa.md ├── kotlin.md ├── kramdown.md ├── layout-thrashing.md ├── ledger-csv.md ├── ledger-examples.md ├── ledger-format.md ├── ledger-periods.md ├── ledger-query.md ├── ledger.md ├── less.md ├── licenses.md ├── linux.md ├── lodash.md ├── lua.md ├── machinist.md ├── macos-mouse-acceleration.md ├── make-assets.md ├── makefile.md ├── mako.md ├── man.md ├── markdown.md ├── meow.md ├── meta-tags.md ├── middleman.md ├── minimist.md ├── minitest.md ├── mixpanel.md ├── mobx.md ├── mocha-blanket.md ├── mocha-html.md ├── mocha-tdd.md ├── mocha.md ├── modella.md ├── modernizr.md ├── moment.md ├── mysql.md ├── ncftp.md ├── netlify.toml ├── nock.md ├── nocode.md ├── nodejs-assert.md ├── nodejs-fs.md ├── nodejs-path.md ├── nodejs-process.md ├── nodejs-stream.md ├── nodejs.md ├── nopt.md ├── npm.md ├── org-mode.md ├── osx.md ├── package-json.md ├── package.json ├── package.md ├── packs.md ├── pacman.md ├── parsimmon.md ├── parsley.md ├── pass.md ├── passenger.md ├── perl-pie.md ├── ph-food-delivery.md ├── phoenix-conn.md ├── phoenix-ecto.md ├── phoenix-ecto@1.2.md ├── phoenix-ecto@1.3.md ├── phoenix-migrations.md ├── phoenix-routing.md ├── phoenix.md ├── phoenix@1.2.md ├── plantuml.md ├── playwright.config.ts ├── pm2.md ├── polyfill.io.md ├── postcss.config.js ├── postgresql-json.md ├── postgresql.md ├── premailer.md ├── projectionist.md ├── promise.md ├── pry.md ├── psdrb.md ├── public/ │ ├── _headers │ ├── _redirects │ └── robots.txt ├── pug.md ├── python.md ├── qjs.md ├── qunit.md ├── rack-test.md ├── ractive.md ├── rails-controllers.md ├── rails-forms.md ├── rails-helpers.md ├── rails-i18n.md ├── rails-migrations.md ├── rails-models.md ├── rails-plugins.md ├── rails-routes.md ├── rails-tricks.md ├── rails.md ├── rake.md ├── rbenv.md ├── rclone.md ├── rdoc.md ├── react-router.md ├── react.md ├── react@0.14.md ├── redux.md ├── regexp.md ├── rename.md ├── resolutions.md ├── rest-api.md ├── riot.md ├── rollup.md ├── ronn.md ├── rspec-rails.md ├── rspec.md ├── rst.md ├── rsync.md ├── rtorrent.md ├── ruby.md ├── ruby21.md ├── rubygems.md ├── sass.md ├── saucelabs.md ├── scp.md ├── screen.md ├── sed.md ├── semver.md ├── sequel.md ├── sequelize.md ├── sh-pipes.md ├── sh.md ├── shelljs.md ├── siege.md ├── simple_form.md ├── sinon-chai.md ├── sinon.md ├── sketch.md ├── slim.md ├── social-images.md ├── spacemacs.md ├── spine.md ├── spreadsheet.md ├── sql-join.md ├── src/ │ ├── analytics/ │ │ ├── CloudflareAnalytics.astro │ │ └── GoogleAnalytics.astro │ ├── components/ │ │ ├── BaseLayout.astro │ │ ├── SEO/ │ │ │ └── SEO.astro │ │ ├── SocialList.astro │ │ ├── TopNav.astro │ │ ├── V2017/ │ │ │ ├── CarbonBox.astro │ │ │ └── PushButton.astro │ │ ├── V2017Home/ │ │ │ ├── Announcements.astro │ │ │ ├── FeaturedPages.astro │ │ │ └── PageListItem.astro │ │ ├── V2017Sheet/ │ │ │ ├── CommentsArea.astro │ │ │ ├── NoticeBox.astro │ │ │ ├── RelatedPostItem.astro │ │ │ ├── RelatedPosts.astro │ │ │ ├── SearchFooter.astro │ │ │ ├── SearchForm.astro │ │ │ └── SearchForm.script.ts │ │ ├── V2017Sheet.astro │ │ └── gaEnabled.tsx │ ├── config.ts │ ├── env.d.ts │ ├── lib/ │ │ ├── domutils/ │ │ │ └── onScrollVisible.ts │ │ ├── fuseSearch/ │ │ │ ├── __snapshots__/ │ │ │ │ └── fuseSearch.test.ts.snap │ │ │ ├── fuseSearch.test.ts │ │ │ └── fuseSearch.ts │ │ ├── kramdown.ts │ │ ├── links.ts │ │ ├── page/ │ │ │ ├── accessors.ts │ │ │ └── queries.ts │ │ ├── page.test.ts │ │ ├── page.ts │ │ ├── render.test.ts │ │ ├── render.ts │ │ └── seo/ │ │ ├── __snapshots__/ │ │ │ └── seo.test.ts.snap │ │ ├── jsonJd.test.ts │ │ ├── jsonLd.ts │ │ ├── seo.test.ts │ │ └── seo.ts │ ├── pages/ │ │ ├── 404.astro │ │ ├── [...slug].astro │ │ ├── __tests__/ │ │ │ ├── searchindex.json.test.ts │ │ │ └── sitemap.xml.test.ts │ │ ├── index.astro │ │ ├── searchindex.json.ts │ │ ├── sitemap.xml.ts │ │ └── test_scenarios/ │ │ └── seo_tags_test.astro │ ├── ruby/ │ │ ├── cache_kramdown.rb │ │ ├── kramdown.rb │ │ ├── renderer.rb │ │ └── renderer.test.rb │ ├── sass/ │ │ ├── 2017/ │ │ │ ├── _utils.scss │ │ │ ├── base/ │ │ │ │ └── prism_line_highlight.scss │ │ │ ├── components/ │ │ │ │ ├── announcements-item.scss │ │ │ │ ├── announcements-list.scss │ │ │ │ ├── autocomplete.scss │ │ │ │ ├── back-button.scss │ │ │ │ ├── comments-area.scss │ │ │ │ ├── comments-details.scss │ │ │ │ ├── comments-section.scss │ │ │ │ ├── h2-section.scss │ │ │ │ ├── h3-section-list.scss │ │ │ │ ├── h3-section.scss │ │ │ │ ├── headline-pub.scss │ │ │ │ ├── hint-mark.scss │ │ │ │ ├── home-button.scss │ │ │ │ ├── intro-content.scss │ │ │ │ ├── main-heading.scss │ │ │ │ ├── missing-message.scss │ │ │ │ ├── notice-box.scss │ │ │ │ ├── page-actions.scss │ │ │ │ ├── pages-list.scss │ │ │ │ ├── pre-footer.scss │ │ │ │ ├── push-button.scss │ │ │ │ ├── related-post-item.scss │ │ │ │ ├── related-post-list.scss │ │ │ │ ├── related-posts-area.scss │ │ │ │ ├── related-posts-callout.scss │ │ │ │ ├── related-posts-group.scss │ │ │ │ ├── related-posts-section.scss │ │ │ │ ├── search-box.scss │ │ │ │ ├── search-footer.scss │ │ │ │ ├── top-nav.scss │ │ │ │ └── top-sheet.scss │ │ │ ├── markdown/ │ │ │ │ ├── a-em.scss │ │ │ │ ├── code.scss │ │ │ │ ├── headings.scss │ │ │ │ ├── p.scss │ │ │ │ ├── table.scss │ │ │ │ └── ul.scss │ │ │ ├── placeholders/ │ │ │ │ └── push-button.scss │ │ │ ├── utils/ │ │ │ │ ├── _font-size.scss │ │ │ │ ├── _gutter.scss │ │ │ │ ├── _heading-style.scss │ │ │ │ ├── _section-gutter.scss │ │ │ │ └── _section-with-container.scss │ │ │ └── variables.scss │ │ ├── full.scss │ │ └── vendor/ │ │ ├── ionicons-inline/ │ │ │ └── ionicons.scss │ │ └── modularscale/ │ │ └── _modularscale.scss │ ├── scripts/ │ │ └── v2017/ │ │ ├── _utils.scss │ │ ├── behaviors_2/ │ │ │ ├── anchors.js │ │ │ ├── dismiss.js │ │ │ ├── dismissable.js │ │ │ ├── disqus.js │ │ │ └── no-preview.js │ │ └── helpers/ │ │ ├── data.js │ │ ├── dismiss.js │ │ ├── inject_disqus.js │ │ ├── preview.js │ │ ├── qs.js │ │ └── store.js │ ├── styles/ │ │ └── CommonStyles.ts │ └── types/ │ ├── JsonLdDocument.ts │ └── SheetFrontmatter.ts ├── stencil.md ├── stimulus-reflex.md ├── strftime.md ├── stylus.md ├── sublime-text.md ├── superagent.md ├── tabular.md ├── tailwind.config.mjs ├── tape.md ├── tar.md ├── test/ │ ├── basicPage.e2e.ts │ ├── e2eUtils.ts │ └── index.e2e.ts ├── tests/ │ ├── basic.md │ └── keywords_test.md ├── textile.md ├── tig.md ├── tmux.md ├── tomdoc.md ├── top.md ├── travis.md ├── tsconfig.json ├── typescript.md ├── ubuntu.md ├── umdjs.md ├── underscore-string.md ├── unicode.md ├── vagrant.md ├── vagrantfile.md ├── vainglory.md ├── vim-diff.md ├── vim-digraphs.md ├── vim-easyalign.md ├── vim-help.md ├── vim-rails.md ├── vim-unite.md ├── vim.md ├── vimscript-functions.md ├── vimscript-snippets.md ├── vimscript.md ├── virtual-dom.md ├── vite.config.js ├── vows.md ├── vscode.md ├── vue.md ├── vue@1.0.28.md ├── watchexec.md ├── watchman.md ├── web-workers.md ├── webpack.md ├── weechat.md ├── weinre.md ├── wip/ │ ├── intl-datetime.md │ └── php.md ├── xpath.md ├── yaml.md ├── yargs.md ├── yarn.md ├── yum.md ├── znc.md ├── zombie.md └── zsh.md ================================================ FILE CONTENTS ================================================ ================================================ FILE: .eslintrc.cjs ================================================ /* eslint-env node */ module.exports = { extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:astro/recommended', 'prettier' ], env: { browser: true // enables window, document, etc }, parser: '@typescript-eslint/parser', plugins: ['@typescript-eslint'], root: true, ignorePatterns: ['dist/**'], overrides: [ { files: ['*.test.ts'], rules: { '@typescript-eslint/no-explicit-any': 'off' } }, { files: ['*.astro'], parser: 'astro-eslint-parser', parserOptions: { parser: '@typescript-eslint/parser', extraFileExtensions: ['.astro'] } // rules: { // override/add rules settings here, such as: // "astro/no-set-html-directive": "error" // }, } ] } ================================================ FILE: .github/workflows/build.yml ================================================ name: Run tests on: push: branches: [main, master] pull_request: branches: [main, master] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: bundler-cache: true - uses: actions/setup-node@v4 with: node-version-file: .node-version - uses: pnpm/action-setup@v3 with: { run_install: false } # https://github.com/pnpm/action-setup?tab=readme-ov-file#use-cache-to-reduce-installation-time - name: Get pnpm store directory shell: bash run: | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - name: Install dependencies run: pnpm install --frozen-lockfile - name: Install playwright browsers run: pnpm playwright install --with-deps chromium - name: Run tests run: pnpm run ci ================================================ FILE: .gitignore ================================================ # build output dist/ # generated types .astro/ # dependencies node_modules/ # logs npm-debug.log* yarn-debug.log* yarn-error.log* pnpm-debug.log* # environment variables .env .env.production # macOS-specific files .DS_Store .cache # playwright test-results ================================================ FILE: .node-version ================================================ 22.21.1 ================================================ FILE: .prettierignore ================================================ src/sass/vendor vendor .cache dist *.md pnpm-lock.yaml ================================================ FILE: .prettierrc ================================================ { "semi": false, "singleQuote": true, "trailingComma": "none", "plugins": ["prettier-plugin-astro"] } ================================================ FILE: .ruby-version ================================================ 3.2.2 ================================================ FILE: .vscode/extensions.json ================================================ { "recommendations": ["astro-build.astro-vscode"], "unwantedRecommendations": [] } ================================================ FILE: .vscode/launch.json ================================================ { "version": "0.2.0", "configurations": [ { "command": "./node_modules/.bin/astro dev", "name": "Development server", "request": "launch", "type": "node-terminal" } ] } ================================================ FILE: .vscode/markdown.code-snippets ================================================ { "Test snip": { "prefix": ["about"], "body": "Copyright. Foo Corp 2028", "description": "Adds copyright...", "scope": "markdown" } } ================================================ FILE: 101.md ================================================ --- title: 101 category: JavaScript libraries updated: 2017-09-21 intro: | [101](https://www.npmjs.com/package/101) is a JavaScript library for dealing with immutable data in a functional manner. --- ### Usage ```js const isObject = require('101/isObject') isObject({}) // → true ``` Every function is exposed as a module. See: [101](https://github.com/tjmehta/101) ### Type checking ```js isObject({}) isString('str') isRegExp(/regexp/) isBoolean(true) isEmpty({}) isfunction(x => x) isInteger(10) isNumber(10.1) instanceOf(obj, 'string') ``` ## Objects {: .-three-column} ### Example {: .-prime} ```js let obj = {} ``` #### Update ```js obj = put(obj, 'user.name', 'John') // → { user: { name: 'John' } } ``` #### Read ```js pluck(name, 'user.name') // → 'John' ``` #### Delete ```js obj = del(obj, 'user') // → { } ``` ### Getting ```js pluck(state, 'user.profile.name') ``` ```js pick(state, ['user', 'ui']) pick(state, /^_/) ``` `pluck` returns values, `pick` returns subsets of objects. See: [pluck](https://github.com/tjmehta/101#pluck), [pick](https://github.com/tjmehta/101#pick) ### Setting ```js put(state, 'user.profile.name', 'john') ``` See: [put](https://github.com/tjmehta/101#put) ### Deleting ```js del(state, 'user.profile') omit(state, ['user', 'data']) ``` `omit` is like `del`, but supports multiple keys to be deleted. See: [omit](https://github.com/tjmehta/101#omit), [del](https://github.com/tjmehta/101#del) ### Keypath check ```js hasKeypaths(state, ['user']) hasKeypaths(state, { 'user.profile.name': 'john' }) ``` See: [hasKeypaths](https://github.com/tjmehta/101#haskeypaths) ### Get values ```js values(state) ``` ## Functions ### Simple functions | `and(x, y)` | `x && y` | | `or(x, y)` | `x || y` | | `xor(x, y)` | `!(!x && !y) && !(x && y)` | | `equals(x, y)` | `x === y` | | `exists(x)` | `!!x` | | `not(x)` | `!x` | Useful for function composition. See: [and](https://github.com/tjmehta/101#and), [equals](https://github.com/tjmehta/101#equals), [exists](https://github.com/tjmehta/101#exists) ### Composition ```js compose(f, g) // x => f(g(x)) curry(f) // x => y => f(x, y) flip(f) // f(x, y) --> f(y, x) ``` See: [compose](https://github.com/tjmehta/101#compose), [curry](https://github.com/tjmehta/101#curry), [flip](https://github.com/tjmehta/101#flip) ### And/or ```js passAll(f, g) // x => f(x) && g(x) passAny(f, g) // x => f(x) || g(x) ``` See: [passAll](https://github.com/tjmehta/101#passall), [passAny](https://github.com/tjmehta/101#passany) ### Converge ```js converge(and, [pluck('a'), pluck('b')])(x) ``` ```js // → and(pluck(x, 'a'), pluck(x, 'b')) ``` See: [converge](https://github.com/tjmehta/101#converge) ## Arrays ### Finding ```js find(list, x => x.y === 2) findIndex(list, x => ...) includes(list, 'item') last(list) ``` ```js find(list, hasProps('id')) ``` ### Grouping ```js groupBy(list, 'id') indexBy(list, 'id') ``` ## Examples ### Function composition ```js isFloat = passAll(isNumber, compose(isInteger, not)) // n => isNumber(n) && not(isInteger(n)) ``` ```js function doStuff (object, options) { ... } doStuffForce = curry(flip(doStuff))({ force: true }) ``` ## Reference - ================================================ FILE: AGENTS.md ================================================ # Agent guidelines for devhints.io ## Commands - **Dev server**: `pnpm dev` (requires Ruby for markdown caching) - **Build**: `pnpm build` - **Test**: `pnpm test` (runs Vitest in watch mode) - **Run single test**: `pnpm vitest run ` or `pnpm vitest ` (watch mode) - **All tests (CI)**: `pnpm ci` (runs all linters, tests, and build) - **Lint**: `pnpm eslint:check` or `pnpm prettier:check` - **Format**: `pnpm format` (runs both ESLint and Prettier fixes) ## Code style - **Package manager**: pnpm (v8.15.4+) - **Framework**: Astro with TypeScript (strict mode), Tailwind CSS - **Imports**: Use `~/` alias for `src/` directory; Prettier organizes imports automatically - **Types**: Use Zod schemas for runtime validation (see `SheetFrontmatter.ts`); TypeScript strict mode enabled - **Naming**: camelCase for variables/functions, PascalCase for components/types - **Error handling**: Distinguish operational (expected) vs unexpected errors; return error objects for operational errors - **Testing**: Vitest with globals enabled; use `it.each()` for repeated test cases; prefer object constants over helper functions ## Markdown files Consult @_docs/writing-guidelines.md for formatting *.md files. ================================================ FILE: CONTRIBUTING.md ================================================ # Developer notes ## Runtimes Requires Node.js, Ruby, Yarn v1. See `.ruby-version` and `.node-version` for supported versions. ## Gitpod This repository supports contribution using [gitpod](https://gitpod.io) which is online IDE using [Theia](https://github.com/eclipse-theia/theia). To open-up the environment simple natigate on https://gitpod.io/#https://github.com/rstacruz/cheatsheets Or using a button:
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/rstacruz/cheatsheets) ### Preview built website To preview the website you need to first build it then you can navigate to file that you are trying to contribute and preview directly. ## Starting a local instance This starts Jekyll and Parcel. This requires recent versions of [Node.js], [Yarn], [Ruby] and [Bundler] installed. ```bash yarn install bundle install env PORT=4001 yarn run dev ``` [node.js]: https://nodejs.org/en/download/package-manager/ [ruby]: https://www.ruby-lang.org/en/documentation/installation/ [yarn]: https://yarnpkg.com/en/docs/install [bundler]: https://bundler.io/ ### Docker You can also run a local instance using Docker. This is the preferred method, especially for Windows. You only need to install Docker ([macOS](https://docs.docker.com/docker-for-mac/install/), [Windows](https://docs.docker.com/docker-for-windows/install/), [Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/), [Arch Linux](https://www.archlinux.org/packages/community/x86_64/docker/), [other](https://www.docker.com/community-edition#download)). First time setup: ```bash # Build images (takes ~12mins) docker-compose build # First-time setup docker-compose run --rm web bundle install && docker-compose run --rm web yarn install ``` Starting the server: ```bash docker-compose up ``` ## CSS classes See for a reference on styling. ## JavaScript When updating JavaScript, be sure Parcel is running (`yarn dev` takes care of this). This auto-updates `/assets/packed/` and `_includes/2017/critical/` with sources in `_parcel/`. Before committing, run `yarn parcel:build` first. ## JavaScript tests There are also automated tests: ``` yarn run test --watch ``` ## Frontmatter Each sheet supports these metadata: ```yml --- title: React.js # Optional: category: React updated: 2020-06-14 ads: false # Add this to disable ads weight: -5 # lower number = higher in related posts list deprecated: true # Don't show in related posts deprecated_by: /enzyme # Point to latest version prism_languages: [vim] # Extra syntax highlighting intro: | This is some *Markdown* at the beginning of the article. tags: - WIP - Featured # Special pages: # (don't set these for cheatsheets) type: home # home | article | error og_type: website # opengraph type --- ``` ## Prism languages For supported prism languages: - ## Setting up redirects This example sets up a redirect from `es2015` to `es6`: ```yml # /es2015.md --- title: ES2015 category: Hidden redirect_to: /es6 --- ``` ## Localizations See `_data/content.yml` for chrome strings. ## Forking So you want to fork this repo? Sure, here's what you need to know to whitelabel this: - It's all GitHub pages, so the branch has to be `gh-pages`. - All other GitHub pages gotchas apply (CNAME, etc). - Edit everything in `_data/` - this holds all 'config' for the site: ad IDs, strings, etc. - Edit `_config.yml` as well, lots of things may not apply to you. ## CloudFlare purging The site devhints.io is backed by CloudFlare. Updates will take 2 days to propagate to the website by default. To make sure recent changes will propagate, use this helper script. It will give instructions on how manual selective cache purging can be done. ```bash ./_support/cf-purge.sh ``` ## SEO description There are multiple ways to set meta description. ### Keywords (and intro) Set `keywords` (and optionally `intro`). This is the easiest and the preferred way for now. ``` React cheatsheet - devhints.io ------------------------------ https://devhints.io/react ▼ React.Component · render() · componentDidMount() · props/state · React is a JavaScript library for building web... ``` ### Description (and intro) Set `description` (and optionally `intro`) ``` React cheatsheet - devhints.io ------------------------------ https://devhints.io/react ▼ One-page reference to React and its API. React is a JavaScript library for building web user interfaces... ``` ### Intro only If you left out `description` or `keywords`, a default description will be added. ================================================ FILE: Gemfile ================================================ source "https://rubygems.org" gem "minitest" gem "kramdown" gem "kramdown-parser-gfm" ================================================ FILE: README.md ================================================

Devhints

TL;DR for developer documentation - a ridiculous collection of cheatsheets


devhints.io


--- See [CONTRIBUTING.md](CONTRIBUTING.md) for developer notes. [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/rstacruz/cheatsheets)

Similar projects

- [Command Line Interface Pages](https://github.com/command-line-interface-pages) - [tldr-pages](https://github.com/tldr-pages/tldr) - [Cheat](https://github.com/cheat/cheat) - [Eg](https://github.com/srsudar/eg) ================================================ FILE: _docs/writing-guidelines.md ================================================ # Cheatsheet guidelines ## Content organisation - **Progressive complexity:** Start with basics, move to advanced - **Logical sections:** Group related functionality together - **H2 and H3:** Organise documents into H2 and H3 sections H2 content length: - Short H2s: 2-4 H3s (e.g., "Installing", "Getting started") - Medium H2s: 4-7 H3s (e.g., "Components", "Lifecycle") - Long H2s: 7+ H3s (use column layouts) H3 content length: - Focused: One main concept + examples - Consistent: Similar depth within each H2 - Self-contained: Each H3 should be understandable independently ## Format - Documentation is in the format of Markdown with Kramdown class extensions - H3's can have the following class names: - `{: .-prime}` - Visually highlighted section. Only use once per document at most. - PRE elements can have: - `{: .-setup}` - Visually muted section. Used for sections with less importance. Deprecated, use sparingly. - H2's can have: - `{: .-three-column}` - use if the H3's are short, and if there are at least 3 H3's in the H2. - `{: .-two-column}` - the default ## Writing guidelines - Aim for brevity - Sentence case headings, never Title Case - Omit explanations if they are obvious ## Content priorities 1. **Essential first**: Most commonly used 20% of functionality 2. **Progressive disclosure**: Basic → intermediate → advanced 3. **Practical examples**: Real-world use cases over theoretical 4. **Quick reference**: Dense information for experienced developers 5. **Learning path**: Logical progression for newcomers ## H3 writing guidelines - Place documentation links in the end. (see next for example) - Prefer to write explanations *after* a pre/table. Example: ````markdown ### Setting default props ```jsx Hello.defaultProps = { color: 'blue' } ``` Default properties are used if no properties are given. See: [defaultProps](https://reactjs.org/docs/react-component.html#defaultprops) ```` - When an example has multiple files, use H4 as filename markers. Example: ````markdown ### via Data Attributes #### index.html.erb ```html Increment <%= @count.to_i %> ``` #### counter_reflex.rb ```ruby class CounterReflex < StimulusReflex::Reflex def increment @count = element.dataset[:count].to_i + element.dataset[:step].to_i end end ``` Trigger reflexes without writing any javascript with the `data-reflex` attribute. ```` - When showing reference information, use tables for quick scanning. Example: ````markdown ### Primitives | Sample | Type | | --- | --- | | `nil` | Nil/null | | `true` _/_ `false` | Boolean | | --- | --- | | `23` | Integer | | `3.14` | Float | | --- | --- | | `"hello"` | Binary string | | `:hello` | Atom | These are the basic data types in Elixir. ```` - Use inline comments to explain results, equivalents, or provide context. Example: ````markdown ### Pattern matching ```elixir user = %{name: "Tom", age: 23} %{name: username} = user # → username = "Tom" ``` ### Piping ```elixir source |> transform(:hello) # Step 1: transform the data |> print() # Step 2: output the result ``` ```elixir # Same as: print(transform(source, :hello)) ``` ### Type conversions ```elixir Integer.parse("34") # → {34, ""} Float.parse("34.1") # → {34.1, ""} ``` ```` ``` ================================================ FILE: _includes/common/moment_format.md ================================================ ## {{ include.title }} {: .-three-column} ### Examples #### Date | Example | Output | | ------------------------- | ---------------------- | | `YYYY-MM-DD` | 2014-01-01 | | `dddd, MMMM Do YYYY` | Friday, May 16th 2014 | | `dddd [the] Do [of] MMMM` | Friday the 16th of May | #### Time | Example | Output | | --------- | -------- | | `hh:mm a` | 12:30 pm | Used by [Moment.js](http://momentjs.com/docs/#/displaying/) and [date-fns/format](https://date-fns.org/v1.28.5/docs/format). Similar to Java [SimpleDateFormat](https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html). ### Date | Symbol | Example | Area | | --- | --- | --- | | `d` | `0`..`6` | **Weekday** | | `dd` | `Su` | | | `ddd` | `Sun` | | | `dddd` | `Sunday` | | | --- | --- | --- | | `YY` | `13` | **Year** | | `YYYY` | `2013` | | | --- | --- | --- | | `M` | `1`..`12` _(Jan is 1)_ | **Month** | | `Mo` | `1st`..`12th` | | | `MM` | `01`..`12` _(Jan is 1)_ | | | `MMM` | `Jan` | | | `MMMM` | `January` | | | --- | --- | --- | | `Q` | `1`..`4` | **Quarter** | | `Qo` | `1st`..`4th` | | | --- | --- | --- | | `D` | `1`..`31` | **Day** | | `Do` | `1st`..`31st` | | | `DD` | `01`..`31` | | | --- | --- | --- | | `DDD` | `1`..`365` | **Day of year** | | `DDDo` | `1st`..`365th` | | | `DDDD` | `001`..`365` | | | --- | --- | --- | | `w` | `1`..`53` | **Week of year** | | `wo` | `1st`..`53rd` | | | `ww` | `01`..`53` | | {: .-shortcuts} ### Time | Symbol | Example | Area | | --- | --- | --- | | `H` | `0`..`23` | **24h hour** | | `HH` | `00`..`23` | | | --- | --- | --- | | `h` | `1`..`12` | **12h hour** | | `hh` | `01`..`12` | | | --- | --- | --- | | `m` | `0`..`59` | **Minutes** | | `mm` | `00`..`59` | | | --- | --- | --- | | `s` | `0`..`59` | **Seconds** | | `ss` | `00`..`59` | | | --- | --- | --- | | `a` | `am` | **AM/PM** | | `A` | `AM` | | | --- | --- | --- | | `Z` | `+07:00` | **Timezone offset** | | `ZZ` | `+0730` | | | --- | --- | --- | | `S` | `0`..`9` | Deciseconds | | `SS` | `00`..`99` | Centiseconds | | `SSS` | `000`..`999` | Milliseconds | | --- | --- | --- | | `X` | | Unix timestamp | | `x` | | Millisecond Unix timestamp | {: .-shortcuts} ### Presets | Example | Output | | ------- | -------------------------------- | | `LT` | 8:30 PM | | `LTS` | 8:30:25 PM | | --- | --- | | `LL` | August 2 1985 | | `ll` | Aug 2 1985 | | --- | --- | | `LLL` | August 2 1985 08:30 PM | | `lll` | Aug 2 1985 08:30 PM | | --- | --- | | `LLLL` | Thursday, August 2 1985 08:30 PM | | `llll` | Thu, Aug 2 1985 08:30 PM | ================================================ FILE: _includes/common/strftime_format.md ================================================ ## {{ include.title }} {: .-three-column} ### Presets #### Date | Example | Output | | --- | --- | | `%m/%d/%Y` | `06/05/2013` | | `%A, %B %e, %Y` | `Sunday, June 5, 2013` | | `%b %e %a` | `Jun 5 Sun` | {: .-shortcuts} #### Time | Example | Output | | --- | --- | | `%H:%M` | `23:05` | | `%I:%M %p` | `11:05 PM` | {: .-shortcuts} Used by Ruby, UNIX `date`, and many more. ### Date | Symbol | Example | Area | | --- | --- | --- | | `%a` | `Sun` | **Weekday** | | `%A` | `Sunday` | | | `%w` | `0`..`6` _(Sunday is 0)_ | | | --- | --- | --- | | `%y` | `13` | **Year** | | `%Y` | `2013` | | | --- | --- | --- | | `%b` | `Jan` | **Month** | | `%B` | `January` | | | `%m` | `01`..`12` | | | --- | --- | --- | | `%d` | `01`..`31` | **Day** | | `%e` | `1`..`31` | | {: .-shortcuts} ### Time | Symbol | Example | Area | | --- | --- | --- | | `%l` | `1` | Hour | | `%H` | `00`..`23` | 24h Hour | | `%I` | `01`..`12` | 12h Hour | | -- | --- | --- | | `%M` | `00`..`59` | Minute | | `%S` | `00`..`60` | Second | | --- | --- | --- | | `%p` | `AM` | AM or PM | | `%Z` | `+08` | Time zone | | --- | --- | --- | | `%j` | `001`..`366` | Day of the year | | `%%` | `%` | Literal % character | {: .-shortcuts} ================================================ FILE: absinthe.md ================================================ --- title: Absinthe category: Hidden tags: [WIP] updated: 2017-10-10 intro: | [Absinthe](http://absinthe-graphql.org/) allows you to write GraphQL servers in Elixir. --- ## Introduction ### Concepts - `Schema` - The root. Defines what queries you can do, and what types they return. - `Resolver` - Functions that return data. - `Type` - A type definition describing the shape of the data you'll return. ### Plug #### web/router.ex ```elixir defmodule Blog.Web.Router do use Phoenix.Router forward "/", Absinthe.Plug, schema: Blog.Schema end ``` {: data-line="4,5"} Absinthe is a Plug, and you pass it one **Schema**. See: [Our first query](http://absinthe-graphql.org/tutorial/our-first-query/) ## Main concepts {: .-three-column} ### Schema #### web/schema.ex ```elixir defmodule Blog.Schema do use Absinthe.Schema import_types Blog.Schema.Types query do @desc "Get a list of blog posts" field :posts, list_of(:post) do resolve &Blog.PostResolver.all/2 end end end ``` {: data-line="5,6,7,8,9,10"} This schema will account for `{ posts { ··· } }`. It returns a **Type** of `:post`, and delegates to a **Resolver**. ### Resolver #### web/resolvers/post_resolver.ex ```elixir defmodule Blog.PostResolver do def all(_args, _info) do {:ok, Blog.Repo.all(Blog.Post)} end end ``` {: data-line="3"} This is the function that the schema delegated the `posts` query to. ### Type #### web/schema/types.ex ```elixir defmodule Blog.Schema.Types do use Absinthe.Schema.Notation @desc "A blog post" object :post do field :id, :id field :title, :string field :body, :string end end ``` {: data-line="4,5,6,7,8,9"} This defines a type `:post`, which is used by the resolver. ## Schema ### Query arguments #### GraphQL query ``` { user(id: "1") { ··· } } ``` #### web/schema.ex ```elixir query do field :user, type: :user do arg :id, non_null(:id) resolve &Blog.UserResolver.find/2 end end ``` {: data-line="3"} #### Resolver ```elixir def find(%{id: id} = args, _info) do ··· end ``` {: data-line="1"} See: [Query arguments](http://absinthe-graphql.org/tutorial/query-arguments/) ### Mutations #### GraphQL query ``` { mutation CreatePost { post(title: "Hello") { id } } } ``` #### web/schema.ex ```elixir mutation do @desc "Create a post" field :post, type: :post do arg :title, non_null(:string) resolve &Blog.PostResolver.create/2 end end ``` {: data-line="1"} See: [Mutations](http://absinthe-graphql.org/tutorial/mutations/) ## References - [Absinthe website](http://absinthe-graphql.org/) _(absinthe-graphql.org)_ - [GraphQL cheatsheet](./graphql) _(devhints.io)_ ================================================ FILE: activeadmin.md ================================================ --- title: ActiveAdmin category: Ruby --- ### Listing scopes Allows you to filter listings by a certain scope. {: .-setup} ```ruby scope :draft scope :for_approval ``` ```ruby scope :public, if: ->{ current_admin_user.can?(...) } scope "Unapproved", :pending scope("Published") { |books| books.where(:published: true) } ``` ### Sidebar filters ```ruby filter :email filter :username ``` ### Custom actions You can define custom actions for models. {: .-setup} ```ruby before_filter only: [:show, :edit, :publish] do @post = Post.find(params[:id]) end ``` #### Make the route ```ruby member_action :publish, method: :put do @post.publish! redirect_to admin_posts_path, notice: "The post '#{@post}' has been published!" end ``` #### Link it in the index ```ruby index do column do |post| link_to 'Publish', publish_admin_post_path(post), method: :put end end ``` #### And link it in show/edit ```ruby action_item only: [:edit, :show] do @post = Post.find(params[:id]) link_to 'Publish', publish_admin_post_path(post), method: :put end ``` ### Columns ```ruby column :foo ``` ```ruby column :title, sortable: :name do |post| strong post.title end ``` ### Other helpers ```ruby status_tag "Done" # Gray status_tag "Finished", :ok # Green status_tag "You", :warn # Orange status_tag "Failed", :error # Red ``` ### Disabling 'new post' ```ruby ActiveAdmin.register Post do actions :index, :edit # or: config.clear_action_items! end ``` ================================================ FILE: adb.md ================================================ --- title: adb (Android Debug Bridge) category: CLI weight: -1 authors: - github: ZackNeyland updated: 2018-03-06 --- ### Device Basics | Command | Description | | --- | --- | | `adb devices` | Lists connected devices | | `adb devices -l` | Lists connected devices and kind | | --- | --- | | `adb root` | Restarts adbd with root permissions | | `adb start-server` | Starts the adb server | | `adb kill-server` | Kills the adb server | | `adb remount` | Remounts file system with read/write access | | `adb reboot` | Reboots the device | | `adb reboot bootloader` | Reboots the device into fastboot | | `adb disable-verity` | Reboots the device into fastboot | `wait-for-device` can be specified after `adb` to ensure that the command will run once the device is connected. `-s` can be used to send the commands to a specific device when multiple are connected. #### Examples ``` $ adb wait-for-device devices List of devices attached somedevice-1234 device someotherdevice-1234 device ``` ``` $ adb -s somedevice-1234 root ``` ### Logcat | Command | Description | | --- | --- | | `adb logcat` | Starts printing log messages to stdout | | `adb logcat -g` | Displays current log buffer sizes | | `adb logcat -G ` | Sets the buffer size (K or M) | | `adb logcat -c` | Clears the log buffers | | `adb logcat *:V` | Enables ALL log messages (verbose) | | `adb logcat -f ` | Dumps to specified file | #### Examples ``` $ adb logcat -G 16M $ adb logcat *:V > output.log ``` ### File Management | Command | Description | | --- | --- | | `adb push ` | Copies the local to the device at remote | | `adb pull ` | Copies the remote from the device to local | #### Examples ``` $ echo "This is a test" > test.txt $ adb push test.txt /sdcard/test.txt $ adb pull /sdcard/test.txt pulledTest.txt ``` ### Remote Shell | Command | Description | | --- | --- | | `adb shell ` | Runs the specified command on device (most unix commands work here) | | `adb shell wm size` | Displays the current screen resolution | | `adb shell wm size WxH` | Sets the resolution to WxH | | `adb shell pm list packages` | Lists all installed packages | | `adb shell pm list packages -3` | Lists all installed 3rd-party packages | | `adb shell monkey -p app.package.name` | Starts the specified package | ================================================ FILE: analytics.js.md ================================================ --- title: Google Analytics's analytics.js category: Analytics updated: 2017-10-29 intro: | Google Analytics's analytics.js is deprecated. --- ### Page view ```js ga('create', 'UA-XXXX-Y', 'auto') ga('create', 'UA-XXXX-Y', { userId: 'USER_ID' }) ``` ```js ga('send', 'pageview') ga('send', 'pageview', { 'dimension15': 'My custom dimension' }) ``` ### Events ```js ga('send', 'event', 'button', 'click', {color: 'red'}); ``` ```js ga('send', 'event', 'button', 'click', 'nav buttons', 4); /* ^category ^action ^label ^value */ ``` ### Exceptions ```js ga('send', 'exception', { exDescription: 'DatabaseError', exFatal: false, appName: 'myapp', appVersion: '0.1.2' }) ``` ================================================ FILE: analytics.md ================================================ --- title: Analytics libraries category: Analytics --- ### Mixpanel ```js mixpanel.identify('284'); mixpanel.people.set({ $email: 'hi@gmail.com' }); mixpanel.register({ age: 28, gender: 'male' }); /* set common properties */ ``` [mixpanel](./mixpanel) {: .-crosslink} ### Google Analytics's analytics.js ```js ga('create', 'UA-XXXX-Y', 'auto'); ga('create', 'UA-XXXX-Y', { userId: 'USER_ID' }); ``` ```js ga('send', 'pageview'); ga('send', 'pageview', { 'dimension15': 'My custom dimension' }); ``` [analytics.js](./analytics.js) {: .-crosslink} ================================================ FILE: angularjs.md ================================================ --- title: Angular.js category: JavaScript libraries tags: [Archived] archived: This describes an older version of Angular. --- ### About {: .-intro} * * ### ng-app ```html     ``` ### Lists (ng-repeat) ```html
  • {{phone.name}}
  •    
``` ### Model (ng-model) ```html ``` ### Defining a module ```js    App = angular.module('myApp', []); App.controller('MyListCtrl', function ($scope) { $scope.phones = [ ... ];    }); ``` ### Controller with protection from minification ```js    App.controller('Name', [ '$scope', '$http', function ($scope, $http) { } ]); a.c 'name', [ '$scope' '$http' ($scope, $http) ->    ] ``` ### Service ```js    App.service('NameService', function($http){ return { get: function(){ return $http.get(url); } }    }); ``` In controller you call with parameter and will use promises to return data from server. ```js    App.controller('controllerName', function(NameService){ NameService.get() .then(function(){})    }) ``` ### Directive ```js    App.directive('name', function(){ return { template: '

Hello

' }    }); ``` In HTML will use `` to render your template `

Hello

` ### HTTP ```js App.controller('PhoneListCtrl', function ($scope, $http) { $http.get('/data.json').success(function (data) { $scope.phones = data; })    }); ``` ================================================ FILE: animated_gif.md ================================================ --- title: Animated GIFs category: CLI --- ## Animated GIFs {: .-one-column} ### Convert MP4 to GIF ```bash mkdir -p gif mplayer -ao null -vo gif89a:outdir=gif $INPUT mogrify -format gif *.png gifsicle --colors=256 --delay=4 --loopcount=0 --dither -O3 gif/*.gif > ${INPUT%.*}.gif rm -rf gif ``` You'll need `mplayer`, `imagemagick` and `gifsicle`. This converts frames to .png, then turns them into an animated gif. ### A given range ```bash mplayer -ao null -ss 0:02:06 -endpos 0:05:00 -vo gif89a:outdir=gif videofile.mp4 ``` See `-ss` and `-endpos`. ================================================ FILE: ansi.md ================================================ --- title: Ansi codes category: CLI intro: | Quick reference to ANSI color codes. --- ### Format ``` \033[#m ``` ### ANSI codes ``` 0 clear 1 bold 4 underline 5 blink 30-37 fg color 40-47 bg color 1K clear line (to beginning of line) 2K clear line (entire line) 2J clear screen 0;0H move cursor to 0;0 1A move up 1 line ``` ### Colors ``` 0 black 1 red 2 green 3 yellow 4 blue 5 magenta 6 cyan 7 white ``` ### Bash utilities ```sh hide_cursor() { printf "\e[?25l"; } show_cursor() { printf "\e[?25h"; } ``` ================================================ FILE: ansible-examples.md ================================================ --- title: Ansible examples category: Ansible --- ### Examples * [Ruby installation](https://github.com/chelsea/ansible-example-ruby/blob/master/roles/webserver/tasks/main.yml) _(github.com)_ * [Postgres installation](https://github.com/chelsea/ansible-example-ruby/blob/master/roles/db/tasks/main.yml) _(github.com)_ * [GitLab installation](https://github.com/tingtun/ansible-playbook-gitlab) _(github.com)_ ================================================ FILE: ansible-guide.md ================================================ --- title: "Ansible quickstart" category: Ansible description: | A quick guide to getting started with your first Ansible playbook. --- ### Install Ansible ```bash $ brew install ansible # OSX $ [sudo] apt install ansible # elsewhere ``` Ansible is available as a package in most OS's. See: [Installation](http://docs.ansible.com/ansible/latest/intro_installation.html) ### Start your project ```bash ~$ mkdir setup ~$ cd setup ``` Make a folder for your Ansible files. See: [Getting started](http://docs.ansible.com/ansible/latest/intro_getting_started.html) ## Creating your files ### Inventory file #### ~/setup/hosts ```dosini [sites] 127.0.0.1 192.168.0.1 192.168.0.2 192.168.0.3 ``` This is a list of hosts you want to manage, grouped into groups. (Hint: try using `localhost ansible_connection=local` to deploy to your local machine.) See: [Intro to Inventory](http://docs.ansible.com/ansible/latest/intro_inventory.html) ### Playbook #### ~/setup/playbook.yml ```yaml - hosts: 127.0.0.1 user: root tasks: - name: install nginx apt: pkg=nginx state=present - name: start nginx every bootup service: name=nginx state=started enabled=yes - name: do something in the shell shell: echo hello > /tmp/abc.txt - name: install bundler gem: name=bundler state=latest ``` See: [Intro to Playbooks](http://docs.ansible.com/ansible/latest/playbooks_intro.html) ## Running ### Running ansible-playbook ``` ~/setup$ ls hosts playbook.yml ``` #### Running the playbook ``` ~/setup$ ansible-playbook -i hosts playbook.yml PLAY [all] ******************************************************************** GATHERING FACTS *************************************************************** ok: [127.0.0.1] TASK: [install nginx] ********************************************************* ok: [127.0.0.1] TASK: start nginx every bootup] *********************************************** ok: [127.0.0.1] ... ``` ## Read more * [Getting started with Ansible](http://lowendbox.com/blog/getting-started-with-ansible/) _(lowendbox.com)_ * [Getting started](http://docs.ansible.com/ansible/latest/intro_getting_started.html) _(docs.ansible.com)_ * [Intro to Inventory](http://docs.ansible.com/ansible/latest/intro_inventory.html) _(docs.ansible.com)_ * [Intro to Playbooks](http://docs.ansible.com/ansible/latest/playbooks_intro.html) _(docs.ansible.com)_ * [Ansible Tutorial for Beginners: Playbook & Examples](https://spacelift.io/blog/ansible-tutorial) _(spacelift.io)_ * [Working with Ansible Playbooks – Tips & Tricks with Examples](https://spacelift.io/blog/ansible-playbooks) _(spacelift.io)_ ================================================ FILE: ansible-modules.md ================================================ --- title: Ansible modules category: Ansible prism_languages: [yaml] updated: 2017-10-03 --- {% raw %} ## Format ### Basic file ```yaml --- - hosts: production remote_user: root tasks: - ··· ``` Place your modules inside `tasks`. ### Task formats #### One-line ```yaml - apt: pkg=vim state=present ``` #### Map ```yaml - apt: pkg: vim state: present ``` #### Foldable scalar ```yaml - apt: > pkg=vim state=present ``` Define your tasks in any of these formats. One-line format is preferred for short declarations, while maps are preferred for longer. ## Modules ### Aptitude #### Packages ```yaml - apt: pkg: nodejs state: present # absent | latest update_cache: yes force: no ``` #### Deb files ```yaml - apt: deb: "https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb" ``` #### Repositories ```yaml - apt_repository: repo: "deb https://··· raring main" state: present ``` #### Repository keys ```yaml - apt_key: id: AC40B2F7 url: "http://···" state: present ``` ### git ```yaml - git: repo: git://github.com/ dest: /srv/checkout version: master depth: 10 bare: yes ``` See: [git module](https://devdocs.io/ansible/git_module) ### git_config ```yaml - git_config: name: user.email scope: global # local | system value: hi@example.com ``` See: [git_config module](https://devdocs.io/ansible/git_config_module) ### user ```yaml - user: state: present name: git system: yes shell: /bin/sh groups: admin comment: "Git Version Control" ``` See: [user module](https://devdocs.io/ansible/user_module) ### service ```yaml - service: name: nginx state: started enabled: yes # optional ``` See: [service module](https://devdocs.io/ansible/service_module) ## Shell ### shell ```yaml - shell: apt-get install nginx -y ``` #### Extra options ```yaml - shell: echo hello args: creates: /path/file # skip if this exists removes: /path/file # skip if this is missing chdir: /path # cd here before running ``` #### Multiline example ```yaml - shell: | echo "hello there" echo "multiple lines" ``` See: [shell module](https://devdocs.io/ansible/shell_module) ### script ```yaml - script: /x/y/script.sh args: creates: /path/file # skip if this exists removes: /path/file # skip if this is missing chdir: /path # cd here before running ``` See: [script module](https://devdocs.io/ansible/script_module) ## Files ### file ```yaml - file: path: /etc/dir state: directory # file | link | hard | touch | absent # Optional: owner: bin group: wheel mode: 0644 recurse: yes # mkdir -p force: yes # ln -nfs ``` See: [file module](https://devdocs.io/ansible/file_module) ### copy ```yaml - copy: src: /app/config/nginx.conf dest: /etc/nginx/nginx.conf # Optional: owner: user group: user mode: 0644 backup: yes ``` See: [copy module](https://devdocs.io/ansible/copy_module) ### template ```yaml - template: src: config/redis.j2 dest: /etc/redis.conf # Optional: owner: user group: user mode: 0644 backup: yes ``` See: [template module](https://devdocs.io/ansible/template_module) ## Local actions ### local_action ```yaml - name: do something locally local_action: shell echo hello ``` ### debug ```yaml - debug: msg: "Hello {{ var }}" ``` See: [debug module](https://devdocs.io/ansible/debug_module) {% endraw %} ================================================ FILE: ansible-roles.md ================================================ --- title: Ansible roles category: Ansible --- ### Structure roles/ common/ tasks/ handlers/ files/ # 'copy' will refer to this templates/ # 'template' will refer to this meta/ # Role dependencies here vars/ defaults/ main.yml ### References * http://www.ansibleworks.com/docs/playbooks_roles.html ================================================ FILE: ansible.md ================================================ --- title: Ansible category: Ansible --- {% raw %} ## Getting started ### About {: .-intro} - ### Hosts $ sudo mkdir /etc/ansible $ sudo vim /etc/ansible/hosts [example] 192.0.2.101 192.0.2.102 ### Running a playbook $ ansible-playbook playbook.yml ## Playbook files ### Tasks - hosts: all user: root sudo: no vars: aaa: bbb tasks: - ... handlers: - ... ### Includes tasks: - include: db.yml handlers: - include: db.yml user=timmy ### Handlers handlers: - name: start apache2 action: service name=apache2 state=started tasks: - name: install apache action: apt pkg=apache2 state=latest notify: - start apache2 ### Vars - host: lol vars_files: - vars.yml vars: project_root: /etc/xyz tasks: - name: Create the SSH directory. file: state=directory path=${project_root}/home/.ssh/ only_if: "$vm == 0" ### Roles - host: xxx roles: - db - { role:ruby, sudo_user:$user } - web # Uses: # roles/db/tasks/*.yml # roles/db/handlers/*.yml ### Task: Failures - name: my task command: ... register: result failed_when: "'FAILED' in result.stderr" ignore_errors: yes changed_when: "result.rc != 2" ### Env vars vars: local_home: "{{ lookup('env','HOME') }}" {% endraw %} ================================================ FILE: appcache.md ================================================ --- title: Appcache category: HTML --- ### Format ``` CACHE MANIFEST # version CACHE: https://www.google.com/jsapi /assets/app.js /assets/bg.png NETWORK: * ``` Note that Appcache is deprecated! See: [Using the application cache](https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache) _(developer.mozilla.org)_ ================================================ FILE: applescript.md ================================================ --- title: AppleScript updated: 2018-12-06 category: macOS prism_languages: [applescript] --- ### Running ```applescript osascript -e "..." ``` ```applescript display notification "X" with title "Y" ``` ### Comments ```applescript -- This is a single line comment ``` ```applescript # This is another single line comment ``` ```applescript (* This is a multi line comment *) ``` ### Say ```applescript -- default voice say "Hi I am a Mac" ``` ```applescript -- specified voice say "Hi I am a Mac" using "Zarvox" ``` ### Beep ```applescript -- beep once beep ``` ```applescript -- beep 10 times beep 10 ``` ### Delay ```applescript -- delay for 5 seconds delay 5 ``` ### Handlers ```applescript on doubleNumber(n) return n * 2 end doubleNumber set doubledValue to my doubleNumber(2) ``` ================================================ FILE: applinks.md ================================================ --- title: Applinks category: HTML --- ### About - ### Applinks ### Device types * `ios` * `ipad` * `iphone` * `android` * `windows_phone` * `web` ### Reference * [applinks.org](http://applinks.org/documentation/) ================================================ FILE: arel.md ================================================ --- title: Arel category: Rails --- ### About {: .-intro} Arel is an SQL abstraction library built into Ruby on Rails. * ### Tables ```rb users = Arel::Table.new(:users) users = User.arel_table # ActiveRecord model ``` ### Fields ```rb users[:name] users[:id] ``` ### `where` (restriction) ```rb users.where(users[:name].eq('amy')) # SELECT * FROM users WHERE users.name = 'amy' ``` ### `select` (projection) ```rb users.project(users[:id]) # SELECT users.id FROM users ``` ### `join` #### basic join In ActiveRecord (without Arel), if `:photos` is the name of the association, use `joins` ```rb users.joins(:photos) ``` In Arel, if `photos` is defined as the Arel table, ```rb photos = Photo.arel_table users.join(photos) users.join(photos, Arel::Nodes::OuterJoin).on(users[:id].eq(photos[:user_id])) ``` #### join with conditions ```rb users.joins(:photos).merge(Photo.where(published: true)) ``` If the simpler version doesn't help and you want to add more SQL statements to it: ```rb users.join( users.join(photos, Arel::Nodes::OuterJoin) .on(photos[:user_id].eq(users[:id]).and(photos[:published].eq(true))) ) ``` #### advanced join multiple `joins` with the same table but different meanings and/or conditions ```rb creators = User.arel_table.alias('creators') updaters = User.arel_table.alias('updaters') photos = Photo.arel_table photos_with_credits = photos .join(photos.join(creators, Arel::Nodes::OuterJoin).on(photos[:created_by_id].eq(creators[:id]))) .join(photos.join(updaters, Arel::Nodes::OuterJoin).on(photos[:assigned_id].eq(updaters[:id]))) .project(photos[:name], photos[:created_at], creators[:name].as('creator'), updaters[:name].as('editor')) photos_with_credits.to_sql # => "SELECT `photos`.`name`, `photos`.`created_at`, `creators`.`name` AS creator, `updaters`.`name` AS editor FROM `photos` INNER JOIN (SELECT FROM `photos` LEFT OUTER JOIN `users` `creators` ON `photos`.`created_by_id` = `creators`.`id`) INNER JOIN (SELECT FROM `photos` LEFT OUTER JOIN `users` `updaters` ON `photos`.`updated_by_id` = `updaters`.`id`)" # after the request is done, you can use the attributes you named # it's as if every Photo record you got has "creator" and "editor" fields, containing creator name and editor name photos_with_credits.map{|x| "#{photo.name} - copyright #{photo.created_at.year} #{photo.creator}, edited by #{photo.editor}" }.join('; ') ``` ### `limit` / `offset` ```rb users.take(5) # => SELECT * FROM users LIMIT 5 users.skip(4) # => SELECT * FROM users OFFSET 4 ``` ### Aggregates ```rb users.project(users[:age].sum) # .average .minimum .maximum users.project(users[:id].count) users.project(users[:id].count.as('user_count')) ``` ### `order` ```rb users.order(users[:name]) users.order(users[:name], users[:age].desc) users.reorder(users[:age]) ``` ### With ActiveRecord ```rb User.arel_table User.where(id: 1).arel ``` ### Clean code with arel Most of the clever stuff should be in scopes, e.g. the code above could become: ```rb photos_with_credits = Photo.with_creator.with_editor ``` You can store requests in variables then add SQL segments: ```rb all_time = photos_with_credits.count this_month = photos_with_credits.where(photos[:created_at].gteq(Date.today.beginning_of_month)) recent_photos = photos_with_credits.where(photos[:created_at].gteq(Date.today.beginning_of_month)).limit(5) ``` ================================================ FILE: astro.config.mjs ================================================ import { defineConfig } from 'astro/config' import partytown from '@astrojs/partytown' /* * https://astro.build/config */ import tailwind from '@astrojs/tailwind' // https://astro.build/config export default defineConfig({ site: 'https://devhints.io', build: { format: 'file' /* generate /my-post.html instead of /my-post/index.html */, inlineStylesheets: 'always' }, prefetch: { prefetchAll: true }, server: { host: true } /* access from https://192.168.x.x/ */, integrations: [ partytown({ config: { forward: ['dataLayer.push'] } }), tailwind() ], markdown: { // Syntax highlighting is handled by render() syntaxHighlight: false } }) ================================================ FILE: atom.md ================================================ --- title: Atom category: Apps updated: 2021-09-10 --- ## Shortcuts {: .-three-column} ### Tree | Shortcut | Description | | -------- | ------------------- | | `⌘\` | Toggle tree | | `⌘⇧\` | Reveal current file | {: .-shortcuts} ### Comments | Shortcut | Description | | -------- | --------------- | | `⌘/` | Toggle comments | {: .-shortcuts} ### View | Shortcut | Description | | -------- | ---------------------- | | `⌘k` `←,→,↑,↓` | Split pane to the left, right, up, or down | | --- | --- | | `⌘⌥=` | Grow pane | | `⌘⌥-` | Shrink pane | | --- | --- | | `^⇧←`/`^⇧→` | Move tab to left/right | {: .-shortcuts} ### Bracket matcher | Shortcut | Description | | -------- | ------------------------------ | | `^m` | Go to matching bracket | | `^⌫` | Remove brackets from selection | | `^⌘m` | Select inside brackets | | `⌥⌘.` | Close tag | {: .-shortcuts} ### Symbols view | Shortcut | Description | | -------- | -------------------------------- | | `⌥⌘↓` | Jump to declaration under cursor | | `^⇧r` | Show tags | {: .-shortcuts} Symbols view enables Ctags support for Atom. See: [Symbols view](https://atom.io/packages/symbols-view) ### Git | Shortcut | Description | | -------- | ------------------------------ | | `^⇧9` | Show Git pane | | `^⇧8` | Show GitHub pane | {: .-shortcuts} ### Editing | Shortcut | Description | | -------- | -------------- | | `⌘d` | Select word | | `⌘l` | Select line | | --- | --- | | `^⌘↑` | Move line up | | `^⌘↓` | Move line down | | --- | --- | | `⌘⏎` | New line below | | `⌘⇧⏎` | New line above | | --- | --- | | `^⇧k` | Delete line | | `⌘⇧d` | Duplicate line | {: .-shortcuts} ### Project | Shortcut | Description | | -------- | ----------------------- | | `⌘⇧p` | Command palette | | `⌘⇧o` | Add project folder | | --- | --- | | `⌘n` | New file | | `⌘⇧n` | New window | | --- | --- | | `⌘f` | Find in file | | `⌘⇧f` | Find in project | | `⌘t` | Search files in project | {: .-shortcuts} ## Notes ### ⌘ - For Windows and Linux, `⌘` is the `Control` key. - For macOS, it's the `Command` key. ### ⌥ - For Windows and Linux, `⌥` is the `Alt` key. - For macOS, it's the `Option` key. ================================================ FILE: awesome-redux.md ================================================ --- title: Awesome Redux category: React updated: 2017-11-19 --- ### redux-actions Create action creators in flux standard action format. {: .-setup} ```js increment = createAction('INCREMENT', amount => amount) increment = createAction('INCREMENT') // same ``` ```js increment(42) === { type: 'INCREMENT', payload: 42 } ``` ```js // Errors are handled for you: err = new Error() increment(err) === { type: 'INCREMENT', payload: err, error: true } ``` [redux-actions](https://www.npmjs.com/package/redux-actions) {: .-crosslink} ### flux-standard-action A standard for flux action objects. An action may have an `error`, `payload` and `meta` and nothing else. {: .-setup} ```js { type: 'ADD_TODO', payload: { text: 'Work it' } } { type: 'ADD_TODO', payload: new Error(), error: true } ``` [flux-standard-action](https://github.com/acdlite/flux-standard-action) {: .-crosslink} ### redux-multi Dispatch multiple actions in one action creator. {: .-setup} ```js store.dispatch([ { type: 'INCREMENT', payload: 2 }, { type: 'INCREMENT', payload: 3 } ]) ``` [redux-multi](https://github.com/ashaffer/redux-multi) {: .-crosslink} ### reduce-reducers Combines reducers (like *combineReducers()*), but without namespacing magic. {: .-setup} ```js re = reduceReducers( (state, action) => state + action.number, (state, action) => state + action.number ) re(10, { number: 2 }) //=> 14 ``` [reduce-reducers](https://www.npmjs.com/package/reduce-reducers) {: .-crosslink} ### redux-logger Logs actions to your console. {: .-setup} ```js // Nothing to see here ``` [redux-logger](https://github.com/evgenyrodionov/redux-logger) {: .-crosslink} Async ----- ### redux-promise Pass promises to actions. Dispatches a flux-standard-action. {: .-setup} ```js increment = createAction('INCREMENT') // redux-actions increment(Promise.resolve(42)) ``` [redux-promise](https://github.com/acdlite/redux-promise) {: .-crosslink} ### redux-promises Sorta like that, too. Works by letting you pass *thunks* (functions) to `dispatch()`. Also has 'idle checking'. {: .-setup} ```js fetchData = (url) => (dispatch) => { dispatch({ type: 'FETCH_REQUEST' }) fetch(url) .then((data) => dispatch({ type: 'FETCH_DONE', data }) .catch((error) => dispatch({ type: 'FETCH_ERROR', error }) }) store.dispatch(fetchData('/posts')) ``` ```js // That's actually shorthand for: fetchData('/posts')(store.dispatch) ``` [redux-promises](https://www.npmjs.com/package/redux-promises) {: .-crosslink} ### redux-effects Pass side effects declaratively to keep your actions pure. {: .-setup} ```js { type: 'EFFECT_COMPOSE', payload: { type: 'FETCH' payload: {url: '/some/thing', method: 'GET'} }, meta: { steps: [ [success, failure] ] } } ``` [redux-effects](https://www.npmjs.com/package/redux-effects) {: .-crosslink} ### redux-thunk Pass "thunks" to as actions. Extremely similar to redux-promises, but has support for getState. {: .-setup} ```js fetchData = (url) => (dispatch, getState) => { dispatch({ type: 'FETCH_REQUEST' }) fetch(url) .then((data) => dispatch({ type: 'FETCH_DONE', data }) .catch((error) => dispatch({ type: 'FETCH_ERROR', error }) }) store.dispatch(fetchData('/posts')) ``` ```js // That's actually shorthand for: fetchData('/posts')(store.dispatch, store.getState) ``` ```js // Optional: since fetchData returns a promise, it can be chained // for server-side rendering store.dispatch(fetchPosts()).then(() => { ReactDOMServer.renderToString() }) ``` [redux-thunk](https://www.npmjs.com/package/redux-thunk) {: .-crosslink} ================================================ FILE: awscli.md ================================================ --- title: AWS CLI category: Devops --- ### EC2 ``` aws ec2 describe-instances aws ec2 start-instances --instance-ids i-12345678c aws ec2 terminate-instances --instance-ids i-12345678c ``` ### S3 ``` aws s3 ls s3://mybucket aws s3 rm s3://mybucket/folder --recursive aws s3 cp myfolder s3://mybucket/folder --recursive aws s3 sync myfolder s3://mybucket/folder --exclude *.tmp ``` ### ECS ``` aws ecs create-cluster --cluster-name=NAME --generate-cli-skeleton aws ecs create-service ``` ### Homebrew ``` brew install awscli aws configure ``` ### Configuration profiles ``` aws configure --profile project1 aws configure --profile project2 ``` ## Elastic Beanstalk ### Configuration * .elasticbeanstalk/config.yml - application config * .elasticbeanstalk/dev-env.env.yml - environment config ``` eb config ``` See: ## ebextensions * * ## Also see * [AWS CLI](https://aws.amazon.com/cli/) * [Documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) * [All commands](https://docs.aws.amazon.com/cli/latest/reference/#available-services) ================================================ FILE: backbone.md ================================================ --- title: Backbone.js updated: 2018-12-06 category: JavaScript libraries --- ### Binding events ```js .on('event', callback) .on('event', callback, context) ``` ```js .on({ 'event1': callback, 'event2': callback }) ``` ```js .on('all', callback) ``` ```js .once('event', callback) // Only happens once ``` ### Unbinding events ```js object.off('change', onChange) // just the `onChange` callback object.off('change') // all 'change' callbacks object.off(null, onChange) // `onChange` callback for all events object.off(null, null, context) // all callbacks for `context` all events object.off() // all ``` ### Events ```js object.trigger('event') ``` ```js view.listenTo(object, event, callback) view.stopListening() ``` ### List of events * Collection: * `add` (model, collection, options) * `remove` (model, collection, options) * `reset` (collection, options) * `sort` (collection, options) * Model: * `change` (model, options) * `change:[attr]` (model, value, options) * `destroy` (model, collection, options) * `error` (model, xhr, options) * Model and collection: * `request` (model, xhr, options) * `sync` (model, resp, options) * Router: * `route:[name]` (params) * `route` (router, route, params) ## Views ### Defining ```js // All attributes are optional var View = Backbone.View.extend({ model: doc, ``` ```js tagName: 'div', className: 'document-item', id: "document-" + doc.id, attributes: { href: '#' }, ``` ```js el: 'body', ``` ```js events: { 'click button.save': 'save', 'click .cancel': function() { ··· }, 'click': 'onclick' }, ``` ```js constructor: function() { ··· }, render: function() { ··· } }) ``` ### Instantiating ```js view = new View() view = new View({ el: ··· }) ``` ### Methods ```js view.$el.show() view.$('input') ``` ```js view.remove() ``` ```js view.delegateEvents() view.undelegateEvents() ``` ## Models ### Defining ```js // All attributes are optional var Model = Backbone.Model.extend({ defaults: { 'author': 'unknown' }, idAttribute: '_id', parse: function() { ··· } }) ``` ### Instantiating ```js var obj = new Model({ title: 'Lolita', author: 'Nabokov' }) ``` ```js var obj = new Model({ collection: ··· }) ``` ### Methods ```js obj.id obj.cid // → 'c38' (client-side ID) ``` ```js obj.clone() ``` ```js obj.hasChanged('title') obj.changedAttributes() // false, or hash obj.previousAttributes() // false, or hash obj.previous('title') ``` ```js obj.isNew() ``` ```js obj.set({ title: 'A Study in Pink' }) obj.set({ title: 'A Study in Pink' }, { validate: true, silent: true }) obj.unset('title') ``` ```js obj.get('title') obj.has('title') obj.escape('title') /* Like .get() but HTML-escaped */ ``` ```js obj.clear() obj.clear({ silent: true }) ``` ```js obj.save() obj.save({ attributes }) obj.save(null, { silent: true, patch: true, wait: true, success: callback, error: callback }) ``` ```js obj.destroy() obj.destroy({ wait: true, success: callback, error: callback }) ``` ```js obj.toJSON() ``` ```js obj.fetch() obj.fetch({ success: callback, error: callback }) ``` ### Validation ```js var Model = Backbone.Model.extend({ validate: function(attrs, options) { if (attrs.end < attrs.start) { return "Can't end before it starts" } } }) ``` {: data-line="2"} ```js obj.validationError //=> "Can't end before it starts" obj.isValid() obj.on('invalid', function (model, error) { ··· }) ``` ```js // Triggered on: obj.save() obj.set({ ··· }, { validate: true }) ``` ### Custom URLs ```js var Model = Backbone.Model.extend({ // Single URL (string or function) url: '/account', url: function() { return '/account' }, ``` ```js // Both of these two work the same way url: function() { return '/books/' + this.id }), urlRoot: '/books' }) ``` ```js var obj = new Model({ url: ··· }) var obj = new Model({ urlRoot: ··· }) ``` ## References {: .-one-column} - [Backbone website](http://backbonejs.org/) _(backbonejs.org)_ - [Backbone patterns](http://ricostacruz.com/backbone-patterns/) _(ricostacruz.com)_ ================================================ FILE: bash.md ================================================ --- title: Bash scripting category: CLI tags: [Featured] updated: 2020-07-05 keywords: - Variables - Functions - Interpolation - Brace expansions - Loops - Conditional execution - Command substitution --- ## Getting started {: .-three-column} ### Introduction {: .-intro} This is a quick reference to getting started with Bash scripting. - [Learn bash in y minutes](https://learnxinyminutes.com/docs/bash/) _(learnxinyminutes.com)_ - [Bash Guide](http://mywiki.wooledge.org/BashGuide) _(mywiki.wooledge.org)_ - [Bash Hackers Wiki](https://web.archive.org/web/20230406205817/https://wiki.bash-hackers.org/) _(wiki.bash-hackers.org)_ ### Example ```bash #!/usr/bin/env bash name="John" echo "Hello $name!" ``` ### Variables ```bash name="John" echo $name # see below echo "$name" echo "${name}!" ``` Generally quote your variables unless they contain wildcards to expand or command fragments. ```bash wildcard="*.txt" options="iv" cp -$options $wildcard /tmp ``` ### String quotes ```bash name="John" echo "Hi $name" #=> Hi John echo 'Hi $name' #=> Hi $name ``` ### Shell execution ```bash echo "I'm in $(pwd)" echo "I'm in `pwd`" # obsolescent # Same ``` See [Command substitution](https://web.archive.org/web/20230326081741/https://wiki.bash-hackers.org/syntax/expansion/cmdsubst) ### Conditional execution ```bash git commit && git push git commit || echo "Commit failed" ``` ### Functions {: id='functions-example'} ```bash get_name() { echo "John" } echo "You are $(get_name)" ``` See: [Functions](#functions) ### Conditionals {: id='conditionals-example'} ```bash if [[ -z "$string" ]]; then echo "String is empty" elif [[ -n "$string" ]]; then echo "String is not empty" fi ``` See: [Conditionals](#conditionals) ### Strict mode ```bash set -euo pipefail IFS=$'\n\t' ``` See: [Unofficial bash strict mode](http://redsymbol.net/articles/unofficial-bash-strict-mode/) ### Brace expansion ```bash echo {A,B}.js ``` | Expression | Description | | ---------------------- | --------------------- | | `{A,B}` | Same as `A B` | | `{A,B}.js` | Same as `A.js B.js` | | `{1..5}` | Same as `1 2 3 4 5` | | {{1..3},{7..9}} | Same as `1 2 3 7 8 9` | See: [Brace expansion](https://web.archive.org/web/20230207192110/https://wiki.bash-hackers.org/syntax/expansion/brace) ## Parameter expansions {: .-three-column} ### Basics ```bash name="John" echo "${name}" echo "${name/J/j}" #=> "john" (substitution) echo "${name:0:2}" #=> "Jo" (slicing) echo "${name::2}" #=> "Jo" (slicing) echo "${name::-1}" #=> "Joh" (slicing) echo "${name:(-1)}" #=> "n" (slicing from right) echo "${name:(-2):1}" #=> "h" (slicing from right) echo "${food:-Cake}" #=> $food or "Cake" ``` ```bash length=2 echo "${name:0:length}" #=> "Jo" ``` See: [Parameter expansion](https://web.archive.org/web/20230408142504/https://wiki.bash-hackers.org/syntax/pe) ```bash str="/path/to/foo.cpp" echo "${str%.cpp}" # /path/to/foo echo "${str%.cpp}.o" # /path/to/foo.o echo "${str%/*}" # /path/to echo "${str##*.}" # cpp (extension) echo "${str##*/}" # foo.cpp (basepath) echo "${str#*/}" # path/to/foo.cpp echo "${str##*/}" # foo.cpp echo "${str/foo/bar}" # /path/to/bar.cpp ``` ```bash str="Hello world" echo "${str:6:5}" # "world" echo "${str: -5:5}" # "world" ``` ```bash src="/path/to/foo.cpp" base=${src##*/} #=> "foo.cpp" (basepath) dir=${src%$base} #=> "/path/to/" (dirpath) dir=${src%/*} #=> "/path/to" (dirpath) ``` ### Prefix name expansion ```bash prefix_a=one prefix_b=two echo ${!prefix_*} # all variables names starting with `prefix_` prefix_a prefix_b ``` ### Indirection ```bash name=joe pointer=name echo ${!pointer} joe ``` ### Substitution | Code | Description | | ----------------- | ------------------- | | `${foo%suffix}` | Remove suffix | | `${foo#prefix}` | Remove prefix | | --- | --- | | `${foo%%suffix}` | Remove long suffix | | `${foo/%suffix}` | Remove long suffix | | `${foo##prefix}` | Remove long prefix | | `${foo/#prefix}` | Remove long prefix | | --- | --- | | `${foo/from/to}` | Replace first match | | `${foo//from/to}` | Replace all | | --- | --- | | `${foo/%from/to}` | Replace suffix | | `${foo/#from/to}` | Replace prefix | ### Comments ```bash # Single line comment ``` ```bash : ' This is a multi line comment ' ``` ### Substrings | Expression | Description | | --------------- | ------------------------------ | | `${foo:0:3}` | Substring _(position, length)_ | | `${foo:(-3):3}` | Substring from the right | ### Length | Expression | Description | | ---------- | ---------------- | | `${#foo}` | Length of `$foo` | ### Manipulation ```bash str="HELLO WORLD!" echo "${str,}" #=> "hELLO WORLD!" (lowercase 1st letter) echo "${str,,}" #=> "hello world!" (all lowercase) str="hello world!" echo "${str^}" #=> "Hello world!" (uppercase 1st letter) echo "${str^^}" #=> "HELLO WORLD!" (all uppercase) ``` ### Default values | Expression | Description | | ----------------- | -------------------------------------------------------- | | `${foo:-val}` | `$foo`, or `val` if unset (or null) | | `${foo:=val}` | Set `$foo` to `val` if unset (or null) | | `${foo:+val}` | `val` if `$foo` is set (and not null) | | `${foo:?message}` | Show error message and exit if `$foo` is unset (or null) | Omitting the `:` removes the (non)nullity checks, e.g. `${foo-val}` expands to `val` if unset otherwise `$foo`. ## Loops {: .-three-column} ### Basic for loop ```bash for i in /etc/rc.*; do echo "$i" done ``` ### C-like for loop ```bash for ((i = 0 ; i < 100 ; i++)); do echo "$i" done ``` ### Ranges ```bash for i in {1..5}; do echo "Welcome $i" done ``` #### With step size ```bash for i in {5..50..5}; do echo "Welcome $i" done ``` ### Reading lines ```bash while read -r line; do echo "$line" done 0 bytes | | `[[ -f FILE ]]` | File | | `[[ -x FILE ]]` | Executable | | --- | --- | | `[[ FILE1 -nt FILE2 ]]` | 1 is more recent than 2 | | `[[ FILE1 -ot FILE2 ]]` | 2 is more recent than 1 | | `[[ FILE1 -ef FILE2 ]]` | Same files | ### Example ```bash # String if [[ -z "$string" ]]; then echo "String is empty" elif [[ -n "$string" ]]; then echo "String is not empty" else echo "This never happens" fi ``` ```bash # Combinations if [[ X && Y ]]; then ... fi ``` ```bash # Equal if [[ "$A" == "$B" ]] ``` ```bash # Regex if [[ "A" =~ . ]] ``` ```bash if (( $a < $b )); then echo "$a is smaller than $b" fi ``` ```bash if [[ -e "file.txt" ]]; then echo "file exists" fi ``` ## Arrays ### Defining arrays ```bash Fruits=('Apple' 'Banana' 'Orange') ``` ```bash Fruits[0]="Apple" Fruits[1]="Banana" Fruits[2]="Orange" ``` ### Working with arrays ```bash echo "${Fruits[0]}" # Element #0 echo "${Fruits[-1]}" # Last element echo "${Fruits[@]}" # All elements, space-separated echo "${#Fruits[@]}" # Number of elements echo "${#Fruits}" # String length of the 1st element echo "${#Fruits[3]}" # String length of the Nth element echo "${Fruits[@]:3:2}" # Range (from position 3, length 2) echo "${!Fruits[@]}" # Keys of all elements, space-separated ``` ### Operations ```bash Fruits=("${Fruits[@]}" "Watermelon") # Push Fruits+=('Watermelon') # Also Push Fruits=( "${Fruits[@]/Ap*/}" ) # Remove by regex match unset Fruits[2] # Remove one item Fruits=("${Fruits[@]}") # Duplicate Fruits=("${Fruits[@]}" "${Veggies[@]}") # Concatenate words=($(< datafile)) # From file (split by IFS) ``` ### Iteration ```bash for i in "${arrayName[@]}"; do echo "$i" done ``` ## Dictionaries {: .-three-column} ### Defining ```bash declare -A sounds ``` ```bash sounds[dog]="bark" sounds[cow]="moo" sounds[bird]="tweet" sounds[wolf]="howl" ``` Declares `sound` as a Dictionary object (aka associative array). ### Working with dictionaries ```bash echo "${sounds[dog]}" # Dog's sound echo "${sounds[@]}" # All values echo "${!sounds[@]}" # All keys echo "${#sounds[@]}" # Number of elements unset sounds[dog] # Delete dog ``` ### Iteration #### Iterate over values ```bash for val in "${sounds[@]}"; do echo "$val" done ``` #### Iterate over keys ```bash for key in "${!sounds[@]}"; do echo "$key" done ``` ## Options ### Options ```bash set -o noclobber # Avoid overlay files (echo "hi" > foo) set -o errexit # Used to exit upon error, avoiding cascading errors set -o pipefail # Unveils hidden failures set -o nounset # Exposes unset variables ``` ### Glob options ```bash shopt -s nullglob # Non-matching globs are removed ('*.foo' => '') shopt -s failglob # Non-matching globs throw errors shopt -s nocaseglob # Case insensitive globs shopt -s dotglob # Wildcards match dotfiles ("*.sh" => ".foo.sh") shopt -s globstar # Allow ** for recursive matches ('lib/**/*.rb' => 'lib/a/b/c.rb') ``` Set `GLOBIGNORE` as a colon-separated list of patterns to be removed from glob matches. ## History ### Commands | Command | Description | | --------------------- | ----------------------------------------- | | `history` | Show history | | `shopt -s histverify` | Don't execute expanded result immediately | ### Expansions | Expression | Description | | ------------ | ---------------------------------------------------- | | `!$` | Expand last parameter of most recent command | | `!*` | Expand all parameters of most recent command | | `!-n` | Expand `n`th most recent command | | `!n` | Expand `n`th command in history | | `!` | Expand most recent invocation of command `` | ### Operations | Code | Description | | -------------------- | --------------------------------------------------------------------- | | `!!` | Execute last command again | | `!!:s///` | Replace first occurrence of `` to `` in most recent command | | `!!:gs///` | Replace all occurrences of `` to `` in most recent command | | `!$:t` | Expand only basename from last parameter of most recent command | | `!$:h` | Expand only directory from last parameter of most recent command | `!!` and `!$` can be replaced with any valid expansion. ### Slices | Code | Description | | -------- | ---------------------------------------------------------------------------------------- | | `!!:n` | Expand only `n`th token from most recent command (command is `0`; first argument is `1`) | | `!^` | Expand first argument from most recent command | | `!$` | Expand last token from most recent command | | `!!:n-m` | Expand range of tokens from most recent command | | `!!:n-$` | Expand `n`th token to last from most recent command | `!!` can be replaced with any valid expansion i.e. `!cat`, `!-2`, `!42`, etc. ## Miscellaneous ### Numeric calculations ```bash $((a + 200)) # Add 200 to $a ``` ```bash $(($RANDOM%200)) # Random number 0..199 ``` ```bash declare -i count # Declare as type integer count+=1 # Increment ``` ### Subshells ```bash (cd somedir; echo "I'm now in $PWD") pwd # still in first directory ``` ### Redirection ```bash python hello.py > output.txt # stdout to (file) python hello.py >> output.txt # stdout to (file), append python hello.py 2> error.log # stderr to (file) python hello.py 2>&1 # stderr to stdout python hello.py 2>/dev/null # stderr to (null) python hello.py >output.txt 2>&1 # stdout and stderr to (file), equivalent to &> python hello.py &>/dev/null # stdout and stderr to (null) echo "$0: warning: too many users" >&2 # print diagnostic message to stderr ``` ```bash python hello.py < foo.txt # feed foo.txt to stdin for python diff <(ls -r) <(ls) # Compare two stdout without files ``` ### Inspecting commands ```bash command -V cd #=> "cd is a function/alias/whatever" ``` ### Trap errors ```bash trap 'echo Error at about $LINENO' ERR ``` or ```bash traperr() { echo "ERROR: ${BASH_SOURCE[1]} at about ${BASH_LINENO[0]}" } set -o errtrace trap traperr ERR ``` ### Case/switch ```bash case "$1" in start | up) vagrant up ;; *) echo "Usage: $0 {start|stop|ssh}" ;; esac ``` ### Source relative ```bash source "${0%/*}/../share/foo.sh" ``` ### printf ```bash printf "Hello %s, I'm %s" Sven Olga #=> "Hello Sven, I'm Olga printf "1 + 1 = %d" 2 #=> "1 + 1 = 2" printf "This is how you print a float: %f" 2 #=> "This is how you print a float: 2.000000" printf '%s\n' '#!/bin/bash' 'echo hello' >file # format string is applied to each group of arguments printf '%i+%i=%i\n' 1 2 3 4 5 9 ``` ### Transform strings | Command option | Description | | -------------- | --------------------------------------------------- | | `-c` | Operations apply to characters not in the given set | | `-d` | Delete characters | | `-s` | Replaces repeated characters with single occurrence | | `-t` | Truncates | | `[:upper:]` | All upper case letters | | `[:lower:]` | All lower case letters | | `[:digit:]` | All digits | | `[:space:]` | All whitespace | | `[:alpha:]` | All letters | | `[:alnum:]` | All letters and digits | #### Example ```bash echo "Welcome To Devhints" | tr '[:lower:]' '[:upper:]' WELCOME TO DEVHINTS ``` ### Directory of script ```bash dir=${0%/*} ``` ### Getting options ```bash while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in -V | --version ) echo "$version" exit ;; -s | --string ) shift; string=$1 ;; -f | --flag ) flag=1 ;; esac; shift; done if [[ "$1" == '--' ]]; then shift; fi ``` ### Heredoc ```sh cat < { ... }) ``` ### Element ```js box = blessed.box({ style: { fg, bg, border.fg, scrollbar.bg, focus.bg, hover.bg }, border: { type: 'line'|'bg', bg, fg, bold, underline } tags: true, // parse {bold}tags{/bold} top, left, width, height, width: '100%', height: '100%-1', top: 'center' }) ``` ### Tags ``` {bold} {right} {center} {|} left-right separator {#c0ff33-fg}{/} ``` ``` blessed.escape('...') ``` ================================================ FILE: bluebird.md ================================================ --- title: bluebird.js category: JavaScript libraries weight: -1 updated: 2017-09-08 --- ### Also see Also see the [promise cheatsheet](promise.html) and [Bluebird.js API](https://github.com/petkaantonov/bluebird/blob/master/API.md) (github.com). ### Example ```js promise .then(okFn, errFn) .spread(okFn, errFn) // * .catch(errFn) .catch(TypeError, errFn) // * .finally(fn) .map(function (e) { ··· }) // * .each(function (e) { ··· }) // * ``` Those marked with `*` are non-standard Promise API that only work with Bluebird promises. ### Multiple return values ```js .then(function () { return [ 'abc', 'def' ] }) .spread(function (abc, def) { ··· }) ``` {: data-line="4"} Use [Promise.spread](http://bluebirdjs.com/docs/api/promise.spread.html) ### Multiple promises ```js Promise.join( getPictures(), getMessages(), getTweets(), function (pics, msgs, tweets) { return ··· } ) ``` {: data-line="1"} Use [Promise.join](http://bluebirdjs.com/docs/api/promise.join.html) ### Multiple promises (array) - [Promise.all](http://bluebirdjs.com/docs/api/promise.all.html)([p]) - expect all to pass - [Promise.some](http://bluebirdjs.com/docs/api/promise.some.html)([p], count) - expect `count` to pass - [Promise.any](http://bluebirdjs.com/docs/api/promise.any.html)([p]) - same as `some([p], 1)` - [Promise.race](http://bluebirdjs.com/docs/api/promise.race.html)([p], count) - use `.any` instead - [Promise.map](http://bluebirdjs.com/docs/api/promise.map.html)([p], fn, options) - supports concurrency ```js Promise.all([ promise1, promise2 ]) .then(results => { results[0] results[1] }) // succeeds if one succeeds first Promise.any(promises) .then(results => { }) ``` {: data-line="1,8"} ```js Promise.map(urls, url => fetch(url)) .then(···) ``` {: data-line="1"} Use [Promise.map](http://bluebirdjs.com/docs/api/promise.map.html) to "promisify" a list of values. ### Object ```js Promise.props({ photos: get('photos'), posts: get('posts') }) .then(res => { res.photos res.posts }) ``` {: data-line="1"} Use [Promise.props](http://bluebirdjs.com/docs/api/promise.props.html). ### Chain of promises ```js function getPhotos() { return Promise.try(() => { if (err) throw new Error("boo") return result }) } getPhotos().then(···) ``` {: data-line="2"} Use [Promise.try](http://bluebirdjs.com/docs/api/promise.try.html). ### Node-style functions ```js var readFile = Promise.promisify(fs.readFile) var fs = Promise.promisifyAll(require('fs')) ``` {: data-line="2"} See [Promisification](http://bluebirdjs.com/docs/api/promisification.html). ### Promise-returning methods ```js User.login = Promise.method((email, password) => { if (!valid) throw new Error("Email not valid") return /* promise */ }) ``` {: data-line="1"} See [Promise.method](http://bluebirdjs.com/docs/api/promise.method.html). ### Generators ```js User.login = Promise.coroutine(function* (email, password) { let user = yield User.find({email: email}).fetch() return user }) ``` {: data-line="1"} See [Promise.coroutine](http://bluebirdjs.com/docs/api/promise.coroutine.html). ## Reference ================================================ FILE: bolt.md ================================================ --- title: Bolt Quickstart category: Bolt updated: 2018-12-25 authors: - github: lucywyman keywords: - Puppet - tasks - modules description: | A quick guide to getting started writing Bolt tasks --- ### Install Bolt ```bash # On MacOS brew cask install puppetlabs/puppet/puppet-bolt # On Windows choco install puppet-bolt ``` Bolt is available as a package for most platforms. See [installing bolt](https://puppet.com/docs/bolt/latest/bolt_installing.html) ### Create a module with a task ```bash mkdir -p ~/.puppetlabs/bolt/modules/mymodule/tasks cp myscript.sh ~/.puppetlabs/bolt/modules/mymodule/tasks/ ``` Tasks can be written in any language your targets can run. See [writing tasks](https://puppet.com/docs/bolt/latest/writing_tasks.html) for more details. ### Run Bolt ```bash bolt task run mymodule::myscript -n node1.example.com,node2.example.com --private-key ~/.ssh/id_rsa-private ``` See `bolt task run --help` for more information and command line options. ================================================ FILE: bookshelf.md ================================================ --- title: Bookshelf.js category: JavaScript libraries --- Model ----- ### Model ```js Summary = bookshelf.Model.extend({ tableName: 'summaries', hasTimestamps: true, hasTimestamps: ['created_at', 'updated_at'], }) ``` ### Associations ```js Summary = bookshelf.Model.extend({ book () { return this.belongsTo(Book) }, author () { return this.hasOne(Author) } // belongsToMany // hasMany // hasMany().through() }) ``` ### CRUD ```js Book.create({ title: '..' }).save() new Book({ title: '..' }).save() new Book({ id: 1 }).fetch() Book.where({ id: 1 }).fetch() Book.where('favorite_color', 'red').fetch() Book.where('favorite_color', '<>', 'red').fetch() Book .query((q) => q.orderBy('updated_at') ``` ================================================ FILE: bootstrap.md ================================================ --- title: Bootstrap prism_languages: [scss, haml, html] weight: -1 category: CSS description: | .container .row .col-md-6, @screen-sm-min, .form-control, grids, .modal-content, tooltips, and other Bootstrap CSS examples. --- ### Screen sizes ``` 768 992 1200 ' ' ' ' ' ' ' ' ' <---------^------------^------------------^---------> xs sm md lg (phone) (tablet) (laptop) (desktop) ``` Min: ```scss @media (min-width: @screen-sm-min) // >= 768px (small tablet) @media (min-width: @screen-md-min) // >= 992px (medium laptop) @media (min-width: @screen-lg-min) // >= 1200px (large desktop) ``` Max: ```scss @media (max-width: @screen-xs-max) { // < 768px (xsmall phone) @media (max-width: @screen-sm-max) { // < 992px (small tablet) @media (max-width: @screen-md-max) { // < 1200px (medium laptop) ``` ### Columns ```scss .container .container-fluid ``` ```scss .col-xs-1 .col-sm-1 .col-md-1 .col-lg-1 .col-md-offset-1 ``` Mixins: ```scss @include make-xs-column(12); @include make-sm-column(6); @include make-md-column(3); @include make-lg-column(3); ``` ```scss @include make-sm-column-offset(1); @include make-sm-column-push(1); @include make-sm-column-pull(1); ``` ### Utilities ```scss .pull-left .pull-right ``` ```scss .hidden-{xs,sm,md,lg} .visible-{xs,sm,md,lg} .visible-{xs,sm,md,lg,print}-{block,inline,inline-block} ``` ```scss .center-block /* margin: auto */ .clearfix .text-{center,left,right,justify,nowrap} .text-{lowercase,uppercase,capitalize} ``` ```scss .show .hidden ``` ### Modal ```html ``` ```haml #new.modal.fade(role='dialog') .modal-dialog // .modal-lg, .modal-sm .modal-content .modal-header %h4.modal-title hello %button.close{type: 'button', data: { dismiss: 'modal' }} %span{'aria-hidden' => true}!= "×" %span.sr-only Close .modal-body ... .modal-footer ... ``` ### Modal via ajax (Rails) ```haml %button.btn{data: { | toggle: 'modal', | target: '#chooseTheme', | remote: '/path/to/remote'} Change Theme ``` ```haml .modal.fade#chooseTheme .modal-dialog.modal-xl .modal-content .modal-header %h4.modal-title Choose a theme .modal-body .spinner-panel.-lg %i ``` ### Tooltip ```html ``` ```js $(function () { $('[data-toogle~="tooltip"]').tooltip() }) ``` ### Input groups ```haml .input-group input.form-control(type='text') .input-group-addon years ``` ================================================ FILE: browser-sync.md ================================================ --- title: Browsersync category: JavaScript libraries --- ### About {: .-intro} `npm i -g browser-sync` * [browsersync.io](https://browsersync.io) ### Start a server ```sh browser-sync start --server --files='**/*.html, **/*.css' ``` ### Options ```sh --port=N --proxy="http://127.0.0.1:3000" ``` ================================================ FILE: browserify.md ================================================ --- title: Browserify category: JavaScript libraries tags: [Archived] archived: Browserify has not been in active development. --- ### About {: .-intro} Browserify is a bundler for JavaScript. - ### Usage browserify input.js -o output.js -t coffeeify -t [ coffeeify --extension coffee ] -u react (--exclude: omit a file) -x react (--external: reference in another bundle) -i react (--ignore: stub a file) -s Myapp (--standalone: generate a UMD bundle) --debug ### Programmatic usage browserify = require('browserify') browserify() .add('main.js') .bundle() .transform(coffeeify) .transform({extensions: '.coffee'}, coffeeify) .pipe(process.stdout) browserify({}) ### Tools * watchify (recompiles on demand) * beefy (http server) * debowerify * es6ify (es6 to es5) Transforms * coffeeify * ractify * reactify * brfs * cssify * https://github.com/substack/node-browserify/wiki/list-of-transforms ================================================ FILE: bulma.md ================================================ --- title: Bulma category: CSS prism_languages: [css, html] weight: -1 updated: 2018-11-19 authors: - github: benolot description: | Basic guide on how to use Bulma, the lightweight css flexbox framework. --- ### Screen sizes ``` 768 1024 1216 1408 ' ' ' ' ' ' ' ' ' ' ' ' <---------^------------^------------------^-------------^-------------> mobile tablet desktop widescreen fullhd ``` ### Columns ```css .container ``` Wrap as many `.column`'s' as you like in a `.columns` wrapper ```html
``` ### Modifiers The following CSS classes affect the **colour**. ```css .is-primary .is-link .is-info .is-success .is-warning .is-danger ``` The following classes modify the **size**. ```css .is-small .is-medium .is-large ``` The following classes modify the **state**. ```scss .is-outlined .is-loading ``` ### Typography Helpers The following classes modify the **font-size** | Class | Font-size | | --- | --- | | `.is-size-1` | 3rem | | `.is-size-2` | 2.5rem | | `.is-size-3` | 2rem | | `.is-size-4` | 1.5rem | | `.is-size-5` | 1.25rem | | `.is-size-6` | 1rem | | `.is-size-7` | 0.75rem | The following classes **align** the text | Class | Alignment | | --- | --- | | `.has-text-centered` | Makes the text **centered** | | `.has-text-justified` | Makes the text **justified** | | `.has-text-left`. | Makes the text align to the **left** | | `.has-text-right` | Makes the text align to the **right** | The following classes **transform** the text | Class | Transformation | | --- | --- | | `.is-capitalized` | Transforms the **first character** of each word to **uppercase** | | `.is-lowercase` | Transforms **all** characters to **lowercase** | | `.is-uppercase` | Transforms **all** characters to **uppercase** | ### WYSIWYG Content ```html

Heading

Paragraph

  • Item 1
  • Item 2
``` To provide default stylings for commonly generated WYSIWYG contents, use the `.content` class. ================================================ FILE: bundler.md ================================================ --- title: Bundler category: Ruby --- ### Commands bundle # same as bundle install bundle install # installs gems bundle install -j3 # faster (3 jobs) bundle update # update all gems bundle update --source gemname # update specified gem bundle outdated # show outdated gems cd `bundle show rails` # inspect a gem's dir bundle gem # new gem skeleton ### Gems gem 'hello' gem 'hello', group: 'development' ### Github support gem 'hello', github: 'rstacruz/hello' gem 'hello', github: 'rstacruz/hello', 'branch: master' ### Grouping group :development do gem 'hello' end ### Deployment $ bundle install --without=test,development --deployment ### Local gem development In your Gemfile, define a Git source and a branch: gem 'hello', github: 'rstacruz/hello', branch: 'master' And then: $ bundle config --global local.xxx ~/projects/xxx ### Rake Gem tasks # Rakefile require 'bundler/gem_tasks' Terminal: $ rake release $ rake build ================================================ FILE: c_preprocessor.md ================================================ --- title: C Preprocessor category: C-like intro: | Quick reference for the [C macro preprocessor](https://en.m.wikipedia.org/wiki/C_preprocessor), which can be used independent of C/C++. --- ## Reference {: .-three-column} ### Compiling ``` $ cpp -P file > outfile ``` ### Includes ``` #include "file" ``` ### Defines ``` #define FOO #define FOO "hello" #undef FOO ``` ### If ``` #ifdef DEBUG console.log('hi'); #elif defined VERBOSE ... #else ... #endif ``` ### Error ``` #if VERSION == 2.0 #error Unsupported #warning Not really supported #endif ``` ### Macro ``` #define DEG(x) ((x) * 57.29) ``` ### Token concat ``` #define DST(name) name##_s name##_t DST(object); #=> object_s object_t; ``` ### Stringification ``` #define STR(name) #name char * a = STR(object); #=> char * a = "object"; ``` ### file and line ``` #define LOG(msg) console.log(__FILE__, __LINE__, msg) #=> console.log("file.txt", 3, "hey") ``` ================================================ FILE: camp.md ================================================ --- title: Camp category: JavaScript libraries updated: 2017-09-21 weight: -1 intro: | [Camp](https://github.com/espadrine/sc/) is a Node.js web server framework. This guide targets Camp v17.x. --- Getting started --------------- {: .-three-column} ### Quick start {: .-prime} #### app.js {: .-file} ```js const Camp = require('camp') const camp = Camp.start({ port: 1234 }) ``` #### web/index.html {: .-file} ```html Hello world! ``` Camp serves files in `web/` by default. ### Routes #### Handles `/search?q=rainbows` ```js camp.path('/search', (req, res) => { const q = res.query.q res.json({ results: ··· }) }) ``` {: data-line="2"} Also available: `camp.post`, `camp.get`. ### Templates ```js const tpl = Camp.template('./templates/post.html') camp.path('/blog/:post.html', (req, res) => { res.template({ text: 'Hello world' }, tpl) }) ``` {: data-line="1,4"} See: [Templates](https://github.com/espadrine/sc/blob/master/doc/Readme.md#templates) ### Not found ```js camp.notFound('/*.lol', (req, res) => { res.file('/404.html') }) ``` {: data-line="1"} See: [Fall through](https://github.com/espadrine/sc/blob/master/doc/Readme.md#fall-through) ### Low level handler ```js camp.handle((req, res, next) => { res.setHeader('X-Hello', 'world') next() }) ``` {: data-line="1"} See: [Handlers](https://github.com/espadrine/sc/blob/master/doc/Readme.md#handlers) Templates --------- ### Basic templates ```js const tpl = Camp.template('/templates/post.html') camp.path('/blog/:post.html', (req, res) => { res.template({ text: 'Hello world' }, tpl) }) ``` {: data-line="1,4,5,6"} ### Implicit templates ```js camp.path('blog.html') ``` Uses `blog.html` as a template. See: [Templates](https://github.com/espadrine/sc/blob/master/doc/Readme.md#templates) Advanced features ----------------- ### Web sockets ```js camp.ws('/path', (socket) => { ··· }) ``` ```js camp.wsChannels[path] ``` ```js camp.wsBroadcast('/path', (req, res) => { }) ``` Sorry I don't completely understand this yet, but check it out in their docs. See: [WebSocket](https://github.com/espadrine/sc/blob/master/doc/Readme.md#websocket) ================================================ FILE: canvas.md ================================================ --- title: Canvas category: JavaScript --- ### Getting the context ```js var canvas = document.getElementById('c') var c = canvas.getContext('2d') ``` ### Basic drawing ```js // x = 10, y = 20, width = 200, height = 100 c.fillStyle = '#ff0000' c.strokeStyle = '#ff00ff' ``` ```js c.lineWidth = 5 c.lineCap = 'round' ``` ```js c.fillRect(10, 20, 200, 100) ``` ```js c.stroke() c.fill() ``` ### Saving and restoring ```js c.save() ``` ```js c.restore() ``` Saves: `strokeStyle` `fillStyle` `globalAlpha` `lineWidth` `lineCap` `lineJoin` `miterLimit` `shadowOffsetX` `shadowOffsetY` `shadowBlur` `shadowColor` `globalCompositeOperation`, Transformations (`translate` `rotate` `scale` `transform` `setTransform`), Clipping path ### Animation ```js onframe: function() { c.clearRect(0, 0, w, h) } ``` ### Transformations ```js c.translate(0, 0) c.rotate(Math.PI*2/5) c.scale(1.0, 1.0) ``` To rotate along origin: ```js c.translate(ox, oy) c.rotate(theta) c.translate(-ox, -oy) ``` To scale along origin: ```js c.translate(-ox*x, -oy*y) c.scale(x, y) c.translate(ox/x, oy/y) ``` See [MDN: Transformations][xform]. ### Image drawing ```js c.drawImage(image, dx, dy, [dw, dh]); /* `image` can be HTML Image/Canvas/Video */ ``` See [MDN: Images][images]. ### Colors, styles shadows ```js c.strokeStyle = '#ff00ff'; c.fillStyle = '#ff00ff'; ``` ```js c.shadowOffsetX = 0; c.shadowOffsetY = 0; c.shadowOffsetBlur = 3.0; c.shadowColor = 'rgba(0,0,0,0.2)'; ``` See [MDN: Styles][styles] ### Gradients ```js gr = c.createLinearGradient(x0,y0,x1,y1) gr = c.createRadialGradient(x0,y0,r0,x1,y1,r1) pat = c.createPattern(image, 'repeat-x') ``` ```js c.fillStyle = gr ``` ### Drawing ```js c.beginPath() c.moveTo(x,y) c.lineTo(x,y) c.quadraticCurveTo(cpx,cpy,x,y) c.bezierCurveTo(cp1x,cp1y,cp2x,cp2y) c.arcTo(...) c.arc(...) c.closePath() ``` ### More resources * [Canvas Cheatsheet PDF][pdf] [pdf]: http://www.nihilogic.dk/labs/canvas_sheet/HTML5_Canvas_Cheat_Sheet.pdf [xform]: https://developer.mozilla.org/en-US/docs/Canvas_tutorial/Transformations [styles]: https://developer.mozilla.org/en-US/docs/Canvas_tutorial/Applying_styles_and_colors [images]: https://developer.mozilla.org/en-US/docs/Canvas_tutorial/Using_images ================================================ FILE: capybara.md ================================================ --- title: Capybara category: Ruby libraries weight: -5 updated: 2020-06-13 tags: [Featurable] --- ### Navigating visit articles_path ### Clicking links and buttons ```ruby click_on 'Link Text' click_button click_link ``` ### Interacting with forms ```ruby attach_file 'Image', '/path/to/image.jpg' fill_in 'First Name', with: 'John' ``` ```ruby check 'A checkbox' uncheck 'A checkbox' ``` ```ruby choose 'A radio button' ``` ```ruby select 'Option', from: 'Select box' unselect ``` ### Limiting ```ruby within '.classname' do click '...' end ``` ```ruby within_fieldset :id do ... end ``` ## Querying ### Predicates ```ruby page.has_css?('.button') expect(page).to have_css('.button') page.should have_css('.button') ``` {: .-setup} | Positive | Negative | | --- | --- | | `has_content?` | `has_no_content?` | | --- | --- | | `has_css?` _(selector)_ | `has_no_css?` | | --- | --- | | `has_xpath?` _(path)_ | `has_no_xpath?` | | --- | --- | | `has_link?` _(selector)_ | `has_no_link?` | | --- | --- | | `has_button?` _(selector)_ | `has_no_button?` | | --- | --- | | `has_field?` _(selector)_ | `has_no_field?` | | --- | --- | | `has_checked_field?` _(selector)_ | `has_unchecked_field?` | | --- | --- | | `has_table?` _(selector)_ | `has_no_table?` | | --- | --- | | `has_select?` _(selector)_ | `has_no_select?` | {: .-headers.-left-align} In Rspec, these also map to matchers like `page.should have_content`. ### Selectors ```ruby expect(page).to have_button('Save') ``` ```ruby expect(page).to have_button('#submit') ``` ```ruby expect(page).to have_button('//[@id="submit"]') ``` The `selector` arguments can be text, CSS selector, or XPath expression. ### RSpec assertions ```ruby page.has_button?('Save') ``` ```ruby expect(page).to have_no_button('Save') ``` In RSpec, you can use `page.should` assertions. ### About negatives ```ruby expect(page).to have_no_button('Save') ``` ```ruby expect(page).not_to have_button('Save') ``` The two above statements are functionally equivalent. ## RSpec ### Matchers ```ruby expect(page).to \ ``` {: .-setup} ```ruby have_current_path(expected_path) have_selector '.blank-state' have_selector 'h1#hola', text: 'Welcome' have_button 'Save' have_checked_field '#field' have_unchecked_field have_css '.class' have_field '#field' have_table '#table' have_xpath '//div' ``` ```ruby have_link 'Logout', href: logout_path ``` ```ruby have_select 'Language', selected: 'German' options: ['Engish', 'German'] with_options: ['Engish', 'German'] # partial match ``` ```ruby have_text 'Hello', type: :visible # or :all # alias: have_content ``` ### Common options All matchers have these options: {: .-setup} ```ruby text: 'welcome' text: /Hello/ visible: true count: 4 between: 2..5 minimum: 2 maximum: 5 wait: 10 ``` ## Other features ### Finding ```ruby find(selector) find_button(selector) find_by_id(id) find_field(selector) find_link(selector) locate ``` ### Scoping ```ruby within '#delivery' do fill_in 'Street', with: 'Hello' end ``` ```ruby within :xpath, '//article' within_fieldset within_table within_frame scope_to ``` ```ruby find('#x').fill_in('Street', with: 'Hello') # same as within ``` ### Scripting ```ruby execute_script('$("input").trigger("change")') evaluate_script('window.ga') ``` Executes JavaScript. ### Debugging ```ruby save_and_open_page ``` Opens the webpage in your browser. ### Page ```ruby page .all('h3') .body .html .source .current_host .current_path .current_url ``` ### AJAX ```ruby using_wait_time 10 do ... end ``` ### Misc drag field_labeled ### Page object ```ruby page.status_code == 200 page.response_headers ``` See: ### Poltergeist ```ruby Capybara.register_driver :poltergeist do |app| Capybara::Poltergeist::Driver.new(app, :inspector => true) end Capybara.javascript_driver = :poltergeist ``` Use [poltergeist](https://github.com/teampoltergeist/poltergeist) to integrate PhantomJS. ### Blacklist ```ruby config.before :each, :js do page.driver.browser.url_blacklist = [ 'fonts.googleapis.com', 'use.typekit.net', 'f.vimeocdn.com', 'player.vimeo.com', 'www.googletagmanager.com' ].flat_map { |domain| [ "http://#{domain}", "https://#{domain}" ] } end ``` ### Debugging Enable `inspector: true` and then: {: .-setup} ```ruby page.driver.debug ``` To pause execution for a while: ```ruby page.driver.pause ``` ## Selenium ### Accepting confirm() and alert() ```ruby accept_alert { ... } dismiss_confirm { ... } accept_prompt(with: 'hi') { ... } ``` Alternatively: ```ruby page.driver.browser.switch_to.alert.accept ``` ### Updating session ```ruby page.set_rack_session(foo: 'bar') ``` ## See also {: .-one-column} - - ================================================ FILE: cask-index.md ================================================ --- title: Caskroom index tags: [Archived] archived: This sheet may have outdated information. --- #### A - [a-better-finder-attributes](http://www.publicspace.net/ABetterFinderAttributes/) - [a-better-finder-rename](http://www.publicspace.net/ABetterFinderRename/) - [a-slower-speed-of-light](http://gamelab.mit.edu/games/a-slower-speed-of-light/) - [abgx360](http://abgx360.net/) - [abscissa](http://rbruehl.macbay.de/Abscissa) - [accessmenubarapps](http://www.ortisoft.de/accessmenubarapps/) - [acorn](http://flyingmeat.com/acorn/) - [actions-server](http://getactionsapp.com) - [actiontastic](http://actiontastic.com) - [activity-audit](https://www.dssw.co.uk/activityaudit) - [actotracker](http://onflapp.wordpress.com/actotracker) - [actprinter](http://houdah.com/ACTPrinter/) - [actual-odbc-pack](http://www.actualtech.com/products.php) - [adapter](http://www.macroplant.com/adapter/) - [adium](https://www.adium.im/) - [adobe-air](https://get.adobe.com/air/) - [adobe-arh](http://help.adobe.com/en_US/air/redist/WS485a42d56cd19641-70d979a8124ef20a34b-8000.html) - [adobe-creative-cloud](https://creative.adobe.com/products/creative-cloud) - [adobe-digital-editions](http://www.adobe.com/pt/products/digital-editions.html) - [adobe-dng-converter](http://www.adobe.com/support/downloads/product.jsp?product=106&platform=Macintosh) - [adobe-photoshop-lightroom](http://www.adobe.com/products/photoshop-lightroom.html) - [adobe-reader](http://www.adobe.com/products/reader.html) - [adventure](http://www.lobotomo.com/products/Adventure/index.html) - [aegisub](http://www.aegisub.org/) - [aerofs](https://www.aerofs.com/) - [affinity-designer](https://affinity.serif.com/) - [air-connect](http://www.avatron.com/get-air-connect/) - [air-video-server-hd](http://www.inmethod.com/airvideohd) - [air-video-server](http://www.inmethod.com/air-video/) - [airdisplay](http://avatron.com/apps/air-display/) - [airfoil](http://www.rogueamoeba.com/airfoil/mac/) - [airmail-amt](http://airmailapp.com/amt/) - [airparrot](http://www.airsquirrels.com/airparrot/) - [airserver](http://www.airserver.com) - [airstream](http://airstream.io/download/) - [alarm-clock](http://wayback.archive.org/web/20130123192255/http://www.robbiehanson.com/alarmclock/index.html) - [alfred](http://www.alfredapp.com/) - [alib1](http://presstube.com/blog/2011/alib1/) - [alinof-timer](http://www.alinofsoftware.ch/en/products/products-timer/index.html) - [aliwangwang](http://wangwang.taobao.com) - [all-the-gifs](https://github.com/orta/GIFs) - [all2mp3](http://www.tresrrr.com/All2MP3/ENGLISH.html) - [amadeus-pro](http://www.hairersoft.com/pro.html) - [amazon-cloud-drive](https://www.amazon.com/clouddrive) - [amazon-music](https://www.amazon.com/gp/feature.html/ref=dm_mo_cpw_fb_lm?docId=1001067901) - [amethyst](http://ianyh.com/amethyst) - [ampps](http://www.ampps.com) - [android-file-transfer](http://www.android.com/filetransfer/) - [android-studio-bundle](http://developer.android.com/sdk/installing/studio.html) - [android-studio](https://developer.android.com/sdk/installing/studio.html) - [angry-ip-scanner](http://angryip.org) - [anki](http://ankisrs.net/) - [anonym](http://www.hanynet.com/anonym/index.html) - [antetype](http://antetype.com) - [antirsi](http://sabi.net/nriley/software/#antirsi) - [anvil](http://anvilformac.com/) - [anxiety](http://www.anxietyapp.com/) - [anypass](http://icyblaze.com/anypass) - [ap-grapher](https://www.macupdate.com/app/mac/11859/ap-grapher) - [apache-directory-studio](http://directory.apache.org/studio/) - [apikitchen](http://apikitchen.com/) - [apns-pusher](https://github.com/blommegard/APNS-Pusher) - [appcleaner](http://www.freemacsoft.net/appcleaner/) - [appcode](http://www.jetbrains.com/objc/) - [appdelete](http://www.reggieashworth.com/appdelete) - [appfresh](http://metaquark.de/appfresh/mac) - [appium](http://appium.io) - [appmenuboy](https://code.google.com/p/appmenuboy/) - [apptivate](http://www.apptivateapp.com) - [apptrap](http://onnati.net/apptrap) - [appzapper](http://www.appzapper.com/) - [aptanastudio](http://www.aptana.com/) - [aquamacs](http://aquamacs.org/) - [aquaterm](http://aquaterm.sourceforge.net/) - [araxis-merge](http://www.araxis.com/merge) - [archiver](http://archiverapp.com/) - [arduino-galileo](https://communities.intel.com/docs/DOC-22226) - [arduino](http://arduino.cc/) - [aria-maestosa](http://ariamaestosa.sourceforge.net) - [armitage](http://www.fastandeasyhacking.com/) - [armory](https://bitcoinarmory.com/) - [arora](https://code.google.com/p/arora/) - [arq](http://www.haystacksoftware.com/arq/) - [arranger](http://bucketomac.de/arranger/arranger/) - [arrsync](http://arrsync.sourceforge.net) - [aseprite](http://www.aseprite.org) - [asepsis](http://asepsis.binaryage.com/) - [asteroid](http://www.asteroidapp.com/) - [atext](http://www.trankynam.com/atext/) - [atlantis](http://www.riverdark.net/atlantis/) - [atmonitor](http://www.atpurpose.com/atMonitor/) - [atom](http://atom.io) - [atraci](https://github.com/Atraci/Atraci) - [au-lab](http://www.apple.com/itunes/mastered-for-itunes/) - [audacity](http://audacity.sourceforge.net/) - [audio-editor](http://www.macsome.com/audio-editor-mac/index.html) - [audio-hijack-pro](http://www.rogueamoeba.com/audiohijackpro/) - [audio-mate](http://audiomateapp.com/) - [audiobookbinder](http://bluezbox.com/audiobookbinder.html) - [audioscrobbler](https://github.com/mxcl/Audioscrobbler.app) - [audioslicer](http://audioslicer.sourceforge.net) - [aurora](http://www.oneperiodic.com/products/aurora/) - [authbuddy](https://www.dssw.co.uk/authbuddy) - [authoxy](http://www.hrsoftworks.net) - [authy-bluetooth](https://www.authy.com) - [autodmg](https://github.com/MagerValp/AutoDMG) - [automatic](http://codingcurious.com/automatic/) - [aviator](https://www.whitehatsec.com/aviator/) - [avidemux](http://www.avidemux.org/) - [avogadro](http://avogadro.openmolecules.net/) - [awareness](http://iamfutureproof.com/tools/awareness/) - [ax88179](http://www.asix.com.tw/products.php?op=pItemdetail&PItemID=131;71;112&PLine=71) - [ax88772](http://www.asix.com.tw/products.php?op=pItemdetail&PItemID=86;71;101&PLine=71) - [axure-rp-pro](http://www.axure.com/) #### B - [b2designer](http://www.flymaster-avionics.com/Support/Downloads/ForMacOSX/tabid/199/Default.aspx) - [back-in-time](http://www.tri-edre.fr/english/backintime.html) - [backblaze-downloader](http://www.backblaze.com/) - [backblaze](https://www.backblaze.com/) - [backtobed](http://backtobed.dadiugames.dk/) - [backuploupe](http://www.soma-zone.com/BackupLoupe/) - [bahamut](https://github.com/sdegutis/bahamut) - [baiducloud](http://pan.baidu.com) - [baiduinput](http://wuxian.baidu.com/input/mac.html) - [baidumusic](http://music.baidu.com/) - [balsamiq-mockups](http://balsamiq.com/) - [bankid](http://www.bankid.com/) - [banshee](http://banshee.fm) - [bar-magnet](http://qata.cc/Site/Bar_Magnet.html) - [baretorrent](http://baretorrent.org) - [bartender](http://www.macbartender.com/) - [base](http://menial.co.uk/base/) - [basecamp](http://www.garmin.com/en-US/shop/downloads/basecamp) - [basex](http://basex.org/home/) - [basictex](http://www.tug.org/mactex/morepackages.html) - [bassjump](http://www.twelvesouth.com/product/bassjump-2-for-macbook) - [bassshapes](http://yellquietly.com/bass-shapes/) - [bathyscaphe](http://bathyscaphe.sourceforge.jp/) - [battery-guardian](https://www.dssw.co.uk/batteryguardian) - [battery-report](https://www.dssw.co.uk/batteryreport) - [battery-time-remaining](http://yap.nu/battery-time-remaining/) - [baygenie](http://www.baygenie.com/) - [bbc-iplayer-downloads](http://www.bbc.co.uk/iplayer/install) - [bbedit](http://www.barebones.com/products/bbedit/) - [beacon-scanner](https://github.com/mlwelles/BeaconScanner/) - [beamer](http://beamer-app.com) - [bean](http://www.bean-osx.com) - [beardedspice](http://www.beardedspice.com) - [beatport-pro](http://pro.beatport.com/) - [bee](http://neat.io/bee/) - [bettertouchtool](http://blog.boastr.net/) - [betterzip](http://macitbetter.com) - [betterzipql](http://macitbetter.com/BetterZip-Quick-Look-Generator/) - [bibdesk](http://bibdesk.sourceforge.net/) - [big-mean-folder-machine](http://www.publicspace.net/BigMeanFolderMachine/) - [bill](http://billtheapp.com/) - [bino](http://bino3d.org) - [binreader](http://www.binreader.com/) - [bit-slicer](https://github.com/zorgiepoo/bit-slicer/) - [bitcasa](https://www.bitcasa.com) - [bitcoin-core](https://bitcoin.org/) - [bitlord](http://www.bitlord.com) - [bitmessage](https://bitmessage.org/) - [bittorrent-sync](http://www.bittorrent.com/sync) - [black-ink](http://www.red-sweater.com/blackink/) - [black-light](http://michelf.ca/projects/black-light) - [blender](http://www.blender.org/) - [blink1control](http://blink1.thingm.com/) - [blu-ray-player](http://www.macblurayplayer.com/) - [bluegriffon](http://bluegriffon.org) - [blueharvest](http://zeroonetwenty.com/blueharvest/) - [bluej](http://www.bluej.org) - [bob](https://github.com/casperstorm/Bob) - [bodega](http://appbodega.com/) - [bonjour-browser](http://www.tildesoft.com/) - [boom](http://www.globaldelight.com/boom/) - [boot2docker](https://github.com/boot2docker/osx-installer) - [bootchamp](http://www.kainjow.com/) - [bootxchanger](http://namedfork.net/bootxchanger) - [bowtie](http://bowtieapp.com/) - [box-sync](https://sites.box.com/sync4/) - [boxcryptor-classic](https://www.boxcryptor.com/en/boxcryptor-classic) - [boxer](http://boxerapp.com/) - [brackets](http://brackets.io) - [brain-workshop](http://brainworkshop.sourceforge.net/) - [breach](http://breach.cc) - [breakaway](http://mutablecode.com/apps/breakaway.html) - [brightness](http://www.bergdesign.com/brightness/) - [brogue](https://sites.google.com/site/broguegame/) - [broomstick](http://www.zibity.com/broomstick) - [brow](http://www.timschroeder.net/brow/) - [browserstacklocal](http://www.browserstack.com/) - [brushviewql](http://brushviewer.sourceforge.net/) - [brytonbridge](http://www.brytonsport.com/help/start) - [buddi](http://buddi.digitalcave.ca/index.jsp) - [burn](http://burn-osx.sourceforge.net/) - [butter](http://harukasan.jp) - [bzflag](http://bzflag.org/) #### C - [c3](http://www.downloadc3.com/) - [caffeine](http://lightheadsw.com/caffeine/) - [cakebrew](http://www.cakebrew.com) - [calcservice](http://www.devontechnologies.com/products/freeware.html#c1111) - [calibre](http://calibre-ebook.com/) - [calibre2opds](http://calibre2opds.com/) - [callnote](http://www.kandasoft.com/home/kanda-apps/skype-call-recorder.html) - [camed](http://sourceforge.net/apps/mediawiki/camprocessor/index.php?title=Main_Page) - [camerabag](http://nevercenter.com/camerabag/desktop/) - [camino](http://caminobrowser.org/) - [camranger](http://www.camranger.com/downloads/#fbox_5594) - [camtasia](http://www.techsmith.com/camtasia.html) - [camtwist](http://camtwiststudio.com/) - [candybar](http://www.panic.com/blog/candybar-mountain-lion-and-beyond) - [capo](http://supermegaultragroovy.com/products/Capo/) - [capsee](http://www.threemagination.com/capsee/) - [carbon-copy-cloner](http://bombich.com/) - [carlson-minot](http://www.carlson-minot.com) - [cartao-de-cidadao](http://www.cartaodecidadao.pt/) - [catch](http://www.giorgiocalderolla.com/index.html) - [catchmouse](http://ftnew.com/catchmouse.html) - [cathode](http://www.secretgeometry.com/apps/cathode) - [ccleaner](http://www.piriform.com/ccleaner) - [ccmenu](http://ccmenu.sourceforge.net/) - [cd-to](https://github.com/jbtule/cdto) - [cdock](http://sourceforge.net/projects/cdock) - [celestia](http://sourceforge.net/projects/celestia) - [cert-quicklook](https://code.google.com/p/cert-quicklook/) - [cfxr](http://thirdcog.eu/apps/cfxr) - [chainsaw](http://logging.apache.org/chainsaw/) - [chameleon-ssd-optimizer](http://chameleon.alessandroboschini.it/) - [changes-meter](http://intuiware.com/apps/changes-meter) - [changes](http://bitbq.com/changes/) - [charles](http://www.charlesproxy.com/) - [chatology](http://flexibits.com/chatology) - [cheatsheet](http://www.cheatsheetapp.com/CheatSheet/) - [cheetah3d](http://www.cheetah3d.com) - [chefdk](http://www.getchef.com/downloads/chef-dk/mac/) - [chemdoodle](http://www.chemdoodle.com) - [chicken](http://sourceforge.net/projects/chicken/) - [chirp](http://chirp.danplanet.com/) - [chocolat](http://chocolatapp.com/) - [choosy](http://www.choosyosx.com/) - [chromatic](https://mrgeckosmedia.com/applications/info/Chromatic) - [chrome-remote-desktop-host](https://chrome.google.com/remotedesktop) - [chromecast](http://www.google.ca/intl/en/chrome/devices/chromecast/) - [chromium](http://www.freesmug.org/chromium) - [chronicle](http://chronicleapp.com/) - [chronoagent](http://www.econtechnologies.com) - [chronomate](http://chronomateapp.com/) - [chronosync](http://www.econtechnologies.com) - [chunkulus](http://presstube.com/blog/2011/chunkulus/) - [cinch](http://www.irradiatedsoftware.com/cinch/) - [citrix-receiver](http://www.citrix.com/receiver) - [clamxav](http://www.clamxav.com/) - [clarify](http://www.clarify-it.com/) - [cleanmymac](http://macpaw.com/cleanmymac) - [clementine](http://www.clementine-player.org/) - [clion-eap](http://www.jetbrains.com/clion/) - [clipmenu](http://www.clipmenu.com/) - [clix](http://rixstep.com/4/0/clix/index.shtml) - [cloak](https://www.getcloak.com) - [clock](http://zachwaugh.me/clock/) - [clonk](http://www.clonk.de/cr.php) - [cloud](http://getcloudapp.com/) - [cloudera-hive-odbc](http://www.cloudera.com) - [cloudfoundry-cli](https://github.com/cloudfoundry/cli) - [cloudpull](http://www.goldenhillsoftware.com/) - [cloudup](https://cloudup.com/download) - [cloudytabs](https://github.com/josh-/CloudyTabs/) - [cn3d](http://www.ncbi.nlm.nih.gov/Structure/CN3D/cn3d.shtml) - [coccinellida](http://coccinellida.sourceforge.net/) - [cockatrice](http://www.woogerworks.com/) - [cocktail](http://maintain.se/cocktail) - [cocoadialog](http://mstratman.github.io/cocoadialog/) - [cocoapacketanalyzer](http://www.tastycocoabytes.com/cpa/) - [cocoarestclient](http://mmattozzi.github.io/cocoa-rest-client/) - [cocoaspell](http://cocoaspell.leuski.net/) - [cocoasplit](http://krylon.rsdio.com/zakk/cocoasplit/) - [coconutbattery](http://www.coconut-flavour.com/coconutbattery/) - [coda](https://panic.com/Coda/) - [codebox](https://www.codebox.io) - [codebug](http://www.codebugapp.com/) - [codekit](http://incident57.com/codekit/) - [codelite](http://codelite.org) - [cog](http://cogx.org) - [colloquy](http://colloquy.info/) - [color-oracle](http://colororacle.org/) - [color-picker-pro](https://github.com/oscardelben/Color-Picker-Pro) - [colorpicker-antetype](http://www.antetype.com/blog/2013/12/updated-antetype-os-x-color-picker-1-3-1/) - [colorpicker-developer](http://download.panic.com/picker/) - [colorpicker-hex](http://wafflesoftware.net/hexpicker/) - [colorpicker-propicker](http://www.irradiated.net/?page=pro-picker) - [colorpicker-rcwebcolorpicker](http://www.rubicode.com/Software/RCWebColorPicker) - [colorpicker-skalacolor](http://bjango.com/mac/skalacolor/) - [colorpicker](http://www.northernspysoftware.com/software/colorpicker) - [colors](http://mattpatenaude.com/) - [colorschemer-studio](http://www.colorschemer.com) - [comicbooklover](http://www.bitcartel.com/comicbooklover/) - [comicbookloversync](http://www.bitcartel.com/comicbooklover) - [comictagger](http://code.google.com/p/comictagger/) - [commandq](http://clickontyler.com/commandq/) - [concentrate](http://www.getconcentrating.com/) - [connected-desktop](http://www.filetransporter.com/) - [connector](http://mediaware.sk/connector) - [consul](http://www.consul.io/) - [contexts](http://contextsformac.com/) - [controllermate](http://www.orderedbytes.com/controllermate/) - [controlplane](http://www.controlplaneapp.com/) - [coolterm](http://freeware.the-meiers.org/) - [cooviewer](http://www.geocities.jp/coo_ona/viewer.html) - [copy](https://www.copy.com/) - [coqide](http://coq.inria.fr/) - [cord](http://cord.sourceforge.net/) - [cornerstone](http://www.zennaware.com/cornerstone/index.php) - [corsixth](http://th.corsix.org) - [coteditor](http://coteditor.github.io/) - [couchbase-server-community](http://www.couchbase.com/) - [couchbase-server-enterprise](http://www.couchbase.com/) - [craftstudio](http://craftstud.io) - [crashlytics](http://crashlytics.com) - [crashplan](http://www.crashplan.com/) - [crosspack-avr](http://www.obdev.at/products/crosspack/) - [crushftp](https://www.crushftp.com) - [crypt](http://voluntary.net/crypt/) - [cryptol](http://cryptol.net/) - [ctivo](https://github.com/dscottbuch/cTiVo) - [cuda-z](http://cuda-z.sourceforge.net) - [cuppa](http://www.nathanatos.com/software) - [cups-pdf](http://www.cups-pdf.de) - [cura](http://daid.github.com/Cura/) - [curb](http://mrrsoftware.com/curb) - [curse-client](http://www.curse.com/client) - [cursorcerer](http://doomlaser.com/cursorcerer-hide-your-cursor-at-will/) - [cutesdr](http://sourceforge.net/projects/cutesdr) - [cx](http://www.cx.com) - [cyberduck](http://cyberduck.io/) - [cycling74-max](http://cycling74.com) #### D - [daemon-tools-lite](http://www.daemon-tools.cc/products/dtMacLite) - [daisydisk](http://www.daisydiskapp.com) - [darktable](http://www.darktable.org/) - [darteditor](https://www.dartlang.org/tools/editor/) - [dash](http://kapeli.com/dash) - [dashlane](https://www.dashlane.com/) - [datagraph](http://www.visualdatatools.com/DataGraph/) - [dataurlmaker](https://github.com/sveinbjornt/Data-URL-Toolkit) - [day-o](http://www.shauninman.com/archive/2011/10/20/day_o_mac_menu_bar_clock) - [dbeaver](http://dbeaver.jkiss.org/) - [dealalert](http://dealalertapp.com/) - [deathtodsstore](http://www.aorensoftware.com/blog/2011/12/24/death-to-ds_store/) - [debookee](http://www.iwaxx.com/debookee/) - [debt-quencher](http://nothirst.com/debtquencher/) - [decitime](http://www.tinbert.com/DeciTimeMac/) - [deeper](http://www.titanium.free.fr/downloaddeeper.php) - [deeq](http://deeqapp.com) - [default-folder-x](http://www.stclairsoft.com/DefaultFolderX) - [delibar](http://www.delibarapp.com/) - [delicious-library](http://delicious-monster.com/) - [delivery-status](http://junecloud.com/software/mac/delivery-status.html) - [deltawalker](http://www.deltopia.com/compare-merge-sync/macosx/) - [deluge](http://deluge-torrent.org/) - [deskfun](http://www.furrysoft.de/?page=deskfun) - [desktop-log](http://www.nightproductions.net/desklog.html) - [desmume](http://www.desmume.org) - [detune](http://headlightsoft.com/detune/) - [devonthink-pro-office](http://www.devontechnologies.com/products/devonthink/devonthink-pro-office.html) - [devonthink-pro](http://www.devontechnologies.com/products/devonthink/devonthink-pro.html) - [dewdrop](http://dewdrop.dangelov.com/) - [dfontsplitter](http://peter.upfold.org.uk/projects/dfontsplitter) - [dia](http://dia-installer.de/) - [diashapes](http://dia-installer.de/) - [dictunifier](http://code.google.com/p/mac-dictionary-kit/) - [diffmerge](http://www.sourcegear.com/diffmerge) - [disk-drill](http://www.cleverfiles.com/) - [disk-inventory-x](http://www.derlien.com/) - [diskaid](http://www.digidna.net/diskaid) - [diskmaker-x](http://diskmakerx.com/) - [diskwave](http://diskwave.barthe.ph/) - [dispcalgui](http://dispcalgui.hoech.net) - [displaperture](http://manytricks.com/displaperture) - [displaylink](http://www.displaylink.com) - [diumoo](http://diumoo.net/) - [divvy](http://mizage.com/divvy/) - [djay](http://algoriddim.com/djay-mac) - [djv](http://djv.sourceforge.net) - [djview](http://djvu.sourceforge.net/) - [dmm](http://www.dmm.com/dc/book/) - [dnscrypt](http://opendns.github.io/dnscrypt-osx-client/) - [docear](http://docear.org) - [dockmod](http://spyresoft.com/dockmod/) - [dogecoin](http://dogecoin.com/) - [dolphin](http://www.dolphin-emu.org/) - [dosbox](http://www.dosbox.com) - [doubanradio](http://douban.fm) - [double-commander](http://doublecmd.sourceforge.net/) - [doublecommand](http://doublecommand.sourceforge.net) - [doubletwist](http://www.doubletwist.com/) - [doxie](http://www.getdoxie.com/) - [doxygen](http://www.stack.nl/~dimitri/doxygen/index.html) - [dradio](http://dradio.me) - [dragondisk](http://www.dragondisk.com/) - [dragthing](http://www.dragthing.com) - [drobo-dashboard](http://www.drobo.com) - [dropbox-encore](http://www.joyofmacs.com/software/dropboxencore/) - [dropbox](https://www.dropbox.com/) - [dropin](http://excitedatom.com/dropin/) - [dropletmanager](https://github.com/deivuh/DODropletManager-OSX) - [droplr](https://www.droplr.com/) - [dropzone](https://aptonic.com) - [dsp-radio](http://dl2sdr.homepage.t-online.de/) - [dterm](http://decimus.net/DTerm) - [dukto](https://code.google.com/p/dukto/) - [dump-truck](http://www.goldenfrog.com/dumptruck) - [dungeon-crawl-stone-soup-console](http://crawl.develz.org) - [dungeon-crawl-stone-soup-tiles](http://crawl.develz.org) - [dupeguru-me](http://www.hardcoded.net/dupeguru_me/) - [dupeguru-pe](http://www.hardcoded.net/dupeguru_pe/) - [dupeguru](http://www.hardcoded.net/dupeguru/) - [duplicate-annihilator](http://brattoo.com/propaganda/) - [duplicati](http://www.duplicati.com/) - [dupscanub](http://www5.wind.ne.jp/miko/mac_soft/dup_scan/index.html) - [dvdstyler](http://dvdstyler.org) - [dwarf-fortress](http://www.bay12games.com/dwarves/) #### E - [eagle](http://www.cadsoftusa.com/) - [eaglefiler](http://c-command.com/eaglefiler/) - [easyfind](http://www.devontechnologies.com/download/products.html) - [easysimbl](https://github.com/norio-nomura/EasySIMBL/) - [easyvpn](http://www.squashedsoftware.com/products-easyvpn.php) - [eclipse-ide](http://eclipse.org/) - [eclipse-java](http://eclipse.org/) - [eclipse-jee](http://eclipse.org/) - [eclipse-platform](http://eclipse.org) - [ecoute](http://pixiapps.com/ecouteosx/) - [eid-mw](https://code.google.com/p/eid-mw/) - [ejector](http://www.jeb.com.fr/en/ejector.shtml) - [electric-sheep](http://www.electricsheep.org) - [electrum-ltc](http://electrum-ltc.org) - [electrum](http://electrum.org/) - [elm-platform](http://www.elm-lang.org) - [eloquent](https://launchpad.net/eloquent) - [elyse](http://silkwoodsoftware.com/) - [emacs](http://emacsformacosx.com/) - [ember](http://realmacsoftware.com/ember) - [emin-webpquicklook](https://github.com/emin/WebPQuickLook) - [enfusegui](http://software.bergmark.com/enfusegui/Main.html) - [enjoyable](http://yukkurigames.com/enjoyable/) - [entropy](http://www.eigenlogik.com/entropy/) - [epic](http://www.epicbrowser.com) - [epub-to-pdf](https://code.google.com/p/epub-2-pdf) - [epubquicklook](http://people.ict.usc.edu/~leuski/programming/epub-quickview.php) - [escritorio-movistar](http://www.movistar.es/particulares/servicios/descargaaplicaciones) - [espionage](https://www.espionageapp.com/) - [espresso](http://macrabbit.com/espresso/) - [etrecheck](http://www.etresoft.com/etrecheck) - [evasi0n](http://evasi0n.com) - [eve](http://www.hotkey-eve.com/) - [evernote](https://evernote.com/) - [everweb](http://www.everwebapp.com/) - [evom](http://thelittleappfactory.com/evom/) - [exhaust](https://mrgeckosmedia.com/applications/info/Exhaust) - [exist-db](http://exist-db.org/) - [expandrive](http://www.expandrive.com/expandrive) - [eye-fi](http://support.eye.fi/downloads) - [eyetv](http://www.elgato.com/) #### F - [facebook-ios-sdk](https://developers.facebook.com/docs/ios) - [factor](http://factorcode.org/) - [fairmount](https://github.com/BoxOfSnoo/Fairmount) - [fake](http://fakeapp.com/) - [fakethunder](http://martianz.cn/fakethunder/) - [fantastical](http://flexibits.com/fantastical) - [fastest-free-youtube-downloader](https://www.fastestvideodownloader.com/) - [fastscripts](http://www.red-sweater.com/fastscripts/) - [faux-pas](http://fauxpasapp.com) - [fdt](http://fdt.powerflasher.com/) - [feedbinnotifier](http://kmikael.github.io/FeedbinNotifier) - [feeder](http://reinventedsoftware.com/feeder/) - [feeds](http://www.feedsapp.com/) - [fender-amp-drivers](https://fuse.fender.com/) - [fender-fuse](https://fuse.fender.com/) - [fenix](http://fenixwebserver.com/) - [fetch](http://fetchsoftworks.com/) - [ffmpegx](http://www.ffmpegx.com/download.html) - [figtree](http://tree.bio.ed.ac.uk/software/figtree/) - [fiji](http://fiji.sc) - [file-juicer](http://echoone.com/filejuicer/) - [filebot](http://www.filebot.net/) - [filedrop](http://www.filedropme.com/) - [fileshuttle](http://fileshuttle.io/) - [filezilla](https://filezilla-project.org/) - [find-any-file](http://apps.tempel.org/FindAnyFile/) - [findings](http://findingsapp.com) - [firefox](https://www.mozilla.org/en-US/firefox/) - [firewall-builder](http://www.fwbuilder.org) - [fission](http://rogueamoeba.com/fission/) - [fitbit-connect](http://www.fitbit.com/) - [fivedetails-flow](http://fivedetails.com) - [flame](http://husk.org/apps/flame/) - [flash-decompiler-trillix](http://www.flash-decompiler.com/mac.html) - [flash-player-debugger](https://www.adobe.com/support/flashplayer/downloads.html) - [flash-player](https://www.adobe.com/support/flashplayer/downloads.html) - [flash](https://www.adobe.com/products/flashplayer/distribution3.html) - [flavours](http://flavours.interacto.net/) - [flexiglass](http://nulana.com/flexiglass/) - [flickr-uploadr](http://www.flickr.com/tools/) - [flightgear](http://www.flightgear.org/) - [flip4mac](http://www.telestream.net/flip4mac/) - [fliqlo](http://fliqlo.com/) - [flow](http://www.getflow.com/) - [flowdock](https://www.flowdock.com/) - [fluid](http://fluidapp.com/) - [fluke](https://code.google.com/p/flukeformac/) - [flux](http://justgetflux.com) - [fm-fw-installer](http://www.flymaster-avionics.com/Support/Downloads/ForMacOSX/tabid/199/Default.aspx) - [focus](http://www.heyfocus.com/) - [focuswriter](http://gottcode.org/focuswriter/) - [folding-text](http://www.foldingtext.com) - [foldit](http://fold.it) - [folx](http://mac.eltima.com/de/download-manager.html) - [fontexplorer-x-pro](http://www.fontexplorerx.com/) - [fontprep](http://fontprep.com) - [forklift](http://www.binarynights.com/) - [fotomagico](http://www.boinx.com/fotomagico/) - [fotowall](http://www.enricoros.com/opensource/fotowall/) - [fourk-video-downloader](http://www.4kdownload.com/products/product-videodownloader) - [fourk-youtube-to-mp3](http://www.4kdownload.com/products/product-youtubetomp3) - [fourpeaks](http://nucleobytes.com/index.php/4peaks) - [foxmail](http://www.foxmail.com) - [fpc](http://www.freepascal.org/) - [framer-studio](http://framerjs.com/) - [free-ruler](http://www.pascal.com/software/freeruler/) - [freecad](http://sourceforge.net/projects/free-cad/) - [freecol](http://freecol.org) - [freedv](http://freedv.org/tiki-index.php) - [freefilesync](http://freefilesync.sourceforge.net/) - [freemind](freemind.sourceforge.net) - [freezer](https://mrgeckosmedia.com/applications/info/Freezer) - [fritzing](http://fritzing.org/) - [frizzix](http://mac.frizzix.de/) - [frostwire](http://www.frostwire.com) - [fs-uae](http://fs-uae.net/) - [fseventer](http://www.fernlightning.com/doku.php?id=software:fseventer:start) - [fugu](http://rsug.itd.umich.edu/software/fugu/) - [functionflip](http://kevingessner.com/software/functionflip/) - [fuze](https://www.fuzemeeting.com) #### G - [gambit-c](http://gambitscheme.org/wiki/index.php/Main_Page) - [gamesalad](http://gamesalad.com) - [ganttproject](http://www.ganttproject.biz) - [garagebuy](http://www.iwascoding.com/GarageBuy) - [garagesale](http://www.iwascoding.com/GarageSale/index.html) - [gargoyle](https://code.google.com/p/garglk/) - [garmin-ant-agent](http://www8.garmin.com/support/download_details.jsp?id=4417) - [garmin-communicator](http://www8.garmin.com/support/download_details.jsp?id=3739) - [garmin-express](http://www.garmin.com/express) - [garmin-training-center](http://www.garmin.com/garmin/cms/intosports/training_center) - [gas-mask](http://www.clockwise.ee/gasmask/) - [gawker](http://gawker.sourceforge.net/Gawker.html) - [gdal-framework](http://www.kyngchaos.com/software/frameworks) - [geekbench](http://www.primatelabs.com/geekbench/) - [geektool](http://projects.tynsoe.org/en/geektool/) - [genymotion](http://www.genymotion.com/) - [gephi](http://gephi.org/) - [geppetto](http://puppetlabs.github.io/geppetto/) - [gfxcardstatus](http://gfx.io/) - [ghc](http://ghcformacosx.github.io/) - [ghostlab](http://vanamco.com/ghostlab/) - [giffun](http://www.stone.com/GIFfun/) - [gifrocket](http://www.gifrocket.com/) - [gimp-lisanet](http://gimp.lisanet.de) - [gimp](http://www.gimp.org) - [gingr](http://harvest.readthedocs.org/en/latest/content/gingr.html) - [gisto](http://www.gistoapp.com/) - [git-annex](http://git-annex.branchable.com/) - [gitbook](https://www.gitbook.io/) - [gitbox](http://gitboxapp.com/) - [github](http://mac.github.com) - [gitifier](http://psionides.github.io/Gitifier/) - [gitter](https://gitter.im/) - [gitx-l](http://gitx.laullon.com/) - [gitx-rowanj](http://rowanj.github.io/gitx/) - [gitx](http://gitx.frim.nl/) - [gity](http://gityapp.com/) - [glcplayer](http://www.glc-player.net) - [glimmerblocker](http://glimmerblocker.org) - [glo](http://globible.com/gloformac/) - [globalsync](http://www.usglobalsat.com/) - [gmail-notifier](https://github.com/jashephe/Gmail-Notifier) - [gmail-notifr](http://ashchan.com/projects/gmail-notifr) - [gnucash](http://www.gnucash.org) - [go-agent](http://www.go.cd) - [go-server](http://www.go.cd/) - [goagentx](http://goagentx.com/) - [gog-downloader](http://www.gog.com/downloader) - [golly](http://golly.sourceforge.net/) - [google-adwords-editor](http://www.google.com/intl/en_US/adwordseditor/) - [google-chrome](https://www.google.com/chrome/) - [google-drive](https://drive.google.com/) - [google-earth-web-plugin](http://www.google.com/intl/en/earth/explore/products/plugin.html) - [google-earth](https://www.google.com/earth/) - [google-hangouts](https://www.google.com/tools/dlpage/hangoutplugin) - [google-japanese-ime](https://www.google.co.jp/ime/) - [google-nik-collection](https://www.google.com/nikcollection/) - [google-notifier](http://toolbar.google.com/gmail-helper/notifier_mac.html) - [google-plus-auto-backup](http://picasa.google.com/) - [google-refine](http://openrefine.org/) - [google-web-designer](https://www.google.com/webdesigner/) - [googleappenginelauncher](https://developers.google.com/appengine/) - [gopanda](http://pandanet-igs.com/communities/gopanda2) - [gpgtools](https://gpgtools.org/index.html) - [gpower](http://www.gpower.hhu.de/) - [gqrx](http://gqrx.dk/) - [grabbox](http://grabbox.devsoft.no/) - [grafx2](http://pulkomandy.tk/projects/GrafX2) - [grandperspective](http://grandperspectiv.sourceforge.net/) - [grandtotal](http://www.mediaatelier.com/GrandTotal3/) - [graphsketcher](https://github.com/graphsketcher/GraphSketcher) - [graphviz](http://www.graphviz.org/) - [gravit](http://gravit.io/) - [gridwars](http://gridwars.marune.de/) - [grooveshark](http://www.grooveshark.com) - [groovesquid](http://groovesquid.com/) - [growl-fork](https://www.macupdate.com/app/mac/41038/growl-fork) - [growler](http://wafflesoftware.net/growlergn/) - [growlnotify](http://growl.info/downloads) - [growlvoice](http://www.growlvoice.com/) - [guitar-tuner](http://www.gieson.com/Library/projects/utilities/tuner/) - [gulp](https://github.com/sindresorhus/gulp-app) - [gurps-character-sheet](http://gurpscharactersheet.com) - [gyazo](https://gyazo.com/) #### H - [hall](https://hall.com/download-hall/hall-for-mac) - [handbrake](http://handbrake.fr/) - [handbrakebatch](http://www.osomac.com/apps/osx/handbrake-batch/) - [handbrakecli](http://handbrake.fr) - [hands-off](http://www.metakine.com/products/handsoff/) - [happygrep](https://github.com/happypeter/happygrep) - [haroopad](http://pad.haroopress.com/) - [harvest](http://www.getharvest.com/mac) - [hashcat](https://hashcat.net/hashcat/) - [haskell-platform](http://www.haskell.org/platform/) - [hazel](http://www.noodlesoft.com/hazel.php) - [hbuilder](http://dcloud.io/) - [hear](http://www.prosofteng.com/products/hear.php) - [heart](http://presstube.com/blog/2011/heart/) - [hedgewars](http://hedgewars.org) - [hermes](http://hermesapp.org/) - [heroku-toolbelt](https://toolbelt.heroku.com/) - [hex-fiend](http://ridiculousfish.com/hexfiend/) - [hex](http://hextcg.com/) - [hexchat](http://hexchat.github.io) - [hexels](http://hexraystudios.com/hexels/) - [hipchat](https://www.hipchat.com/) - [hippoconnect](http://hipporemote.com/) - [hiss](http://collect3.com.au/hiss/) - [historyhound](http://www.stclairsoft.com/HistoryHound/) - [hive](http://www.hivewallet.com) - [hockeyapp](http://hockeyapp.net/releases/mac/) - [homestream](http://www.sony.co.uk/hub/1237485339460) - [honer](https://github.com/puffnfresh/Honer.app) - [hopper-disassembler](http://www.hopperapp.com/) - [hoppergdbserver](http://www.hopperapp.com/HopperGDBServer/index.html) - [horndis](http://joshuawise.com/horndis) - [hostbuddy](http://clickontyler.com) - [hoster](http://www.redwinder.com/macapp/hoster/) - [hosts](http://permanentmarkers.nl/software.html) - [houdahgeo](http://houdah.com/houdahGeo/) - [houdahspot](http://www.houdah.com/houdahSpot/) - [hpuload](http://www.fernlightning.com/doku.php?id=software:hpuload:start) - [hr](http://www.hrmacapp.com/) - [hsang](http://lushi.163.com/) - [httpscoop](http://www.tuffcode.com) - [hubic](https://hubic.com) - [hugin](http://hugin.sourceforge.net/) - [hush](http://coffitivity.com/hush/) - [hype](http://tumult.com/hype/) - [hyperdock](http://hyperdock.bahoom.com/) - [hyperswitch](http://bahoom.com/hyperswitch) - [hyro](http://jawerty.github.io/Hyro/) #### I - [iannix](http://www.iannix.org/) - [ibabel](http://www.macinchem.org/ibabel/ibabel3.php) - [ibackup](http://www.grapefruit.ch/iBackup) - [ibank](http://www.iggsoftware.com/ibank) - [ibettercharge](http://softorino.com/ibettercharge/) - [iboostup](http://www.iboostup.com) - [ibrowse](http://www.ibrowseapp.com/) - [icefloor](http://www.hanynet.com/icefloor/) - [ichm](https://code.google.com/p/ichm/) - [icolors](http://www.fadingred.com/icolors/) - [icompta](http://www.icompta-app.com/) - [iconping](http://antirez.com/iconping/) - [icursor](https://www.macupdate.com/app/mac/17059/icursor) - [id3-editor](http://www.pa-software.com/id3editor/) - [identify](http://identify2.arrmihardies.com/) - [ideskcal](http://www.hashbangind.com) - [idocument-plus](http://www.icyblaze.com/idocument/) - [idris](http://www.idris-lang.org) - [iexplorer](http://www.macroplant.com/) - [ifilex](http://www.osxbytes.com/page3/index.html) - [ifunbox](http://www.i-funbox.com/) - [igetter](http://www.igetter.net/) - [iloc](http://derailer.org/iloc) - [imagealpha](http://pngmini.com/) - [imagemin](https://github.com/kevva/imagemin-app) - [imageoptim](http://imageoptim.com/) - [img2icns](http://www.img2icnsapp.com/) - [imitone](http://imitone.com/) - [inboard](http://inboardapp.com/beta) - [inc](https://sendtoinc.com/apps/) - [indigo](http://www.perceptiveautomation.com/indigo/index.html) - [induction](http://inductionapp.com/) - [infinit](https://infinit.io/) - [inform](http://inform7.com/) - [injection](http://injectionforxcode.com/) - [inkscape](http://inkscape.org) - [inky](http://inky.com) - [insertpic](http://www.getinsertpic.com/) - [instabridge](http://instabridge.com/) - [instacast](http://vemedio.com/products/instacast-mac) - [instead](http://instead.syscall.ru/) - [insync](https://insynchq.com/) - [integrity](http://peacockmedia.co.uk/integrity/) - [intel-haxm](https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager) - [intel-power-gadget](https://software.intel.com/en-us/articles/intel-power-gadget-20) - [intel-xdk](http://xdk-software.intel.com/) - [intellij-idea-ce](https://www.jetbrains.com/idea/index.html) - [intellij-idea](https://www.jetbrains.com/idea/index.html) - [intermission](http://rogueamoeba.com/intermission/) - [invisiblix](http://www.read-write.fr/invisiblix/) - [invisionsync](http://invisionapp.com/) - [invisorql](http://www.pozdeev.com/invisor/) - [iograph](http://iographica.com/) - [ionu](https://ionu.com) - [ioquake3](http://ioquake3.org/) - [ios7-screensaver](http://bodysoulspirit.weebly.com/ios-7-screensaver-for-mac-os-x-by-bodysoulspirit.html) - [ipalette](http://ipalette.info/) - [ipaql](http://ipaql.com/) - [iphone-configuration-utility](http://support.apple.com/kb/DL1465) - [iphoney](https://www.marketcircle.com/iphoney) - [ireadfast](http://www.gengis.net/prodotti/iReadFast_Mac/en/index.php) - [irip](http://thelittleappfactory.com/irip/) - [isabelle](http://www.cl.cam.ac.uk/research/hvg/Isabelle/) - [isolator](http://willmore.eu/software/isolator) - [istat-menus](http://bjango.com/mac/istatmenus/) - [istat-server](http://bjango.com/mac/istatserver/) - [isteg](http://www.hanynet.com/isteg/) - [istopmotion](http://www.boinx.com/istopmotion/mac/) - [istumbler](http://istumbler.net/) - [iswiff](http://echoone.com/iswiff/) - [iterm2](http://www.iterm2.com/) - [itools](http://www.itools.cn/download.php?v=mac_en) - [itsycal](http://www.mowglii.com/itsycal/) - [itunes-volume-control](https://github.com/alberti42/iTunes-Volume-Control) - [itunesscrobbler](http://www.easyclasspage.de/lastfm/seite-19.html) - [itweax](http://www.itweax.net/) - [iupx](http://iupx.sourceforge.net) - [ivolume](http://www.mani.de/en/ivolume/) - [izip](http://www.izip.com) #### J - [jabber-video](https://www.ciscojabbervideo.com/) - [jabref](http://jabref.sourceforge.net/) - [jaikoz](http://jthink.net/jaikoz) - [jameica](http://www.willuhn.de/products/jameica/) - [jaspersoft-studio](http://community.jaspersoft.com/project/jaspersoft-studio) - [java](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) - [javafx-scene-builder](http://www.oracle.com/technetwork/java/javase/downloads/javafxscenebuilder-info-2157684.html) - [jawbone-updater](http://jawbone.com/) - [jbidwatcher](http://www.jbidwatcher.com) - [jd-gui](http://jd.benow.ca/) - [jdiskreport](http://www.jgoodies.com/freeware/jdiskreport/) - [jdownloader](http://jdownloader.org/) - [jedit](http://www.jedit.org) - [jenkins-menu](http://qvacua.com) - [jetphoto-studio](http://www.jetphotosoft.com/web/home/) - [jewelrybox](http://jewelrybox.unfiniti.com/) - [jiggler](http://www.sticksoftware.com/software/Jiggler.html) - [jing](http://www.techsmith.com/jing.html) - [jitouch](http://www.jitouch.com) - [jitsi](https://jitsi.org/) - [joinme](https://join.me/) - [josm](http://josm.openstreetmap.de) - [jsonlook](https://github.com/rjregenold/jsonlook) - [jubler](http://www.jubler.org/) - [julia](http://julialang.org/) - [juliastudio](http://forio.com/labs/julia-studio/) - [jumpcut](http://jumpcut.sourceforge.net/) - [jumpshare](https://jumpshare.com/) - [justlooking](http://chipmunkninja.com/JustLooking) - [jxplorer](http://jxplorer.org) #### K - [kaleidoscope](http://www.kaleidoscopeapp.com/) - [kamakiri](https://mochidev.com/apps/kamakiri) - [karabiner](https://pqrs.org/osx/karabiner/) - [katana](http://katana.witiz.com/) - [kdiff3](http://kdiff3.sourceforge.net/) - [keepassx](http://www.keepassx.org) - [keka](http://kekaosx.com/) - [kensington-trackball-works](http://www.kensington.com/) - [kext-drop](http://www.groths.org/software/kextdrop/) - [kext-utility](http://cvad-mac.narod.ru/index/0-4) - [kext-wizard](http://www.insanelymac.com/forum/topic/253395-kext-wizard-easy-to-use-kext-installer-and-more/) - [key-codes](http://manytricks.com/keycodes/) - [keyboard-cleaner](http://jan.prima.de/~jan/plok/archives/48-Keyboard-Cleaner.html) - [keyboard-maestro](http://www.keyboardmaestro.com/) - [keyboardcleantool](http://bettertouchtool.net) - [keycastr](https://github.com/sdeken/keycastr) - [keycue](http://www.ergonis.com/products/keycue/) - [keyfinder](http://www.ibrahimshaath.co.uk/keyfinder/) - [keymo](http://manytricks.com/keymo) - [keystore-explorer](http://keystore-explorer.sourceforge.net/index.php) - [kid3](http://kid3.sourceforge.net/) - [kindle-previewer](http://www.amazon.com/gp/feature.html/?docId=1000765261) - [kindle](http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000464931) - [kindlegen](http://www.amazon.com/gp/feature.html?docId=1000765211) - [kismac](http://kismac-ng.org/) - [kitematic](https://kitematic.com/) - [kivy](http://kivy.org) - [kiwi](http://kiwi-app.net/) - [kkbox](http://www.kkbox.com/) - [klayout](http://www.klayout.de/index.html) - [knock](http://knocktounlock.com) - [knox](https://agilebits.com/knox) - [kobito](http://kobito.qiita.com/) - [kobo](http://www.kobo.com/) - [kod](https://github.com/rsms/kod/) - [komanda](https://github.com/mephux/komanda) - [komodo-edit](http://komodoide.com/komodo-edit) - [komodo-ide](http://komodoide.com/) - [kompozer](http://www.kompozer.net/) - [ksdiff](http://www.kaleidoscopeapp.com/ksdiff2) - [kuaipan](http://www.kuaipan.cn/d/mac) - [kugoumusic](http://www.kugou.com) - [kvirc](http://www.kvirc.net) - [kylo](http://kylo.tv) #### L - [lastfm](http://www.lastfm.com) - [lastpass-universal](https://lastpass.com/) - [latexian](http://tacosw.com/latexian/) - [latexit](http://www.chachatelier.fr/latexit) - [launchbar](http://www.obdev.at/products/launchbar/) - [launchcontrol](http://www.soma-zone.com/LaunchControl/) - [launchrocket](https://github.com/jimbojsb/launchrocket) - [launchy](http://www.launchy.net) - [layervault](http://layervault.com/) - [lazarus](http://lazarus.freepascal.org/) - [league-of-legends](http://signup.leagueoflegends.com/) - [leap-motion](https://www.leapmotion.com/setup) - [less](http://incident57.com/less/) - [levelator](http://www.conversationsnetwork.org/levelator/) - [librecad](http://librecad.org/) - [libreoffice](https://www.libreoffice.org/) - [licecap](http://www.cockos.com/licecap/) - [licensed](http://amarsagoo.info/licensed) - [lightpaper](http://clockworkengine.com/lightpaper-mac/) - [lighttable](http://www.lighttable.com/) - [lilypond](http://lilypond.org) - [limechat](http://limechat.net/mac/) - [lincastor](http://onflapp.wordpress.com/lincastor/) - [linein](http://www.rogueamoeba.com/freebies/) - [lingon-x](http://www.peterborgapps.com/lingon/) - [lingrradar](http://radar.lingr.com/) - [linkinus](http://conceited.net/products/linkinus) - [linkliar](https://github.com/halo/LinkLiar) - [linphone](http://www.linphone.org/) - [liquifile](http://www.liquifile.info/) - [litecoin](https://litecoin.org/) - [liteicon](http://www.freemacsoft.net/liteicon/) - [liteide](https://github.com/visualfc/liteide) - [little-snitch](http://www.obdev.at/products/littlesnitch/index.html) - [littleipsum](http://littleipsum.com) - [livereload](http://www.livereload.com) - [livestation](http://www.livestation.com) - [loadmytracks](http://www.cluetrust.com/loadmytracks.html) - [locko](http://www.binarynights.com/) - [logic](http://www.saleae.com/) - [logisim](http://ozark.hendrix.edu/~burch/logisim/) - [logitech-control-center](http://www.logitech.com) - [logitech-gaming-software](http://www.logitech.com/en-us/support/gaming-software?section=downloads&bit=&osid=36) - [logitech-harmony](http://www.logitech.com/en-us/support/universal-remotes) - [logitech-myharmony](https://setup.myharmony.com/) - [logitech-unifying](http://www.logitech.com/en-us/promotions/6072) - [logmein-client](https://secure.logmein.com/products/pro/learnmore/desktopapp.aspx) - [logmein-hamachi](http://vpn.net) - [logoist](http://www.syniumsoftware.com/logoist/) - [loom](http://loom.com/) - [love](http://love2d.org) - [lpk25-editor](http://www.akaipro.com/index.php/product/lpk25) - [ltspice](http://www.linear.com/designtools/software/) - [lucidor](http://lucidor.org) - [luminance-hdr](http://qtpfsgui.sourceforge.net/) - [lyn](http://www.lynapp.com/) - [lynxlet](http://habilis.net/lynxlet/) - [lyrics-master](http://www.kenichimaehashi.com/lyricsmaster/) - [lyx](http://www.lyx.org) #### M - [mac-informer](http://macdownload.informer.com/landing/) - [mac-linux-usb-loader](http://sevenbits.github.io/Mac-Linux-USB-Loader/) - [macaw](http://macaw.co/) - [macbreakz](http://www.publicspace.net/MacBreakZ/) - [macdown](http://macdown.uranusjr.com/) - [macdrops](http://interfacelift.com/apps/macdrops/v1) - [macfusion](http://macfusionapp.org/) - [macgdbp](https://www.bluestatic.org/software/macgdbp/) - [machacha](http://www.julifos.com/soft/machacha/index.html) - [machg](http://jasonfharris.com/machg/) - [macintosh-explorer](http://www.ragesw.com/products/explorer.html) - [macmoney](http://www.devon.riceball.net/display.php?file=m01) - [macpar-deluxe](http://gp.home.xs4all.nl/Site/MacPAR_deLuxe.html) - [macpass](http://mstarke.github.io/MacPass/) - [macpaw-gemini](http://macpaw.com/gemini) - [macpilot](http://www.koingosw.com/products/macpilot.php) - [macports](http://www.macports.org) - [macs-fan-control](http://www.crystalidea.com/macs-fan-control) - [macterm](http://www.macterm.net/) - [mactex](http://www.tug.org/mactex/) - [mactracker](http://mactracker.ca/) - [mactubes](http://macapps.sakura.ne.jp/mactubes/index_en.html) - [macupdate-desktop](https://www.macupdate.com/desktop) - [macvim](http://code.google.com/p/macvim/) - [macwinzipper](http://tidajapan.com/macwinzipper) - [maczip4win](http://ynomura.com/home/?page_id=116) - [madruby](http://www.wingsforpigs.com/MadRuby/MadRuby.html) - [magic-launch](http://www.oneperiodic.com/products/magiclaunch/) - [magican](http://www.magicansoft.com/) - [mail-plugin-manager](http://www.chungwasoft.com/mailpluginmanager/) - [mailbox](http://www.mailboxapp.com/) - [mailfollowup](http://www.cs.unc.edu/~welch/MailFollowup/) - [mailmate](http://freron.com/) - [mailplane](http://mailplaneapp.com) - [majic](http://erikhinterbichler.com/apps/majic/) - [makehuman](http://www.makehuman.org/) - [makemkv](http://www.makemkv.com/) - [makerware](http://www.makerbot.com/makerware/) - [mame](http://mameosx.sourceforge.net/) - [mamp](http://www.mamp.info/en/index.html) - [manager](http://manager.io) - [manico](http://manico.im/) - [mapture](http://anatoo.jp/mapture/) - [maratis](http://www.maratis3d.org/) - [marble](http://www.marble.kde.org) - [marked](http://marked2app.com) - [marsedit](http://www.red-sweater.com/marsedit/) - [master-key](http://macinmind.com/?area=app&app=masterkey&pg=info) - [matplotlib](http://www.kyngchaos.com/software/python) - [mauve](http://gel.ahabs.wisc.edu/mauve/) - [mavensmate](http://mavensmate.com) - [max](http://sbooth.org/Max/) - [maxthon](http://www.maxthon.com/) - [mcedit](http://www.mcedit.net) - [mcs783x](http://www.asix.com.tw/products.php?op=ProductList&PLine=74&PSeries=109) - [mdrp](http://www.macdvdripperpro.com/) - [media-converter](http://media-converter.sourceforge.net/) - [mediaelch](http://www.mediaelch.de/) - [mediafire-desktop](https://www.mediafire.com/software/desktop/) - [mediainfo](http://mediaarea.net/en/MediaInfo) - [mediathekview](http://sourceforge.net/projects/zdfmediathk/) - [meerkat](http://codesorcery.net/meerkat) - [memorytamer](http://www.memorytamer.com/) - [mendeley-desktop](http://www.mendeley.com/) - [menubar-countdown](http://capablehands.net/menubarcountdown) - [menubarfilter](http://wez.github.com/MenuBarFilter/) - [menucalendarclock-ical](http://www.objectpark.net/en/mcc.html) - [menumeters](http://www.ragingmenace.com/software/menumeters/) - [menuola](http://www.geocom.co.nz) - [meocloud](https://meocloud.pt) - [mercurymover](http://www.heliumfoot.com/mercurymover) - [mesasqlite](http://www.desertsandsoftware.com) - [meshlab](http://meshlab.sourceforge.net/) - [metanota](http://www.metanota.com/) - [meteorologist](http://heat-meteo.sourceforge.net/) - [mi](http://www.mimikaki.net/) - [microsoft-intellipoint](http://www.microsoft.com/hardware/en-us/mice) - [microsoft-intellitype](http://www.microsoft.com/hardware/en-us/keyboards) - [microsoft-lync-plugin](http://office.microsoft.com/Lync) - [middleclick](http://clement.beffa.org/labs/projects/middleclick) - [midikeys](http://www.manyetas.com/creed/midikeys.html) - [miditrail](http://en.sourceforge.jp/projects/miditrail/) - [mikogo](http://www.mikogo.com/) - [milkytracker](http://www.milkytracker.org/) - [minbox](https://minbox.com) - [minco](http://www.celmaro.com/minco/) - [mindnode-pro](https://mindnode.com/) - [minecraft](http://minecraft.net) - [mini-metro](http://dinopoloclub.com/minimetro/) - [minilyrics](http://www.crintsoft.com/) - [minimalclock](http://ilovecolorz.net/minimalclock/) - [minitimer](http://kevingessner.com/software/minitimer/) - [minitube](http://flavio.tordini.org/minitube) - [miro-video-converter](http://www.mirovideoconverter.com/) - [miro](http://www.getmiro.com/) - [mirrordisplays](http://www.fabiancanas.com/Projects/MirrorDisplays) - [mixlr](http://mixlr.com) - [mixture](http://mixture.io/) - [mixxx](http://www.mixxx.org) - [mjolnir](http://mjolnir.io) - [mkvtoolnix](http://www.bunkus.org/videotools/mkvtoolnix/) - [mnemosyne](http://mnemosyne-proj.org/) - [mocksmtp](http://mocksmtpapp.com/) - [money](http://www.jumsoft.com/money/) - [moneyguru](http://www.hardcoded.net/moneyguru/) - [moneymoney](http://moneymoney-app.com/) - [moneyplex](http://www.matrica.de/) - [moneywell](http://nothirst.com/moneywell/) - [mongodb](http://mongodbx-app.orelord.com/) - [mongodbpreferencepane](https://github.com/remysaissy/mongodb-macosx-prefspane) - [mongohub](https://github.com/fotonauts/MongoHub-Mac) - [mono-mdk](http://mono-project.com/) - [mono-mre](http://mono-project.com) - [monochrome](http://lucianmarin.com/monochrome/) - [monolingual](http://monolingual.sourceforge.net/) - [monotype-skyfonts](http://www.fonts.com/web-fonts/google) - [moom](http://manytricks.com/moom/) - [moreamp](http://sourceforge.net/projects/moreamp/) - [mosh](http://mosh.mit.edu/) - [mou](http://mouapp.com/) - [mountain](http://appgineers.de/mountain/) - [mover](http://www.themaninhat.com/mover.html) - [movieply](http://www.movieply.com/) - [movist](https://github.com/samiamwork/Movist) - [mozart](http://www.mozart-oz.org) - [mp4tools](http://www.emmgunn.com/mp4tools/mp4toolshome.html) - [mpeg-streamclip](http://www.squared5.com/) - [mpfreaker](http://www.lairware.com/mpfreaker/) - [mplayer-osx-extended](http://www.mplayerosx.ch/) - [mplayerx](http://mplayerx.org/) - [mpv](http://mpv.io/) - [mucommander](http://www.mucommander.com/index.php) - [mudlet](http://www.mudlet.org) - [multibit](https://multibit.org/) - [multibrowser](https://sites.google.com/site/tesseractsoftware/multibrowser) - [multidoge](http://multidoge.org/) - [multifirefox](http://davemartorana.com/multifirefox) - [mumble](http://mumble.sourceforge.net) - [murasaki](http://genjiapp.com/mac/murasaki/index_en.html) - [musescore](http://musescore.org/) - [music-manager](https://play.google.com/music/) - [musicbrainz-picard](http://musicbrainz.org/doc/MusicBrainz_Picard) - [musicplayer](http://ufd.dk/musicplayer) - [musictube](http://flavio.tordini.org/musictube) - [musique](http://flavio.tordini.org/musique) - [myphonedesktop](http://www.myphonedesktop.com/) - [mysqlworkbench](http://www.mysql.com/products/workbench) #### N - [nally](http://yllan.org/app/Nally/) - [name-mangler](http://manytricks.com/namemangler/) - [namebench](https://code.google.com/p/namebench/) - [namechanger](http://www.mrrsoftware.com/MRRSoftware/NameChanger.html) - [namely](http://amarsagoo.info/namely) - [narrative-uploader](http://getnarrative.com) - [navicat-data-modeler](http://www.navicat.com/products/navicat-data-modeler) - [navicat-for-mariadb](http://www.navicat.com/products/navicat-for-mariadb) - [navicat-for-mysql](http://www.navicat.com/products/navicat-for-mysql) - [navicat-for-oracle](http://www.navicat.com/products/navicat-for-oracle) - [navicat-for-postgresql](http://www.navicat.com/products/navicat-for-postgresql) - [navicat-for-sql-server](http://www.navicat.com/products/navicat-for-sqlserver) - [navicat-for-sqlite](http://www.navicat.com/products/navicat-for-sqlite) - [navicat-premium](http://www.navicat.com/products/navicat-premium) - [neofinder](http://www.cdfinder.de) - [netbeans-cpp](https://netbeans.org/) - [netbeans-php](https://netbeans.org/) - [netbeans](https://netbeans.org/) - [nethackcocoa](https://code.google.com/p/nethack-cocoa/) - [netlogo](http://ccl.northwestern.edu/netlogo/) - [netnewswire](http://netnewswireapp.com/) - [netshade](http://raynersoftware.com/netshade/) - [netspot](http://www.netspotapp.com) - [neu](http://www.elegantchaos.com/neu/) - [ngrok](https://ngrok.com/) - [nicecast](http://rogueamoeba.com/nicecast) - [nide](http://coreh.github.io/nide/) - [nightingale](http://getnightingale.com/) - [nike-plus-connect](http://nikeplus.nike.com) - [nimbus](https://github.com/jnordberg/irccloudapp) - [ninjablocks](http://forums.ninjablocks.com/index.php?p=/discussion/1655/ninja-osx-client/p1) - [nitroshare](https://quickmediasolutions.com/apps/14/nitroshare) - [nitrous-desktop](https://www.nitrous.io/mac) - [nmap](http://nmap.org/) - [no-ip-duc](http://www.noip.com/download?page=mac) - [nocturne](http://code.google.com/p/blacktree-nocturne/) - [node-webkit](https://github.com/rogerwang/node-webkit) - [node](http://nodejs.org) - [nodebox](http://nodebox.net/node/) - [nodeclipse](http://www.nodeclipse.org/) - [noejectdelay](https://pqrs.org/macosx/keyremap4macbook/noejectdelay.html.en) - [noisy](https://github.com/jonshea/Noisy) - [noiz2sa](http://workram.com/games/noiz2sa/) - [nomachine](http://www.nomachine.com) - [nomacs](http://www.nomacs.org/) - [noobproof](http://www.hanynet.com/noobproof/index.html) - [nosleep](https://code.google.com/p/macosx-nosleep-extension/) - [notational-velocity](http://notational.net) - [nothing-to-hide](https://back.nothingtohide.cc/) - [notifyr](http://getnotifyr.com) - [nottingham](https://clickontyler.com/nottingham/) - [ntfs-free](http://sourceforge.net/projects/ntfsfree/) - [nutstore](https://jianguoyun.com) - [nvalt](http://brettterpstra.com/project/nvalt/) - [nzbvortex](http://www.nzbvortex.com/) #### O - [objektiv](http://nthloop.github.io/Objektiv/) - [obs](http://obsproject.com/) - [obsidian-menu-bar-mountain-lion](http://www.obsidianmenubar.com) - [ocenaudio](http://www.ocenaudio.com.br/en) - [oclint](http://oclint.org) - [octave](https://gnu.org/software/octave/) - [odesk](https://www.odesk.com/) - [omnidazzle](http://www.omnigroup.com/more) - [omnidisksweeper](http://www.omnigroup.com/products/omnidisksweeper/) - [omnifocus](http://www.omnigroup.com/products/omnifocus/) - [omnigraffle](http://www.omnigroup.com/products/omnigraffle) - [omnioutliner](http://www.omnigroup.com/omnioutliner/) - [omniplan](http://www.omnigroup.com/products/omniplan/) - [omnipresence](http://www.omnigroup.com/omnipresence) - [omniweb](http://www.omnigroup.com/products/omniweb/) - [onepassword](https://agilebits.com/onepassword) - [oneswarm](http://www.oneswarm.org/) - [onionshare](https://onionshare.org/) - [onlive-client](http://games.onlive.com) - [onyx](http://www.titanium.free.fr/downloadonyx.php) - [oovoo](http://www.oovoo.com) - [openarena](http://openarena.ws) - [opendns-updater](https://support.opendns.com/entries/23218654-Where-do-I-download-an-OpenDNS-Dynamic-IP-updater-client-) - [openemu](http://openemu.org/) - [openlp](http://openlp.org) - [opennx](http://opennx.net/) - [openoffice](http://www.openoffice.org/) - [openra](http://www.openra.net/) - [openscad](http://www.openscad.org/) - [opensesame](http://osdoc.cogsci.nl/) - [opensong](http://www.opensong.org/) - [openttd](http://openttd.org) - [openvanilla](http://openvanilla.org/) - [opera-mail](http://www.opera.com/computer/mail) - [opera-mobile-emulator](http://www.opera.com/developer/mobile-emulator) - [opera-next](http://www.opera.com/computer/next) - [opera](http://www.opera.com/) - [optimal-layout](http://most-advantageous.com/optimal-layout/) - [orange](http://orange.biolab.si/) - [orbit](http://orbitapp.net) - [origin](http://origin.com) - [ormr](http://getormr.com/home/) - [osculator](http://www.osculator.net) - [osirix](http://www.osirix-viewer.com) - [osxfuse](https://osxfuse.github.io/) - [outwit-hub](http://www.outwit.com) - [owasp-zap](https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project) - [owncloud](http://owncloud.com) #### P - [p4merge](http://www.perforce.com/product/components/perforce-visual-merge-and-diff-tools) - [p4v](http://www.perforce.com/product/components/perforce-visual-client) - [p5](http://p5js.org/download/#editor) - [pacifist](http://www.charlessoft.com/) - [packer](http://www.packer.io/) - [padre](http://padre.perlide.org) - [pagico](http://pagico.com/) - [paintbrush](http://paintbrush.sourceforge.net/) - [paintcode](http://www.paintcodeapp.com/) - [pandoc](http://johnmacfarlane.net/pandoc) - [pandora-one](http://www.pandora.com/) - [pangu](http://en.pangu.io/) - [panic-unison](http://panic.com/unison/) - [panini](http://sourceforge.net/projects/pvqt/) - [paparazzi](http://derailer.org/paparazzi/) - [papers](http://www.papersapp.com/papers/) - [paragon-extfs](http://www.paragon-software.com/home/extfs-mac/) - [paragon-ntfs](http://www.paragon-software.com/home/ntfs-mac/) - [parallels](http://www.parallels.com/products/desktop/) - [paraview](http://www.paraview.org/) - [parse](https://parse.com) - [pashua](http://www.bluem.net/en/mac/pashua/) - [password-gorilla](https://github.com/zdia/gorilla) - [password-practice](https://mrgeckosmedia.com/applications/info/PasswordPractice) - [pastor](http://mehlau.net/pastor) - [path-finder](http://www.cocoatech.com/pathfinder/) - [paw](http://luckymarmot.com/paw) - [paye-tools](http://www.hmrc.gov.uk/payerti/payroll/bpt/paye-tools.htm) - [pcalc](http://www.pcalc.com/index.html) - [pcsxr](https://pcsxr.codeplex.com) - [pd-extended](http://puredata.info/downloads/pd-extended) - [pdfinfo](http://www.sybrex.com/products/macgui/infomanager/) - [pdfmasher](http://www.hardcoded.net/pdfmasher/) - [pdfpen](http://smilesoftware.com/PDFpen/index.html) - [pdfpenpro](http://www.smilesoftware.com/PDFpenPro/index.html) - [pdfsam](http://www.pdfsam.org/) - [pdfshaver](https://github.com/tparry/PDFShaver.app) - [pdftk](http://www.pdflabs.com/tools/pdftk-server/) - [peepopen](http://topfunky.github.io/PeepOpen/) - [pemdas-widget](http://www.donkeyengineering.com/pemdaswidget/) - [pencil](http://pencil.evolus.vn) - [pentaho-data-integration](http://community.pentaho.com) - [perian](http://www.perian.org/) - [pester](http://sabi.net/nriley/software/index.html#pester) - [petite-chez-scheme](http://www.scheme.com/petitechezscheme.html) - [pflists](http://www.hanynet.com/pflists/index.html) - [pg-commander](http://eggerapps.at/pgcommander/) - [pgadmin3](http://pgadmin.org) - [pgloader](http://pgloader.io) - [phantomjs](http://phantomjs.org/) - [pharo](http://www.pharo-project.org/home) - [phoenix-slides](http://blyt.net/phxslides) - [phoenix](https://github.com/sdegutis/Phoenix) - [phoneclean](http://www.imobie.com/phoneclean/) - [photoninja](http://www.picturecode.com/index.php) - [phpstorm](http://www.jetbrains.com/phpstorm/) - [pi-filler](http://ivanx.com/raspberrypi) - [pianopub](http://dev.kunugiken.com/Pianopub/) - [picasa](http://picasa.google.com/) - [picturesque](http://www.acqualia.com/picturesque/) - [piezo](http://rogueamoeba.com/piezo/) - [pinegrow-web-designer](http://pinegrow.com/) - [pingmenu](https://github.com/kalleboo/PingMenu) - [pins](http://pinsapp.com/) - [pinta](http://pinta-project.com/) - [pivotalbooster](http://pivotalbooster.com/) - [pixel-check](http://macguitar.me/apps/pixelcheck/) - [pixel-winch](http://ricciadams.com/projects/pixel-winch) - [pixelpeeper](http://www.irradiatedsoftware.com/labs) - [pixelstick](http://plumamazing.com/mac/pixelstick) - [pixi-paint](http://www.danielx.net/pixel-editor/docs/download) - [pixlr](https://pixlr.com) - [placeit](https://placeit.net/) - [plain-clip](http://www.bluem.net/en/mac/plain-clip) - [plainview](http://barbariangroup.com/) - [platypus](http://sveinbjorn.org/platypus) - [playonmac](http://www.playonmac.com/en) - [pleasesleep](http://www.dragonone.com/products/macosx/pleasesleep/) - [plex-home-theater](https://plex.tv) - [plex-media-server](https://plex.tv/) - [pliny](http://pliny.cch.kcl.ac.uk) - [plover](http://stenoknight.com/wiki/Main_Page) - [plug](http://www.plugformac.com/) - [plycounter](http://www.plycount.com) - [pngcommentator](http://www.echomist.co.uk/software/PNGCommentator.html) - [pngyu](http://nukesaq88.github.io/Pngyu/) - [poedit](http://www.poedit.net) - [poison](http://tox.im) - [pokemon-showdown](http://pokemonshowdown.com) - [pokerstars](http://www.pokerstars.com/) - [pokertracker](https://www.pokertracker.com) - [port-map](http://www.codingmonkeys.de/portmap) - [porthole](http://getporthole.com/) - [postbox](http://www.postbox-inc.com/) - [postgres](http://postgresapp.com/) - [power-manager-pro](https://www.dssw.co.uk/powermanager) - [power-manager](https://www.dssw.co.uk/powermanager) - [powerkey](http://pkamb.github.io/PowerKey/) - [powerword](http://mac.iciba.com) - [praat](http://www.fon.hum.uva.nl/praat/) - [preen](http://anomiesoftware.com/Anomie_Software/Preen.html) - [pref-setter](http://www.nightproductions.net/prefsetter.html) - [preference-manager](http://www.digitalrebellion.com/prefman) - [preferencecleaner](http://www.echomist.co.uk/software/PreferenceCleaner.shtml) - [prefs-editor](http://www.tempel.org/PrefsEditor) - [prepros](http://alphapixels.com/prepros/) - [prey](https://preyproject.com) - [prezi](http://www.prezi.com/) - [printrun](https://github.com/kliment/Printrun) - [prismatik](http://lightpack.tv/) - [private-eye](http://radiosilenceapp.com/private-eye) - [private-internet-access](https://www.privateinternetaccess.com) - [prizmo](http://www.creaceed.com/prizmo) - [processing](http://processing.org/) - [programmer-dvorak](http://kaufmann.no/roland/dvorak/) - [projectlibre](http://www.projectlibre.org/) - [prolific-usb-serial-driver](http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=229&pcid=41) - [propane](http://propaneapp.com/) - [propresenter](http://www.renewedvision.com/propresenter.php) - [protege](http://protege.stanford.edu/) - [provisioning](https://github.com/chockenberry/Provisioning) - [provisionql](https://github.com/ealeksandrov/ProvisionQL) - [proxifier](http://www.proxifier.com/mac/) - [proximity](https://code.google.com/p/reduxcomputing-proximity/) - [proxpn](http://proxpn.com) - [ps3-media-server](http://www.ps3mediaserver.org/) - [psi](http://psi-im.org/) - [psychopy](http://www.psychopy.org/) - [punto-switcher](http://punto.yandex.ru) - [pupil](http://pupil.io/) - [pusher](https://github.com/noodlewerk/NWPusher) - [putio-adder](https://github.com/nicoSWD/put.io-adder) - [puush](http://puush.me/) - [puzzles](http://www.chiark.greenend.org.uk/~sgtatham/puzzles/) - [pwnagetool](http://blog.iphone-dev.org/tagged/PwnageTool) - [pycharm-ce](http://www.jetbrains.com/pycharm) - [pycharm](http://www.jetbrains.com/pycharm/) #### Q - [qbittorrent](http://www.qbittorrent.org) - [qdesktop](http://qvacua.com) - [qgis](http://www.kyngchaos.com/software/qgis) - [qgroundcontrol](http://qgroundcontrol.org) - [qiyimedia](http://www.iqiyi.com) - [qlcolorcode](https://code.google.com/p/qlcolorcode/) - [qlimagesize](https://github.com/Nyx0uf/qlImageSize) - [qlmarkdown](https://github.com/toland/qlmarkdown) - [qlprettypatch](https://github.com/atnan/QLPrettyPatch) - [qlrest](https://github.com/cluther/qlrest) - [qlstephen](http://whomwah.github.io/qlstephen/) - [qmind](http://qvacua.com) - [qq](http://im.qq.com/macqq/index.shtml) - [qqbrowser](http://browser.qq.com/mac/) - [qqinput](http://qq.pinyin.cn/) - [qqmusic](http://y.qq.com) - [qrfcview](https://saghul.github.io/qrfcview-osx) - [qrq](http://fkurz.net/ham/qrq.html) - [qt-creator](http://qt-project.org/) - [qtspim](http://spimsimulator.sourceforge.net/) - [quassel-client](http://quassel-irc.org) - [querious](http://www.araelium.com/querious/) - [quick-search-box](http://www.google.com/quicksearchbox/) - [quickcast](http://quickcast.io/) - [quickhue](https://github.com/danparsons/QuickHue) - [quicklook-csv](https://github.com/p2/quicklook-csv) - [quicklook-json](http://www.sagtau.com/quicklookjson.html) - [quicklook-pfm](https://code.google.com/p/quicklook-pfm/) - [quicknfo](https://github.com/planbnet/QuickNFO) - [quickradar](http://www.quickradar.com/) - [quicksilver](http://qsapp.com/) - [quiterss](http://quiterss.org/) - [quotefixformac](https://github.com/robertklep/quotefixformac) - [qvod-player](http://www.qvodcd.com/) #### R - [r-name](http://www.jacek-dom.net/software/R-Name/) - [r](http://www.r-project.org/) - [racket](http://racket-lang.org/) - [radbeacon](http://store.radiusnetworks.com/collections/all/products/radbeacon-config) - [radiant-player](http://kbhomes.github.io/google-music-mac/) - [rapidweaver](http://realmacsoftware.com/rapidweaver) - [raw-photo-processor](http://www.raw-photo-processor.com/RPP/Overview.html) - [raw-therapee](http://rawtherapee.com) - [razer-synapse](http://www.razerzone.com/synapse2) - [razorsql](http://razorsql.com/download_mac.html) - [rcdefaultapp](http://www.rubicode.com/Software/RCDefaultApp/) - [rcenvironment](http://www.rubicode.com/Software/RCEnvironment/) - [rdio](http://www.rdio.com) - [rdm](http://redisdesktop.com) - [readefine-desktop](http://readefine.anirudhsasikumar.net/) - [readytalk](https://www.readytalk.com/) - [reaper](http://www.reaper.fm/) - [recordit](http://recordit.co/) - [recovery-disk-assistant](http://support.apple.com/kb/HT4848) - [reeddit](http://mac.reedditapp.com) - [reflector](http://www.airsquirrels.com/reflector/) - [refresh-finder](http://soderhavet.com/refresh/refresh-finder/) - [reggy](http://reggyapp.com/) - [rekordbox](http://rekordbox.com/en/) - [remonit](http://zef.io/remonit/) - [remote-desktop-connection](http://www.microsoft.com/en-us/download/details.aspx?id=18140) - [renamer](http://renamer.com) - [repetier-host](http://www.repetier.com/) - [rescuetime](https://www.rescuetime.com) - [retinacapture](http://www.retinacapture.com) - [retinizer](http://retinizer.mikelpr.com/) - [retroshare](http://retroshare.sourceforge.net/) - [reveal](http://revealapp.com/) - [rftg](http://keldon.net/rftg/) - [ridibooks](http://ridibooks.com/support/introduce_appdown) - [riffworkst4](http://www.sonomawireworks.com/T4/) - [rightzoom](http://www.blazingtools.com/right_zoom_mac.html) - [ringtones](http://thelittleappfactory.com/ringtones/) - [ripit](http://thelittleappfactory.com/ripit/) - [robomongo](http://robomongo.org) - [rocks-n-diamonds](http://www.artsoft.org/rocksndiamonds/) - [royal-tsx](http://www.royaltsx.com) - [rrootage](http://workram.com/games/rrootage/) - [rss](http://www.rssapplication.com/) - [rstudio](http://www.rstudio.com/) - [rtx](http://www.rtxapp.com/mac/) - [rubitrack](http://www.rubitrack.com/) - [rubymine](http://www.jetbrains.com/ruby/) - [runtastic-connect](https://www.runtastic.com/connect) - [runtimebrowser](https://github.com/nst/RuntimeBrowser) - [rust](http://www.rust-lang.org/) - [rythem](https://github.com/AlloyTeam/Rythem) #### S - [sabnzbd](http://sabnzbd.org/) - [safaritabswitching](https://github.com/rs/SafariTabSwitching) - [safe-in-cloud](http://www.safe-in-cloud.com) - [safemonk](https://www.safemonk.com/) - [sage](http://www.sagemath.org/) - [sandbox](http://www.mikey-san.net/sandbox/) - [sandvox](http://www.karelia.com/products/sandvox/) - [satellite-eyes](http://satelliteeyes.tomtaylor.co.uk/) - [sauce](https://saucelabs.com/mac) - [sauerbraten](http://sauerbraten.org) - [scala-ide](http://scala-ide.org/) - [scansnap-manager](http://www.fujitsu.com/global/support/computing/peripheral/scanners/software/) - [scapple](https://www.literatureandlatte.com/scapple.php) - [schnapps](http://schnappsformac.com/) - [scilab](https://www.scilab.org) - [scout](http://mhs.github.io/scout-app/) - [scratch](http://scratch.mit.edu/scratch2download/) - [screenflick](http://www.araelium.com/screenflick/) - [screenflow](http://www.telestream.net/screenflow/) - [screenhero](http://screenhero.com) - [screenmailer](http://www.screenmailer.com) - [screens-connect](https://screensconnect.com) - [screenstagram](http://screenstagram.s3.amazonaws.com/download.html) - [screensteps](http://www.bluemangolearning.com/) - [scribbleton](http://scribbleton.com/) - [scribus](http://www.scribus.net/canvas/Scribus) - [scriptql](http://www.kainjow.com/) - [scrivener](http://literatureandlatte.com/scrivener.php) - [scroll-reverser](https://pilotmoon.com/scrollreverser/) - [scrup](https://github.com/rsms/scrup) - [scummvm](http://scummvm.org/) - [sdformatter](https://www.sdcard.org) - [sdrdx](http://fyngyrz.com/?p=915) - [seafile-client](http://seafile.com/) - [seamonkey](http://www.seamonkey-project.org/) - [seashore](http://seashore.sourceforge.net/) - [second-life-viewer](http://secondlife.com/) - [secondbar](http://blog.boastr.net/?page_id=79) - [secrets](http://secrets.blacktree.com) - [seil](https://pqrs.org/macosx/keyremap4macbook/seil.html.en) - [selfcontrol](http://selfcontrolapp.com/) - [selflanguage-self-control](http://selflanguage.org/) - [semulov](http://www.kainjow.com) - [send-to-kindle](http://www.amazon.com/gp/sendtokindle/mac) - [sensiolabsdesktop](http://desktop.sensiolabs.org) - [sente](http://www.thirdstreetsoftware.com) - [sequel-pro](http://www.sequelpro.com/) - [sequential](http://sequentialx.com) - [serf](http://www.serfdom.io/) - [serial-tools](http://www.w7ay.net/site/Applications/Serial%20Tools/) - [serialcloner](http://serialbasics.free.fr/Serial_Cloner.html) - [servetome](http://zqueue.com/servetome/) - [serviio](http://serviio.org/) - [servus](https://servus.io/) - [sevenzx](http://sixtyfive.xmghosting.com/products/7zx/) - [shades](http://www.charcoaldesign.co.uk/shades) - [shadowsocksx](https://github.com/shadowsocks/shadowsocks-iOS/wiki/Shadowsocks-for-OSX-Help) - [shadowsweeper](http://www.irradiatedsoftware.com/labs/) - [sharetool](http://bainsware.com/) - [shelf-leveler](https://mrgeckosmedia.com/applications/info/Shelf-Leveler) - [shiftit](https://github.com/fikovnik/ShiftIt) - [shimo](http://www.chungwasoft.com/shimo/) - [shiori](http://aki-null.net/shiori/) - [shoes](http://shoesrb.com/) - [shortcat](http://shortcatapp.com/) - [shotcut](http://www.shotcut.org/) - [shuttle](http://fitztrev.github.io/shuttle/) - [sickbeard-anime](http://sickbeard.lad1337.de/) - [sickbeard](http://sickbeard.lad1337.de/) - [sidekick](http://oomphalot.com/sidekick/) - [sidestep](http://chetansurpur.com/projects/sidestep) - [sidplay](http://www.sidmusic.org/sidplay/mac/) - [sigil](http://code.google.com/p/sigil/) - [silo](http://nevercenter.com/silo/) - [silverback](http://silverbackapp.com/) - [silverlight](http://www.microsoft.com/silverlight/) - [simon](http://www.dejal.com/simon/) - [simpholders](http://simpholders.com/) - [simple-comic](http://dancingtortoise.com/simplecomic/) - [simple-css](http://www.hostm.com/css) - [simplecap](http://xcatsan.com/simplecap-en/) - [simplefloatingclock](http://www.splook.com/Software/Simple_Floating_Clock.html) - [simpless](http://wearekiss.com/simpless) - [simplesynth](http://notahat.com/simplesynth/) - [simpletag](http://sourceforge.net/projects/simpletag/) - [simulator-folders](http://nimbleworks.co.uk/blog/simulator-folders/) - [sitesucker](http://www.sitesucker.us/mac/mac.html) - [sixtyforce](http://sixtyforce.com/) - [sizeup](http://www.irradiatedsoftware.com/sizeup/index.html) - [sizzlingkeys](http://www.yellowmug.com/sk4it/) - [sketch-tool](http://bohemiancoding.com/sketch/tool/) - [sketch-toolbox](http://sketchtoolbox.com) - [sketch](http://www.bohemiancoding.com/sketch/) - [sketchup](http://www.sketchup.com/intl/en/) - [sketchupviewer](http://www.sketchup.com/intl/en/) - [skim](http://skim-app.sourceforge.net/) - [skitch](http://evernote.com/skitch/) - [skreenics](https://code.google.com/p/skreenics/) - [skydrive](http://windows.microsoft.com/en-us/skydrive/download) - [skype](http://www.skype.com) - [slack](http://slack.com) - [slate](https://github.com/jigish/slate) - [sleep-monitor](https://www.dssw.co.uk/sleepmonitor) - [slender](http://dragonforged.com/slender/) - [slic3r](http://slic3r.org/) - [slice](http://sliceeq.com/) - [slicy](http://macrabbit.com/slicy/) - [slidemode](http://teaksoftware.com/app/slidemode) - [slimbatterymonitor](http://www.orange-carb.org/SBM/) - [slimboat](http://www.slimboat.com) - [slingshot](http://www.airsquirrels.com/slingshot/) - [sloth](http://sveinbjorn.org/sloth) - [slowy](http://slowyapp.com/) - [smaller](http://smallerapp.com/) - [smartgithg](http://www.syntevo.com) - [smartloader](http://picturelife.com) - [smartsynchronize](http://www.syntevo.com) - [smcfancontrol](http://www.eidac.de/?p=243) - [smoothmouse](http://smoothmouse.com) - [snagit](http://www.techsmith.com/snagit.html) - [snes9x](http://www.snes9x.com/) - [snip](http://snip.qq.com/) - [snippet-edit](http://cocoaholic.com/snippet_edit/) - [snippets](http://snippets.me/) - [sococo](http://www.sococo.com) - [sofortbild](http://www.sofortbildapp.com/) - [sogouinput](http://pinyin.sogou.com/mac/) - [soleol](http://eduo.info/apps/soleol) - [sonic-visualiser](http://www.sonicvisualiser.org/) - [sonora](http://getsonora.com/) - [sonos](http://www.sonos.com/) - [sopcast](http://www.sopcast.org) - [sophos-anti-virus-home-edition](http://www.sophos.com/en-us/products/free-tools/sophos-antivirus-for-mac-home-edition.aspx/) - [soqlxplorer](http://www.pocketsoap.com/osx/soqlx/) - [soulseek](http://www.soulseekqt.net/) - [soulver](http://www.acqualia.com/soulver/) - [soundcleod](http://salomvary.github.io/soundcleod/) - [soundflower](https://code.google.com/p/soundflower/) - [soundnote](https://mrgeckosmedia.com/applications/info/SoundNote) - [sourcetree](http://www.sourcetreeapp.com/) - [spacemonkey](https://www.spacemonkey.com) - [spacious](http://www.iospirit.com/products/spacious) - [spark-inspector](http://sparkinspector.com/) - [spark](http://www.shadowlab.org/softwares/spark.php) - [sparkbox](http://www.icyblaze.com/sparkbox) - [sparkle](http://sparkle-project.org/) - [sparkleshare](http://sparkleshare.org/) - [sparrow](http://www.sparrowmailapp.com/) - [spectacle](http://spectacleapp.com/) - [speedcrunch](http://www.speedcrunch.org) - [speedlimit](http://mschrag.github.io/) - [speedtao](http://www.speedtao.net/) - [spek](http://spek.cc) - [spideroak](http://spideroak.com) - [spillo](http://bananafishsoftware.com/products/spillo/) - [spirited-away](http://drikin.com/2010/11/spirited-away.html) - [splashtop-personal](http://www.splashtop.com/personal) - [splashtop-streamer](http://www.splashtop.com/downloads) - [splayerx](https://bitbucket.org/Tomasen/splayerx/wiki/Home) - [spotdox](http://spotdox.com/get-started/) - [spotifree](http://spotifree.gordinskiy.com) - [spotify-menubar](http://lifeupnorth.co.uk/Spotify-Menubar/) - [spotify-notifications](http://spotify-notifications.citruspi.io/) - [spotify](https://www.spotify.com) - [spyder](https://code.google.com/p/spyderlib/) - [sqleditor](http://www.malcolmhardie.com/sqleditor/) - [sqlexplorer](http://eclipsesql.sourceforge.net/) - [sqlite-database-browser](http://sqlitebrowser.org) - [sqlite-professional](https://www.sqlitepro.com) - [sqlitestudio](http://sqlitestudio.pl) - [squidman](http://squidman.net/squidman/) - [squire](http://squireapp.com) - [squirrel](https://github.com/lotem/squirrel) - [sqwiggle](https://www.sqwiggle.com) - [srclib](https://srclib.org/) - [sshfs](http://osxfuse.github.io/) - [ssx](http://chris.schleifer.net/ssX/index.cgi/index.html) - [stackato](http://docs.stackato.com/user/client/index.html) - [stackroom](http://www.geocities.jp/aromaticssoft/stackroom/index.html) - [startninja](http://www.allvu.com/index.php/products/startninja.html) - [stay](http://cordlessdog.com/stay/) - [steam](http://store.steampowered.com/about/) - [steermouse](http://plentycom.jp/en/steermouse/) - [stella](http://stella.sourceforge.net) - [stellarium](http://stellarium.org) - [stockbarjp](http://midnightsuyama.org) - [streamtools](https://github.com/nytlabs/streamtools) - [strongvpn-client](http://strongvpn.com/vpnclient.shtml) - [sts](http://spring.io/tools/sts) - [subclassed-mnemosyne](http://www.subclassed.com/apps/mnemosyne/details) - [subl](https://github.com/dhoulb/subl) - [subler](https://code.google.com/p/subler/) - [sublercli](https://code.google.com/p/subler/) - [sublime-text](http://www.sublimetext.com/2) - [subnetcalc](http://subnetcalc.free.fr/) - [subsmarine](http://www.cocoawithchurros.com/subsmarine.php) - [subsurface](http://subsurface.hohndel.org/) - [subtitle-master](http://subtitlemaster.com/) - [subtitles](http://subtitlesapp.com) - [sunlogin-remote](http://sunlogin.oray.com) - [super-otr](http://apfel-a.macbay.de/super-otr/) - [supercollider](http://supercollider.sourceforge.net/) - [superduper](http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html) - [supersync](http://supersync.com/) - [supertuxkart](http://supertuxkart.sourceforge.net) - [surplusmeter](http://www.skoobysoft.com/utilities/utilities.html#surplusmeter) - [suspicious-package](http://www.mothersruin.com/software/SuspiciousPackage/) - [svnx](https://code.google.com/p/svnx/) - [sweet-home3d](http://www.sweethome3d.com/) - [swingfish](http://cloakedcode.com/swingfish.html) - [swinsian](http://swinsian.com) - [switchresx](http://www.madrau.com) - [switchup](http://www.irradiatedsoftware.com/switchup/) - [synergy](http://synergy-foss.org/) - [synology-assistant](http://www.synology.com/) - [synology-cloud-station](http://www.synology.com/) - [synology-photo-station-uploader](http://www.synology.com/) - [synthesia](http://www.synthesiagame.com) #### T - [tabula](http://tabula.nerdpower.org) - [tactor](http://onflapp.wordpress.com/tactor/) - [tag](http://sbooth.org/Tag/) - [tagalicious](http://thelittleappfactory.com/tagalicious/) - [tagger](http://bilalh.github.io/projects/tagger/) - [tagoman](http://onflapp.wordpress.com/tagoman) - [tagr](http://www.entwicklungsfreu.de/tagr.html) - [tagspaces](http://www.tagspaces.org) - [tapaal](http://www.tapaal.net) - [taskpaper](http://www.hogbaysoftware.com/products/taskpaper) - [tau](http://tau.uoregon.edu/) - [tcpblock](http://tcpblock.wordpress.com/) - [td-agent](http://www.fluentd.org/) - [td-toolbelt](http://toolbelt.treasuredata.com/) - [teamspeak-client](http://www.teamspeak.com/) - [teamviewer](http://www.teamviewer.com/) - [teamviz](http://www.teamviz.com/) - [teensy](http://pjrc.com/teensy/loader_mac.html) - [teeworlds](https://www.teeworlds.com/) - [telegram](https://vk.com/telegram_osx) - [telephone](https://code.google.com/p/telephone/) - [teleport](http://www.abyssoft.com/software/teleport/) - [testflight](http://testflightapp.com) - [tex-live-utility](https://code.google.com/p/mactlmgr/) - [texmacs](http://www.texmacs.org/) - [texmaker](http://www.xm1math.net/texmaker) - [texnicle](http://www.bobsoft-mac.de/texnicle/texnicle.html) - [texpad](https://www.texpadapp.com/osx) - [texshop](http://pages.uoregon.edu/koch/texshop) - [texstudio](http://texstudio.sourceforge.net/) - [textadept](http://foicica.com/textadept/) - [textexpander](http://www.smilesoftware.com/TextExpander/index.html) - [textmate](http://macromates.com/) - [textroom](https://code.google.com/p/textroom/) - [texts](http://www.texts.io) - [textsoap](http://www.unmarked.com/textsoap/) - [texturepacker](http://www.codeandweb.com/texturepacker) - [textwrangler](http://www.barebones.com/products/textwrangler) - [tftpserver](http://ww2.unime.it/flr/tftpserver/) - [thaiwitter](https://tw3.herokuapp.com/) - [the-archive-browser](http://archivebrowser.c3.cx) - [the-brain](http://www.thebrain.com/) - [the-escapers-flux](http://www.theescapers.com/flux/) - [the-hit-list](http://www.potionfactory.com/thehitlist) - [the-unarchiver](http://unarchiver.c3.cx/) - [theremin](https://github.com/TheStalwart/Theremin) - [thetube](http://www.equinux.com/us/products/thetube/index.html) - [things](http://culturedcode.com/things/) - [thinkorswim](http://mediaserver.thinkorswim.com/installer/install.html#macosx) - [thirty-three-rpm](http://www.edenwaith.com/products/33rpm/) - [thisservice](http://wafflesoftware.net/thisservice/) - [thong](http://thong.fousa.be/) - [thumbsup](http://www.devontechnologies.com/products/freeware.html#c966) - [thunder](http://mac.xunlei.com/) - [thunderbird](http://www.mozilla.org/en-US/thunderbird/) - [thyme](http://joaomoreno.github.io/thyme/) - [tickets](http://www.irradiatedsoftware.com/tickets/) - [tiddlywiki](https://github.com/Jermolene/TiddlyDesktop) - [tikz-editor](https://github.com/fredokun/TikZ-Editor) - [tiled](http://www.mapeditor.org/) - [tilemill](http://www.mapbox.com/tilemill/) - [time-out](http://www.dejal.com/timeout/) - [time-sink](http://manytricks.com/timesink/) - [time-tracker](https://code.google.com/p/time-tracker-mac) - [timemachineeditor](http://timesoftware.free.fr/timemachineeditor/) - [timemachinescheduler](http://www.klieme.com/TimeMachineScheduler.html) - [timings](http://mediaatelier.com/Timings) - [tinkertool](http://www.bresink.com/osx/TinkerTool.html) - [tinygrab](http://www.tinygrab.com) - [tinyumbrella](http://blog.firmwareumbrella.com/) - [titanium-studio](https://my.appcelerator.com/resources) - [tk-suite-client](http://agfeo.de/agfeo_web/hp3.nsf/lu/2064) - [toad-mac](http://www.toadworld.com/products/toad-mac-edition/default.aspx) - [toau](http://toauapp.com) - [todoist](https://todoist.com) - [todos](http://dbachrach.com/opensoft/index.php?page=Todos) - [tofu](http://amarsagoo.info/tofu/) - [toggldesktop](https://www.toggl.com) - [tokaido](https://github.com/tokaido/tokaidoapp/releases) - [tomahawk](http://www.tomahawk-player.org/) - [tomighty](http://www.tomighty.org/) - [tongbu](http://www.tongbu.com) - [tonido](http://www.tonido.com/) - [toodledo](https://www.toodledo.com/tools/mac_menubar.php) - [torbrowser](https://www.torproject.org/projects/torbrowser.html) - [torpedo](https://usetorpedo.com) - [tortoisehg](http://tortoisehg.bitbucket.org/) - [torustrooper](http://workram.com/games/) - [totalfinder](http://totalfinder.binaryage.com) - [totals](http://www.kedisoft.com/totals/) - [totalspaces](http://totalspaces.binaryage.com/) - [totalterminal](http://totalterminal.binaryage.com) - [tower](http://www.git-tower.com/) - [trailer](http://dev.housetrip.com/trailer/) - [trailrunner](http://trailrunnerx.com/) - [traktable](http://yo-han.github.io/Traktable/) - [transmission-remote-gui](https://code.google.com/p/transmisson-remote-gui/) - [transmission](http://www.transmissionbt.com/) - [transmit](http://panic.com/transmit) - [treemaker](http://www.langorigami.com/science/computational/treemaker/treemaker.php) - [treesheets](http://strlen.com/treesheets/) - [tresorit](http://tresorit.com) - [tribler](http://www.tribler.org) - [trickster](http://www.apparentsoft.com/trickster/) - [trim-enabler](http://www.cindori.org/software/trimenabler/) - [truecrypt](http://truecrypt.org/) - [tubbler](http://www.celmaro.com/tubbler) - [tuneinstructor](http://www.tune-instructor.de/com/start.html) - [tunewiki](http://www.tunewiki.com/) - [tunnelbear](https://www.tunnelbear.com/) - [tunnelblick](https://code.google.com/p/tunnelblick/) - [tuxguitar](http://www.tuxguitar.com.ar/) - [tv-browser](http://www.tvbrowser.org/index.php?setlang=en) - [tv-show-tracker](http://www.pixelperfectwidgets.com/) - [tvmobili](http://www.tvmobili.com/) - [tvshows](http://tvshowsapp.com/) - [twentytwo](https://github.com/marcw/twentytwo) - [twindocs](https://www.twindocs.com) - [twine](http://twinery.org/) - [twitterrific](http://twitterrific.com/mac) - [typewriter](http://llllll.li/typewriter) - [typinator](http://www.ergonis.com/) #### U - [uber-network-fuser](http://nickapedia.com/2012/01/10/breaking-new-ground-an-uber-tool-for-the-mac/) - [uberpov](http://megapov.inetart.net/uberpov_mac/index.html) - [ubersicht](http://tracesof.net/uebersicht) - [ubuntu-one](http://one.ubuntu.com) - [ukelele](http://scripts.sil.org/ukelele) - [ultrastardeluxe](http://ultrastardx.sourceforge.net/) - [uncrustifyx](https://github.com/ryanmaxwell/UncrustifyX) - [undercover](http://www.orbicule.com/undercover/mac/) - [unetbootin](http://unetbootin.sourceforge.net/) - [unicodechecker](http://earthlingsoft.net/UnicodeChecker/) - [unified-remote](http://www.unifiedremote.com) - [uninstallpkg](http://www.corecode.at/uninstallpkg/) - [unison](http://www.cis.upenn.edu/~bcpierce/unison/) - [unity-web-player](https://unity3d.com/webplayer) - [unity3d](http://unity3d.com/unity/) - [universal-media-server](www.universalmediaserver.com) - [unpkg](http://www.timdoug.com/unpkg/) - [unrarx](http://www.unrarx.com) - [usb-overdrive](http://www.usboverdrive.com/) - [utc-menu-clock](https://github.com/netik/UTCMenuClock) - [utopia](http://utopiadocs.com/) - [utorrent](http://www.utorrent.com/) #### V - [vagrant-manager](http://vagrantmanager.com/) - [vagrant](http://www.vagrantup.com) - [valentina-studio](http://www.valentina-db.com/) - [vassal](http://www.vassalengine.org) - [versions](http://versionsapp.com/) - [vessel](http://awvessel.github.io) - [viber](http://viber.com) - [vico](http://www.vicoapp.com) - [videomonkey](http://videomonkey.org/) - [videospec](http://videospec.free.fr/english/) - [vienna](http://www.vienna-rss.org) - [vimediamanager](http://mariusth.channelwood.org/vimediamanager/) - [vimr](http://vimr.org/) - [vine-server](http://www.testplant.com/products/vine/vine-server/) - [vinoteka](http://www.vinotekasoft.com/) - [virtaal](http://virtaal.translatehouse.org/) - [virtualbox](http://www.virtualbox.org) - [virtualhostx](http://clickontyler.com/virtualhostx/) - [virustotaluploader](https://www.virustotal.com/) - [viscosity](http://www.sparklabs.com/viscosity/) - [visit](https://wci.llnl.gov/codes/visit/home.html) - [vistrails](http://www.vistrails.org/index.php/Main_Page) - [visualack](http://blog.kowalczyk.info/software/vack/) - [visualvm](http://visualvm.java.net) - [vitamin-r](http://www.publicspace.net/Vitamin-R/) - [vlc-remote](http://hobbyistsoftware.com/vlc) - [vlc](http://www.videolan.org/vlc/) - [vlcstreamer](http://hobbyistsoftware.com/vlcstreamer) - [vmware-fusion](http://www.vmware.com/products/fusion/) - [vmware-horizon-view-client](http://www.vmware.com/) - [vocabulist](http://vocabulistapp.com/) - [voicemac](https://mrgeckosmedia.com/applications/info/VoiceMac) - [volatility](http://www.volatilityfoundation.org/) - [vox-preference-pane](http://coppertino.com/vox/addon.html) - [vuescan](http://www.hamrick.com) - [vyprvpn](http://www.goldenfrog.com/vyprvpn) #### W - [wabbitemu](http://wabbit.codeplex.com) - [wacom-bamboo-tablet](http://us.wacom.com/en/support/drivers) - [wacom-tablet](http://www.wacom.com/) - [wake-on-lan](http://www.readpixel.com/wakeonlan/) - [wallpaper-wizard](http://wallwiz.com) - [wasted](http://wasted.werk01.de) - [waterroof](http://www.hanynet.com/waterroof/index.html) - [wavtap](https://github.com/pje/wavtap) - [wd-security](http://www.wdc.com/en/) - [web-sharing](http://clickontyler.com/web-sharing/) - [webp-quicklook](https://github.com/dchest/webp-quicklook) - [webstorm](http://www.jetbrains.com/webstorm/) - [wechat](http://weixin.qq.com/cgi-bin/readtemplate?t=mac) - [wedge](http://wedge.natestedman.com) - [weibox](http://weiboformac.sinaapp.com) - [weka](http://www.cs.waikato.ac.nz/ml/weka/) - [welly](https://code.google.com/p/welly/) - [wesnoth](http://wesnoth.org) - [whatpulse](http://www.whatpulse.org/) - [whatsapp-pocket](http://www.fireebok.com/whatsapp-pocket.html) - [whatsize](http://whatsizemac.com/) - [whiteclock](http://www.taimila.com/?p=1221) - [widelands](https://wl.widelands.org/) - [wifimasterkey](http://www.lianwifi.com/) - [window-switch](http://xpra.org/) - [windownaut](http://www.binarybakery.com/aprod/index.html) - [wineskin-winery](http://wineskin.urgesoftware.com/) - [wings3d](http://www.wings3d.com/) - [winxound](https://winxound.codeplex.com/) - [wireover](http://www.wireover.com/) - [wireshark](http://www.wireshark.org) - [wiretap-studio](http://www.ambrosiasw.com/utilities/wiretap/) - [witch](http://manytricks.com/witch/) - [witgui](http://desairem.altervista.org/witgui/wordpress/) - [wiznote](http://www.wiznote.com/) - [wiztoolsorg-restclient](https://code.google.com/p/rest-client) - [wjoy](https://code.google.com/p/wjoy/) - [wondershare-player](http://www.wondershare.com/video-player/) - [woodhouse](https://github.com/phinze/woodhouse/) - [wordservice](http://www.devontechnologies.com/products/freeware.html#c1115) - [worksnaps-client](http://www.worksnaps.net/) - [wowhead-client](http://wowhead.com) - [wraparound](http://www.digicowsoftware.com/detail?_app=Wraparound) - [wuala](http://wuala.com) - [wyzo](http://wyzo.com) #### X - [x-lite](http://www.counterpath.com/x-lite.html) - [x-mirage](http://www.x-mirage.com/x-mirage/) - [x-moto](http://xmoto.tuxfamily.org) - [x2goclient](http://x2go.org) - [x48](http://blog.sharkus.com/2012/08/osx-hp48-emulators.html) - [xact](http://xact.scottcbrown.org) - [xamarin-android](http://xamarin.com/android) - [xamarin-ios](http://xamarin.com/ios) - [xamarin-studio](http://xamarin.com/studio) - [xamarin](http://xamarin.com/platform) - [xampp](http://www.apachefriends.org/index.html) - [xaos](http://matek.hu/xaos) - [xbench](http://xbench.com/) - [xbmc](http://xbmc.org/) - [xbox360-controller-driver](http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/OsxDriver) - [xca](http://xca.sourceforge.net/) - [xee](http://xee.c3.cx/) - [xiami](http://www.xiami.com/) - [xld](http://tmkk.undo.jp/xld/index_e.html) - [xmarks-safari](http://www.xmarks.com/) - [xmind](http://www.xmind.net) - [xmrouter](http://www1.miwifi.com/) - [xnconvert](http://www.xnview.com/en/xnconvert/) - [xnviewmp](http://www.xnview.com/) - [xquartz](http://xquartz.macosforge.org/) - [xrg](http://www.gauchosoft.com/Products/XRG/) - [xscope](http://iconfactory.com/software/xscope) - [xscreensaver](http://www.jwz.org/xscreensaver/) - [xslimmer](http://latenitesoft.com/xslimmer/) - [xtorrent](http://www.xtorrent.com) - [xtrafinder](http://www.trankynam.com/xtrafinder/) #### Y - [yabumi](https://yabumi.cc/) - [yacreader](http://www.yacreader.com) - [yandex](http://browser.yandex.com/) - [yandexdisk](https://disk.yandex.com/) - [yasu](http://yasuapp.net) - [yemuzip](http://www.yellowmug.com/yemuzip) - [ynab](http://www.youneedabudget.com/) - [yojimbo](http://www.barebones.com/products/yojimbo/) - [yorufukurou](https://sites.google.com/site/yorufukurou/home-en) - [youdao](http://cidian.youdao.com/mac/) - [youll-never-take-me-alive](https://github.com/iSECPartners/yontma-mac) - [younited](http://www.younited.com/index.html) - [youview](https://mrgeckosmedia.com/applications/info/YouView) - [yubikey-personalization-gui](http://www.yubico.com/products/services-software/personalization-tools/use/) - [yubiswitch](https://github.com/pallotron/yubiswitch) #### Z - [zed](http://zedapp.org) - [zendserver](http://www.zend.com/en/products/server/) - [zendstudio](http://www.zend.com/en/products/studio/) - [zepheer](http://candysquare.com/products/zepheer/) - [zephyros](https://github.com/sdegutis/zephyros) - [zeroad](http://www.play0ad.com/) - [zeroinstall](http://0install.net) - [zeroxdbe-eap](http://www.jetbrains.com/dbe/) - [zeroxed](http://www.suavetech.com/0xed/) - [zipcleaner](http://roger-jolly.nl/software/#zipcleaner) - [zipeg](http://www.zipeg.net/) - [zoc](http://www.emtec.com/zoc/) - [zoomus](http://www.zoom.us) - [zooom](http://coderage-software.com/zooom) - [zotero](http://www.zotero.org/) - [zterm](http://www.dalverson.com/zterm/) ================================================ FILE: chai.md ================================================ --- title: Chai.js category: JavaScript libraries weight: -3 updated: 2018-06-25 version: chai v4.x description: | expect(x).to.be.equal(y) 〉 assert.equal(x, y) 〉 .to.be.true 〉 jQuery, assertions, TDD and BDD, and other Chai examples. --- ### Assert ```js const { assert } = require('chai') ``` {: .-setup} ```js assert(val) assert.fail(actual, expected) assert.ok(val) // is truthy assert.equal(actual, expected) // compare with == assert.strictEqual(actual, expected) // compare with === assert.deepEqual(actual, expected) // deep equal check ``` ```js assert.isTrue(val) assert.isFalse(val) ``` ```js assert.isNull(val) assert.isNotNull(val) assert.isUndefined(val) assert.isDefined(val) assert.isFunction(val) assert.isObject(val) assert.isArray(val) assert.isString(val) assert.isNumber(val) assert.isBoolean(val) ``` ```js assert.typeOf(/tea/, 'regexp') // Object.prototype.toString() assert.instanceOf(chai, Tea) assert.include([ a,b,c ], a) assert.match(val, /regexp/) assert.property(obj, 'tea') // 'tea' in object assert.deepProperty(obj, 'tea.green') assert.propertyVal(person, 'name', 'John') assert.deepPropertyVal(post, 'author.name', 'John') ``` ```js assert.lengthOf(object, 3) assert.throws(function() { ... }) assert.throws(function() { ... }, /reference error/) assert.doesNotThrow ``` ```js assert.operator(1, '<', 2) assert.closeTo(actual, expected) ``` See: [Assert API](http://chaijs.com/api/assert/) _(chaijs.com)_ ### BDD syntax ```js const { expect } = require('chai') ``` {: .-setup} ```js expect(object) .to.equal(expected) .to.eql(expected) // deep equality .to.deep.equal(expected) // same as .eql .to.be.a('string') .to.include(val) ``` ```js .be.ok(val) .be.true .be.false .to.exist ``` ```js .to.be.null .to.be.undefined .to.be.empty .to.be.arguments .to.be.function .to.be.instanceOf ``` ```js .to.be.gt(5) // aka: .above .greaterThan .to.be.gte(5) // aka: .at.least .to.be.lt(5) // aka: .below ``` ```js .to.respondTo('bar') .to.satisfy((n) => n > 0) ``` ```js .to.have.members([2, 3, 4]) .to.have.keys(['foo']) .to.have.key('foo') .to.have.lengthOf(3) ``` ```js expect(() => { ··· }) .to.throw(/not a function/) ``` See: [BDD](http://chaijs.com/api/bdd/) _(chaijs.com)_ ### Should: chains .to .be .been .is .that .and .have .with .at .of .same These don't do anything and can be chained. ### Should not ```js expect(object).not.equal('x') ``` ## Chai with jQuery ### Using chai-jquery ```js global.jQuery = ··· chai.use(require('chai-jquery')) ``` {: .-setup} ```js expect($body) .have.attr('foo') .have.prop('disabled') .have.css('background') .have.css('background-color', '#ffffff') .have.data('foo') ``` ```js .have.class('active') .have.id('id') ``` ```js .have.html('hi') .have.text('hello') .have.value('2013') ``` ### Continued ```js expect($body) ``` ```js .be.visible .be.hidden ``` ```js .be.checked .be.selected ``` ```js .be.enabled .be.disabled ``` ```js .be.empty .to.exist .to.contain('text') .to.have('.selector') ``` ================================================ FILE: cheatsheet-styles.md ================================================ --- title: Cheatsheet styles tags: [WIP] updated: 2017-10-26 intro: | This is a reference of styles that you can use on Devhints cheatsheets. How meta! You can refer to this when contributing your own cheatsheets to the [GitHub repo](https://github.com/rstacruz/cheatsheets/). --- Intro ----- Variants -------- {: .-three-column} ### H2 sections | `-one-column` | | | `-two-column` | _(default)_| | `-three-column` | | | `-left-reference` | 3 columns
_(short first column)_ | See: [H2 sections](#two-columns) ### H3 sections | `-prime` | Highlight | See: [H3 sections](#h3-sections-1) ### Tables | `-bold-first` | Bold first column | | `-headers` | Show headers | | `-left-align` | Don't right align last column | | `-mute-em` | Lower opacity for italics | | `-no-wrap` | Don't wrap text | | `-shortcuts` | Shortcut keys | See: [Tables](#tables-1) ### Code | `-box-chars` | Less line height
_for box drawing chars_ | | `-setup` | Gray background | | `-wrap` | Enables line-wrapping | See: [Code](#code-1) ### Paragraphs | `-setup` | Gray background | | `-crosslink` | Has arrow on the link | {: .-gray} See: [Paragraphs](#paragraphs-1) ### Lists | `-also-see` | Lighter background | | `-four-column` | | | `-six-column` | | See: [Lists](#lists-1) ### Adding variants {: .-prime} ``` ## Section {: .-two-column} ``` Devhints uses Kramdown, and supports adding classes via Kramdown's syntax. H3 sections ----------- {: .-three-column} ### Supported Each section can have the following children: #### White - `pre` - `ul` - `table` #### Gray - `p` - `h4` ### Prime section {: .-prime} This is a section with `{: .-prime}`. Notice the fancy highlight! Great for "getting started" kind of snippets. ### H3 section Every box is an H3 section. The box will encompass everything inside the body of the H3. This is a basic section with paragraphs in it. Code ---- {: .-three-column} ### Basic code ```js here.is(() => { some.code() }) ``` ```js here.is.some.more() ``` Code blocks can be placed one after the other. See: [Cheatsheets](/) ### Code with headings #### index.js {: .-file} ```js here.is(() => { some.code() }) ``` #### other.js {: .-file} ```js here.is.some.more() ``` Code blocks can have headings. ### Highlighted lines ```js app.start(() => { const port = app.server.port console.log(`Started at ${port}`) }) ``` {: data-line="3"} Add `{: data-line="3"}` to add line highlights. ### Multiple highlights ```js app.start(() => { const port = app.server.port console.log(`Started at ${port}`) }) ``` {: data-line="2,3"} Add `{: data-line="2,3"}` to add multiple line highlights. ### Setup blocks ```js import React from 'react' ``` {: .-setup} ```js class Hello extends React.Component { render () { return Hello } } ``` Add `{: .-setup}` to a `pre` or `table` or `ul`. ### Long lines ```js function createNode(nodeName: string, options: { key: string }) { return true } ``` Long lines will have scrollbars. ### Line wrapping ```js ``` {: .-wrap} Add `-wrap` to wrap long lines. ## Lists {: .-three-column} ### Lists - This is - a list - with a few items Here's an extra paragraph after the list. ### Lists with headings #### Part 1 - `createElement()` - `componentDidMount()` - `componentWillUnmount()` #### Part 2 - `shouldComponentUpdate()` - `componentWillReceiveProps()` Here's an extra paragraph after the list. ## List columns {: .-one-column} ### Six columns - One - Two - Three - Four - Five - Six - Seven - Eight - Nine - Ten - Eleven {: .-six-column} Add `{: .-six-column}` to make large lists. ### Four columns - One - Two - Three - Four - Five - Six - Seven - Eight - Nine - Ten - Eleven {: .-four-column} Add `{: .-four-column}` to make large lists. ### Also see - One - Two - Three - Four - Five - Six - Seven - Eight - Nine - Ten {: .-also-see} Add `{: .-also-see}`. ## Paragraphs {: .-three-column} ### Basic paragraphs This is a basic section with paragraphs in it. When paragraphs are the first elements in an H3 section's body, they appear as white. ### Basic paragraphs ``` ··· ``` When paragraphs appear after `pre`/`table`/`ul`, they appear with a gray background. ### Preludes Here's a prelude paragraph. Add `{: .-setup}` to make paragraphs appear with a gray background. {: .-setup} ``` ··· ``` ### Crosslink Add `{: .-crosslink}` to make big loud external links: ``` ··· ``` [Home](/) {: .-crosslink} ## Tables {: .-three-column} ### Basic table #### Date | Example | Output | | --- | --- | | `%m/%d/%Y` | `06/05/2013` | | `%A, %B %e, %Y` | `Sunday, June 5, 2013` | | `%b %e %a` | `Jun 5 Sun` | #### Time | Example | Output | | --- | --- | | `%H:%M` | `23:05` | | `%I:%M %p` | `11:05 PM` | This is a basic table with h4's. ### Shortcuts | `V` | Vector | | `P` | Pencil | | `T` | Text | | `L` | Line | | `R` | Rectangle | | `O` | Oval | | `U` | Rounded | {: .-shortcuts} Add `{: .-shortcuts}` to tables. ### With headers | Prefix | Example | What | | --- | --- | --- | | `//` | `//hr[@class='edge']` | Anywhere | | `./` | `./a` | Relative | | `/` | `/html/body/div` | Root | {: .-headers} Add `{: .-headers}` to add headers. ## Two columns ### One ``` ··· ``` ### Two ``` ··· ``` ## Left reference {: .-left-reference} ### One ``` ··· ··· ··· ··· ··· ··· ··· ··· ``` ### Two ``` ··· ``` ### Three ``` ··· ``` ## One column {: .-one-column} ### One ``` ··· ``` ================================================ FILE: chef.md ================================================ --- title: Chef category: Devops --- ### Install In your server: {: .-setup} ```bash $ sudo apt-get install curl ``` ```bash $ curl -L https://omnitruck.chef.io/install.sh | sudo bash Thank you for installing Chef! ``` ```bash $ chef-solo -v ... Chef: 14.5.33 ``` ### Start the cookbook ```bash wget http://github.com/chef-cookbooks/chef-repo/tarball/master -O - | tar xzf - --strip-components=1 ``` ### Knife ```bash $ knife supermarket download mysql ``` ### Invoking chef-solo ```bash $ chef-solo -c solo.rb -j web.json ``` ## Examples ### Simple compile-from-source ```ruby execute "tar --no-same-owner -zxf hi.tar.gz" do cwd "/usr/local/src" creates "/usr/local/src/node-v#{version}" end ``` ```ruby bash "compile" do cwd "/usr/local/src/node-v#{version}" code %[ PATH=/usr/local/bin:$PATH ./configure make ] creates "/usr/local/src/node-v#{version}/node" end ``` ### remote file ```ruby remote_file "/usr/local/src/hi.tar.gz" do source "http://..." checksum "ab83be..." mode 0644 action :create_if_missing end ``` ### ruby_block ```ruby ruby_block "name" do block { File.read ... } not_if { File.exists?(...) } end ``` ### Execute ```ruby execute "name" do cwd "..." environment({ "PATH" => "..." }) command "make install" creates "..." end ``` ### Conditions ```ruby creates "/usr/local/src/node-v#{version}/node" not_if { File.exists?('...') } ``` ## Also see * [Learn Chef Rally](https://learn.chef.io) _(learn.chef.io)_ * [install_from_source.rb recipe](https://github.com/mdxp/nodejs-cookbook/blob/master/recipes/install_from_source.rb) _(github.com)_ ================================================ FILE: chunky_png.md ================================================ --- title: Chunky PNG category: Ruby libraries --- ### Loading ```ruby image = ChunkyPNG::Image.from_file('file.png') ``` #### Alternate ways ```ruby image = ChunkyPNG::Image.from_blob(File.read('file.png')) image = ChunkyPNG::Image.from_io(io) ``` Loads from `file.png`. ### Saving ```ruby image.save('filename.png') ``` #### Alternate ways ```ruby File.open('newfile.png', 'wb') { |io| image.write(io) } binary_string = image.to_blob ``` Writes an image to `newfile.png`. ### Drawing ```ruby image[0, 0] = ChunkyPNG::Color.rgba(255, 0,0, 128) image.line(1, 1, 10, 1, ChunkyPNG::Color.from_hex('#aa007f')) ``` ### Canvas ```ruby crop(x, y, w, h) ``` ### Transforms ```ruby new_image = image.flip_horizontally.rotate_right ``` ================================================ FILE: cidr.md ================================================ --- title: CIDR category: Misc updated: 2018-05-14 --- ### CIDR ranges | Range | First IP | Last IP | | --- | --- | --- | | **10.0.0.0/24** | 10.0.0.0 | 10.0.0.255 | | **10.0.0.0/16** | 10.0.0.0 | 10.0.255.255 | | **10.0.0.0/8** | 10.0.0.0 | 10.255.255.255 | | **0.0.0.0/0** | (all) | (all) | ### Resources - [CIDR range calculator](http://ipaddressguide.com/cidr#range) _(ipaddressguide.com)_ ================================================ FILE: circle.md ================================================ --- title: CircleCI category: Devops --- ### About {: .-intro} - ### circle.yml * __machine__: adjusting the VM to your preferences and requirements * __checkout__: checking out and cloning your git repo * __dependencies__: setting up your project's language-specific dependencies * __database__: preparing the databases for your tests * __test__: running your tests * __deployment__: deploying your code to your web servers See: ### Sample ```yml ## Customize the test machine machine: timezone: America/Los_Angeles # Set the timezone # Version of ruby to use ruby: version: 1.8.7-p358-falcon-perf # Override /etc/hosts hosts: circlehost: 127.0.0.1 dev.mycompany.com: 127.0.0.1 # Add some environment variables environment: CIRCLE_ENV: test DATABASE_URL: postgres://ubuntu:@127.0.0.1:5432/circle_test ## Customize checkout checkout: post: - git submodule sync - git submodule update --init # use submodules ## Customize dependencies dependencies: pre: - npm install coffeescript # install from a different package manager - gem uninstall bundler # use a custom version of bundler - gem install bundler --pre override: - bundle install: # note ':' here timeout: 180 # fail if command has no output for 3 minutes # we automatically cache and restore many dependencies between # builds. If you need to, you can add custom paths to cache: cache_directories: - "custom_1" # relative to the build directory - "~/custom_2" # relative to the user's home directory ## Customize database setup database: override: # replace CircleCI's generated database.yml - cp config/database.yml.ci config/database.yml - bundle exec rake db:create db:schema:load ## Customize test commands test: override: - phpunit test/unit-tests # use PHPunit for testing post: - bundle exec rake jasmine:ci: # add an extra test type environment: RAILS_ENV: test RACK_ENV: test ## Customize deployment commands deployment: staging: branch: master heroku: appname: foo-bar-123 ## Custom notifications notify: webhooks: # A list of hashes representing hooks. Only the url field is supported. - url: https://someurl.com/hooks/circle ``` ================================================ FILE: claude-code.md ================================================ --- title: Claude Code category: AI tags: [Featured] updated: 2025-01-08 keywords: - AI assistant - CLI - Code generation - File operations - Interactive mode - Memory management --- ## Getting started {: .-three-column} ### Introduction {: .-intro} [Claude Code](https://claude.ai/code) is an AI-powered CLI assistant for software engineering tasks. This reference covers the most commonly used commands and features. - [Claude Code docs](https://docs.anthropic.com/en/docs/claude-code) _(docs.anthropic.com)_ - [GitHub repository](https://github.com/anthropics/claude-code) _(github.com)_ ### Installation & Setup ```bash # Install Claude Code npm install -g @anthropics/claude-code # Login with API key claude auth login # Check authentication status claude auth status ``` ### Quick Start ```bash # Start interactive session claude # Run a single command claude "help me write a Python function" # Resume previous session claude --resume ``` ## Core Commands {: .-three-column} ### Interactive Mode {: .-prime} | Command | Description | | -------------------------- | ---------------------------------- | | `claude` | Start interactive session | | `claude --resume` | Resume last session | | `claude --memory` | Start with memory enabled | | `/help` | Show help and available commands | | `/clear` | Clear current conversation | | `/exit` | Exit interactive mode | {: .-shortcuts} ### File Operations | Command | Description | | -------------------------- | ---------------------------------- | | `claude "read file.py"` | Read and analyze a file | | `claude "edit file.py"` | Edit an existing file | | `claude "create file.py"` | Create a new file | | `claude "fix tests"` | Fix failing tests | | `claude "refactor code"` | Refactor existing code | {: .-shortcuts} ### Git Integration | Command | Description | | ------------------------------- | ---------------------------------- | | `claude "create commit"` | Create git commit with message | | `claude "create PR"` | Create pull request | | `claude "review changes"` | Review git changes | | `claude "fix merge conflicts"` | Help resolve merge conflicts | {: .-shortcuts} ## Advanced Features {: .-three-column} ### Memory Management ```bash # Enable memory for current session claude --memory # View memory contents claude "show memory" # Clear memory claude "clear memory" ``` ### Extended Thinking ```bash # Enable deeper analysis claude --think # Complex problem solving claude "analyze this codebase and suggest improvements" ``` ### Image Analysis ```bash # Analyze screenshot or diagram claude "analyze this screenshot" --image path/to/image.png # Paste image from clipboard claude "explain this diagram" # then paste image ``` ## Slash Commands {: .-three-column} ### Session Management | Command | Description | | ------------ | ------------------------------------ | | `/help` | Show available commands | | `/clear` | Clear conversation history | | `/reset` | Reset conversation state | | `/exit` | Exit interactive mode | | `/version` | Show Claude Code version | {: .-shortcuts} ### Settings | Command | Description | | -------------- | ---------------------------------- | | `/settings` | Show current settings | | `/model` | Change AI model | | `/memory on` | Enable memory | | `/memory off` | Disable memory | {: .-shortcuts} ### Productivity | Command | Description | | -------------- | ---------------------------------- | | `/save` | Save conversation | | `/load` | Load previous conversation | | `/export` | Export conversation to file | {: .-shortcuts} ## Common Workflows {: .-three-column} ### Code Review ```bash # Review specific file claude "review this code for bugs" file.py # Review all changes claude "review my git changes" # Check code quality claude "suggest improvements" src/ ``` ### Testing ```bash # Generate tests claude "write tests for this function" # Fix failing tests claude "fix these test failures" # Test coverage analysis claude "analyze test coverage" ``` ### Documentation ```bash # Generate README claude "create README for this project" # Add code comments claude "add documentation to this function" # API documentation claude "generate API docs" ``` ### Debugging ```bash # Debug error claude "help debug this error: [error message]" # Performance analysis claude "why is this code slow?" # Code explanation claude "explain how this works" complex_function.py ``` ## IDE Integrations {: .-three-column} ### VS Code ```bash # Install VS Code extension code --install-extension anthropic.claude-code # Open in VS Code claude --vscode # VS Code commands Ctrl+Shift+P -> "Claude: Ask" Ctrl+Shift+P -> "Claude: Review" ``` ### Configuration ```bash # Set default editor claude config set editor code # Set working directory claude config set workdir /path/to/project # View all settings claude config list ``` ## Best Practices {: .-three-column} ### Effective Prompting ```bash # Be specific about requirements claude "write a Python function that validates email addresses with regex" # Provide context claude "in this Django project, add user authentication" # Ask for explanations claude "explain this code and suggest improvements" ``` ### Project Structure ```bash # Analyze entire project claude "analyze project structure and suggest improvements" # Focus on specific areas claude "review the database models in models.py" # Architecture decisions claude "should I use async here?" ``` ### Security ```bash # Security review claude "check this code for security vulnerabilities" # Best practices claude "make this code more secure" # Audit dependencies claude "review package.json for security issues" ``` ## CLI Options {: .-three-column} ### Global Options | Option | Description | | ------------------- | ---------------------------------- | | `--help` | Show help information | | `--version` | Show version number | | `--resume` | Resume previous session | | `--memory` | Enable memory | | `--think` | Enable extended thinking | | `--no-color` | Disable colored output | | `--verbose` | Verbose logging | {: .-shortcuts} ### Authentication | Command | Description | | -------------------- | ---------------------------------- | | `claude auth login` | Login with API key | | `claude auth logout` | Logout current session | | `claude auth status` | Check authentication status | | `claude auth whoami` | Show current user info | {: .-shortcuts} ### Configuration | Command | Description | | ---------------------- | -------------------------------- | | `claude config set` | Set configuration value | | `claude config get` | Get configuration value | | `claude config list` | List all configuration | | `claude config reset` | Reset to default configuration | {: .-shortcuts} ## Troubleshooting {: .-three-column} ### Common Issues ```bash # Clear authentication claude auth logout && claude auth login # Reset configuration claude config reset # Clear cache claude --clear-cache # Debug mode claude --verbose --debug ``` ### Network Issues ```bash # Check connectivity claude "test connection" # Use proxy claude --proxy http://proxy:8080 # Timeout settings claude config set timeout 30 ``` ### Memory Issues ```bash # Clear memory claude "clear memory" # Disable memory claude --no-memory # Memory usage claude "show memory usage" ``` ## Environment Variables | Variable | Description | | --------------------- | ---------------------------------- | | `CLAUDE_API_KEY` | API key for authentication | | `CLAUDE_MODEL` | Default model to use | | `CLAUDE_MEMORY` | Enable memory by default | | `CLAUDE_EDITOR` | Default text editor | | `CLAUDE_WORKDIR` | Default working directory | | `NO_COLOR` | Disable colored output | ## Also see {: .-one-column} - [Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code) _(docs.anthropic.com)_ - [GitHub repository](https://github.com/anthropics/claude-code) _(github.com)_ - [Claude API docs](https://docs.anthropic.com/en/api) _(docs.anthropic.com)_ - [Community discussions](https://github.com/anthropics/claude-code/discussions) _(github.com)_ ================================================ FILE: clip.md ================================================ --- title: Command Line Interface Pages category: CLI updated: 2023-02-23 keywords: - CLI --- ### Page layout ```md # command > Some command description > More information: https://some/link/to/url - Some code description: `command argument1 argument2` ``` ### [Primitive placeholders](https://github.com/command-line-interface-pages/syntax/blob/main/type-specific/cli.md#primitive-placeholders) ```md - Delay in [s]econds: `sleep {int seconds: 2}s` ``` ### [Primitive repeated placeholders](https://github.com/command-line-interface-pages/syntax/blob/main/type-specific/cli.md#repeated-primitive-placeholders) ```md - [c]reate an archive and write it to a [f]ile: `tar {option mode: --create, -c} {option: --file, -f} {/?file archive: target.tar} {/?path+ input}` ``` ### Also see {: .-one-column} * [Render](https://github.com/command-line-interface-pages/v2-tooling/tree/main/clip-view) * [Page's repository](https://github.com/command-line-interface-pages/cli-pages) * [Syntax](https://github.com/command-line-interface-pages/syntax/blob/main/base.md) ================================================ FILE: co.md ================================================ --- title: co category: JavaScript libraries updated: 2017-10-27 weight: -1 intro: | [co](https://github.com/tj/co) allows you to use generators to manage async flow. --- [co]: https://github.com/tj/co [thunkify]: https://github.com/visionmedia/node-thunkify [unyield]: https://github.com/MatthewMueller/unyield [thenify]: https://www.npmjs.com/package/thenify [mz]: https://www.npmjs.com/package/mz ### Running generators ```js co(function * () { yield Promise.resolve(true) }).then(...) ``` A generator can `yield` a thunk or promise. Using `co()` will immediately invoke the block inside it. ### Generator → Promise ```js var fn = co.wrap(function * (val) { return yield Promise.resolve(val) }) fn().then(...) ``` Use `co.wrap()`. Most of the time, you'll be using co.wrap. ### Generator → Node callback ```js var get = unyield(function * () { }) get(function (err, res) { ... }) ``` Use [unyield]. (You can [thunkify] this later) ### Node callback → Thunk ```js var readFile = thunkify(fs.readFile) co(function * () { var data = yield readFile('index.txt', 'utf-8') }) ``` Use [thunkify]. You can yield this. You can also use [thenify] too. ### Using Node.js API ```js var readFile = require('mz/fs').readFile var getLines = co.wrap(function * (filename) { var data = yield readFile(filename, 'utf-8') return data.split('\n') }) getLines('file.txt').then((lines) => { ... }) ``` Use [mz] for async Node.js API. You can also either [thunkify] or [thenify] them instead. ================================================ FILE: command_line.md ================================================ --- title: Command line stuff --- ## List (ls) {: .-three-column} ### Usage ls [options] [paths] ### Format | Switch | Description | |---|---| | `-1` | One entry per line | | `-l` | Long view | | `-o` | Long view (without groups) | | `-C` | Multicolumn (sorted horizontally) | | `-x` | Multicolumn (sorted vertically) | |--- | `-F` | Add / after directories | | `-G` | Color | ### Options | `-R` | Recurse | | `-a` | Include hidden (dotfiles) | | `-A` | Include hidden (but not . and ..) | ### Sorting | Switch | Description | |---|---| | `-r` | reverse order | | `-S` | sort by size | | `-t` | sort by time modified | | `-u` | sort by time accessed | | `-U` | sort by time created | | `-c` | sort by time status was changed | |--- | `-h` | Human-readable size (3k) | ## Tail {: .-three-column} ### Usage tail [-F | -f | -r] [-bN | -cN | -nN] [file ...] ### Modes | `-f` | follow | | `-F` | follow by filename (accounts for log rotation) | | `-r` | Reverse order | ### Options | `-bN` | N*512 bytes | | `-cN` | N bytes | | `-nN` | N lines | | `+N` | Start from line N |
## Sudo {: .-three-column} ### Usage ``` sudo [options] ``` ### Listing | `-l` | List allowed commands | ### Options | `-A` | Use $SUDO_ASKPASS | | `-b` | Run in background | | `-E` | Preserve environment | | `-H` | use target's $HOME | | `-n` | Don't prompt for password | | `-P` | Preserve group vector | | `-S` | Read password from stdin | ### File descriptors | `-C fd` | Close all open file descriptors | ### Prompt | `-p prompt` | Custom prompt (-p "%p password:") | ### Interactive | Switch | Description | |---|---| | `-i [cmd]` | Interactive shell without variables | | `-s [cmd]` | Interactive shell | |---- | `-u user` | run as this user | | `-g group` | run as this group | ### Timestamp | `-v` | revalidate timestamp for 5 mins | | `-k` | invalidate timestamp | | `-K` | just like -k | ## wc (Word count) {: .-three-column} ### wc ``` ... | wc [options] ``` ### Options | `-c` | Bytes | | `-l` | Lines | | `-m` | Characters (incl multi-byte) | | `-w` | Words | ## Grep {: .-three-column} ### Usage ``` grep [options] [pattern] [file ...] ``` ### Options | Switch | Description | |---|---| | `-A num` | Print `num` lines of training context | |---- | `-G` | --basic-regexp (default) | | `-E` | --extended-regexp | | `-P` | --perl-regexp | |---- | `-f file` | --file (Get patterns for file) | | `-F` | --fixed-strings | |---- | `-h` | --no-filename | | `-H` | --with-filename | |---- | `-l` | --files-with-matches (just print filenames) | | `-L` | --files-without-match | |---- | `-r, -R` | --recursive | | `-v` | --invert-match | | `-i` | --ignore-case | ### Synonyms egrep => grep -E fgrep => grep -F ## Other recipes {: .-three-column} ### Search-and-replace in all files perl -p -i -e 's/hello/HELLO/g' **/* ================================================ FILE: commander.js.md ================================================ --- title: Commander.js category: JavaScript libraries --- ### About {: .-intro} - ### Initialize var cli = require('commander'); ### Options cli .version(require('../package').version) .usage('[options] ') .option('-w, --words ', 'generate words') .option('-i, --interval ', 'interval [1000]', 1000) .option('-s, --symbols', 'include symbols') .parse(process.argv); ### Help .on('--help', function() { console.log(''); }) ### Commands cli.outputHelp(); cli.args == ["hello"]; ### Other useful things process.exit(0); ================================================ FILE: composer.md ================================================ --- title: composer category: CLI weight: -1 authors: - github: benolot updated: 2020-02-23 description: | Basic guide on how to use Composer, the PHP Package manager. --- All composer commands, depending on your install, may need to use `php composer.phar` in the install folder for composer, instead of global/plain `composer`. ### Installing dependencies | Command | Description | | --- | --- | | `composer install` | Downloads and installs all the libraries and dependencies outlined in the `composer.lock` file. If the file does not exist it will look for composer.json and do the same, creating a `composer.lock` file. | | --- | --- | | `composer install --dry-run` | Simulates the install without installing anything | This command doesn't change any file. If `composer.lock` is not present, it will create it. `composer.lock` **should always** be committed to the repository. It has all the information needed to bring the local dependencies to the last committed state. If that file is modified on the repository, you will need to run `composer install` again after fetching the changes to update your local dependencies to those on that file. ### Updating packages | Command | Description | | --- | --- | | `composer update` | Updates all packages | | `composer update --with-dependencies` | Updates all packages and its dependencies | | --- | --- | | `composer update vendor/package` | Updates a certain `package` from `vendor` | | `composer update vendor/*` | Updates all packages from `vendor` | | `composer update --lock` | Updates `composer.lock` hash without updating any packages | This command changes only the `composer.lock` file. ### Updating autoloader | Command | Description | | --- | --- | | `composer dumpautoload -o` | Generates optimized autoload files | ### Adding packages | Command | Description | | --- | --- | | `composer require vendor/package` | Adds `package` from `vendor` to composer.json's `require` section and installs it | | --- | --- | | `composer require vendor/package --dev` | Adds `package` from `vendor` to composer.json's `require-dev` section and installs it. | This command changes both the `composer.json` and `composer.lock` files. ### Passing versions | Command | Description | | ----------------------------------------------- | ---------------------------------------- | | `composer require vendor/pkg "1.3.2"` | Installs `1.3.2` | | `composer require vendor/pkg ">=1.3.2"` | Above or equal `1.3.2` | | `composer require vendor/pkg "<1.3.2"` | Below `1.3.2` | | `composer require vendor/pkg "1.3.*"` | Latest of `>=1.3.0 <1.4.0` | | `composer require vendor/pkg "~1.3.2"` | Latest of `>=1.3.2 <1.4.0` | | `composer require vendor/pkg "~1.3"` | Latest of `>=1.3.0 <2.0.0` | | `composer require vendor/pkg "^1.3.2"` | Latest of `>=1.3.2 <2.0.0` | | `composer require vendor/pkg "^1.3"` | Latest of `>=1.3.0 <2.0.0` | | `composer require vendor/pkg "^0.3.2"` | Latest of `>=0.3.0 <0.4.0` (for pre-1.0) | | `composer require vendor/pkg "dev-BRANCH_NAME"` | From the branch `BRANCH_NAME` | ### Removing packages | Command | Description | | --- | --- | | `composer remove vendor/package` | Removes `vendor/package` from composer.json and uninstalls it | This command changes both the `composer.json` and `composer.lock` files. ### Verifying | Command | Description | | ---------------------------- | -------------------------------------------------------------------------- | | `composer outdated --direct` | Show only packages that are outdated directly required by the root package | ================================================ FILE: cordova.md ================================================ --- title: Apache Cordova intro: | A quick reference to common [Apache Cordova](https://cordova.apache.org/) commands. --- ### Common commands ``` cordova plugin ls cordova plugin search facebook cordova plugin add com.phonegap.plugins.facebookconnect ``` ``` cordova platform add ios cordova platform ls cordova platform update ios cordova platform check ``` ### Common plugins Some commonly-used plugins: - [org.apache.cordova.console](https://github.com/apache/cordova-plugin-console) - [org.apache.cordova.inappbrowser](https://github.com/apache/cordova-plugin-inappbrowser) - [org.apache.cordova.statusbar](https://github.com/apache/cordova-plugin-statusbar) - org.apache.cordova.splashscreen Also: - com.phonegap.plugins.facebookconnect ================================================ FILE: cron.md ================================================ --- title: Cron category: CLI updated: 2024-03-17 weight: -3 --- ## Format {: .-two-column} ### Format ``` Min Hour Day Mon Weekday ``` {: .-setup} ``` * * * * * command to be executed ``` ``` ┬ ┬ ┬ ┬ ┬ │ │ │ │ └─ Weekday (0=Sun .. 6=Sat) │ │ │ └────── Month (1..12) │ │ └─────────── Day (1..31) │ └──────────────── Hour (0..23) └───────────────────── Minute (0..59) ``` {: .-setup.-box-chars} ### Operators | Operator | Description | | --- | --- | | `*` | all values | | `,` | separate individual values | | `-` | a range of values | | `/` | divide a value into steps | ### Special strings | String | Description | | --- | --- | | `@reboot` | every rebot | | `@hourly` | once every hour - same as `0 * * * *` | | `@daily` | once every day - same as `0 0 * * *` | | `@midnight` | once every midnight - same as `@daily` | | `@weekly` | once every week - same as `0 0 * * 0` | | `@monthly` | once every month - same as `0 0 1 * *` | | `@yearly` | once every year - same as `0 0 1 1 *` | ### Examples | Example | Description | | --- | --- | | `0 * * * *` | every hour | | `*/15 * * * *` | every 15 mins | | `0 */2 * * *` | every 2 hours | | `0 18 * * 0-6` | every week Mon-Sat at 6pm | | `10 2 * * 6,7` | every Sat and Sun on 2:10am | | `0 0 * * 0` | every Sunday midnight | ### Crontab ```bash # Adding tasks easily echo "@reboot echo hi" | crontab # Open in editor - optional for another user crontab -e [-u user] # List tasks - optional for another user crontab -l [-u user] # Delete crontab file - optional for another user crontab -r [-u user] ``` ================================================ FILE: csharp7.md ================================================ --- title: C# 7 category: C-like updated: 2018-12-06 prism_languages: [csharp] description: | A quick overview of C# 7 --- ### Out Variables ```csharp public void PrintCoordinates(Point p) { p.GetCoordinates(out int x, out int y); WriteLine($"({x}, {y})"); } ``` `out` is used to declare a variable at the point where it is passed as an argument. ### Pattern Matching #### Is-expressions with patterns ```csharp public void PrintStars(object o) { if (o is null) return; // constant pattern "null" if (!(o is int i)) return; // type pattern "int i" WriteLine(new string('*', i)); } ``` #### Switch statements with patterns ```csharp switch(shape) { case Circle c: WriteLine($"circle with radius {c.Radius}"); break; case Rectangle s when (s.Length == s.Height): WriteLine($"{s.Length} x {s.Height} square"); break; case Rectangle r: WriteLine($"{r.Length} x {r.Height} rectangle"); break; default: WriteLine(""); break; case null: throw new ArgumentNullException(nameof(shape)); } ``` ### Tuples #### Tuple type ```csharp (string, string, string) LookupName(long id) // tuple return type { ... // retrieve first, middle and last from data storage return (first, middle, last); // tuple literal } ``` ```csharp var names = LookupName(id); WriteLine($"found {names.Item1} {names.Item3}."); ``` #### Tuple elements with name ```csharp (string first, string middle, string last) LookupName(long id) // tuple elements have names ``` ```csharp var names = LookupName(id); WriteLine($"found {names.first} {names.last}."); ``` #### Tuple Literals ```csharp return (first: first, middle: middle, last: last); // named tuple elements in a literal ``` #### Tuple Deconstruction ```csharp (var first, var middle, var last) = LookupName(id1); WriteLine($"found {first} {last}."); ``` or ```csharp var (first, middle, last) = LookupName(id1); // var outside ``` or ```csharp (first, middle, last) = LookupName(id2); // assign onto existing variables ``` ### Local Functions ```csharp public int Fibonacci(int x) { if (x < 0) throw new ArgumentException("Less negativity please!", nameof(x)); return Fib(x).current; (int current, int previous) Fib(int i) { if (i == 0) return (1, 0); var (p, pp) = Fib(i - 1); return (p + pp, p); } } ``` ### Literal Improvements #### Digit Separator inside numbers literals ```csharp var d = 123_456; var x = 0xAB_CD_EF; ``` #### Binary Literals ```csharp var b = 0b1010_1011_1100_1101_1110_1111; ``` ### Ref Returns and Locals ```csharp public ref int Find(int number, int[] numbers) { for (int i = 0; i < numbers.Length; i++) { if (numbers[i] == number) { return ref numbers[i]; // return the storage location, not the value } } throw new IndexOutOfRangeException($"{nameof(number)} not found"); } int[] array = { 1, 15, -39, 0, 7, 14, -12 }; ref int place = ref Find(7, array); // aliases 7's place in the array place = 9; // replaces 7 with 9 in the array WriteLine(array[4]); // prints 9 ``` ### More Expression Bodied Members C# 7.0 adds accessors, constructors and finalizers to the list of things that can have expression bodies: ```csharp class Person { private static ConcurrentDictionary names = new ConcurrentDictionary(); private int id = GetId(); public Person(string name) => names.TryAdd(id, name); // constructors ~Person() => names.TryRemove(id, out *); // destructors public string Name { get => names[id]; // getters set => names[id] = value; // setters } } ``` ### Throw Expressions ```csharp class Person { public string Name { get; } public Person(string name) => Name = name ?? throw new ArgumentNullException(name); public string GetFirstName() { var parts = Name.Split(" "); return (parts.Length > 0) ? parts[0] : throw new InvalidOperationException("No name!"); } public string GetLastName() => throw new NotImplementedException(); } ``` ================================================ FILE: css-antialias.md ================================================ --- title: CSS antialiasing category: CSS updated: 2017-10-13 intro: | Here's a 4-line snippet on how to get beautiful, antialiased text with CSS. --- ### Antialias {: .-prime} ```css * { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } ``` ### Support * Firefox 25+ on OSX * Webkits (Chrome, Safari, etc) ## References {: .-one-column} * [maxvoltar.com](http://maxvoltar.com/archive/-webkit-font-smoothing) * [maximilianhoffman.com](http://maximilianhoffmann.com/posts/better-font-rendering-on-osx) * [ilikekillnerds.com](http://ilikekillnerds.com/2010/12/a-solution-to-stop-font-face-fonts-looking-bold-on-mac-browsers/) {: .-also-see} ================================================ FILE: css-flexbox.md ================================================ --- title: CSS flexbox category: CSS updated: 2020-06-13 prism_languages: [css] weight: -3 --- ### Simple example ```css .container { display: flex; } ``` ```css .container > div { flex: 1 1 auto; } ``` ### Container ```css .container { ``` {: .-setup} ```css display: flex; display: inline-flex; ``` ```css flex-direction: row; /* ltr - default */ flex-direction: row-reverse; /* rtl */ flex-direction: column; /* top-bottom */ flex-direction: column-reverse; /* bottom-top */ ``` ```css flex-wrap: nowrap; /* one-line */ flex-wrap: wrap; /* multi-line */ ``` ```css align-items: flex-start; /* vertical-align to top */ align-items: flex-end; /* vertical-align to bottom */ align-items: center; /* vertical-align to center */ align-items: stretch; /* same height on all (default) */ ``` ```css justify-content: flex-start; /* [xxx ] */ justify-content: center; /* [ xxx ] */ justify-content: flex-end; /* [ xxx] */ justify-content: space-between; /* [x x x] */ justify-content: space-around; /* [ x x x ] */ justify-content: space-evenly; /* [ x x x ] */ ``` ```css } ``` {: .-setup} ### Child ```css .container > div { ``` {: .-setup} ```css /* This: */ flex: 1 0 auto; /* Is equivalent to this: */ flex-grow: 1; flex-shrink: 0; flex-basis: auto; ``` ```css order: 1; ``` ```css align-self: flex-start; /* left */ margin-left: auto; /* right */ ``` ```css } ``` {: .-setup} ## Tricks ### Vertical center ```css .container { display: flex; } .container > div { width: 100px; height: 100px; margin: auto; } ``` ### Vertical center (2) ```css .container { display: flex; align-items: center; /* vertical */ justify-content: center; /* horizontal */ } ``` ### Reordering ```css .container > .top { order: 1; } .container > .bottom { order: 2; } ``` ### Mobile layout ```css .container { display: flex; flex-direction: column; } .container > .top { flex: 0 0 100px; } .container > .content { flex: 1 0 auto; } ``` A fixed-height top bar and a dynamic-height content area. ### Table-like ```css .container { display: flex; } /* the 'px' values here are just suggested percentages */ .container > .checkbox { flex: 1 0 20px; } .container > .subject { flex: 1 0 400px; } .container > .date { flex: 1 0 120px; } ``` This creates columns that have different widths, but size accordingly according to the circumstances. ### Vertical ```css .container { align-items: center; } ``` Vertically-center all items. ### Left and right ```css .menu > .left { align-self: flex-start; } .menu > .right { align-self: flex-end; } ``` ## References {: .-one-column} * [MDN: Using CSS flexbox](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Flexible_boxes) * [Ultimate flexbox cheatsheet](https://www.sketchingwithcss.com/samplechapter/cheatsheet.html) ================================================ FILE: css-grid.md ================================================ --- title: CSS Grid category: CSS updated: 2019-08-23 prism_languages: [css] --- ### Container ```css .grid-container { ``` {: .-setup} ```css /* Display properties */ display: grid; display: inline-grid; ``` ```css /* Columns and rows */ grid-template-columns: 1rem 2rem 1rem; /* Measurement units */ grid-template-columns: 25% 50% 25%; /* Percentage units */ grid-template-columns: 1rem auto 1rem 2fr; /* Fill remaining widths with auto or fr units */ grid-template-columns: repeat(12, 1fr); /* Repeat columns without needing to write them */ grid-template-columns: subgrid; /* Use column tracks defined on parent grid */ grid-template-rows: 1rem 10% auto repeat(5, 10px); /* Mix any group, same rules work for rows */ grid-template-rows: subgrid; /* Use row tracks defined on parent grid */ ``` ```css /* Automatic columns and rows */ grid-auto-columns: 10px; /* No matter how many columns of content end up in the grid, each column will be this same width */ grid-auto-rows: 1rem; /* No matter how many rows of content end up in the grid, each row will be this same height */ ``` ```css /* Areas */ grid-template-areas: "header header" "main aside" "footer footer"; /* Grid-style */ grid-template-areas: "header header" "main aside" "footer footer"; /* Inline-style */ ``` ```css /* Template shorthand */ grid-template: "header header" auto "main aside" 100vh "footer footer" 10rem / 80% 20%; /* The above is the same as below long-hand */ grid-template-columns: 80% 20%; grid-template-rows: auto 100vh 10rem; grid-template-areas: "header header" "main aside" "footer footer"; ``` ```css /* Gaps */ grid-row-gap: 1rem; grid-column-gap: 0.5rem; /* Define values separately */ grid-gap: 1rem 0.5rem; /* Short-hand for row / column */ grid-gap: 1rem; /* Gap in both dimensions */ ``` ```css /* Item justification (horizontal or column alignment) */ justify-items: start; /* Align items to the left */ justify-items: center; /* Align items centered within its column */ justify-items: end; /* Align items to the right */ justify-items: stretch; /* (default) Fills available area (horizontally) */ ``` ```css /* Item alignment (vertical or row alignment) */ align-items: start; /* Align items to the top */ align-items: center; /* Align items centered within its row */ align-items: end; /* Align items to the bottom */ align-items: stretch; /* (default) Fills available area (vertically) */ ``` ```css /* Place item shorthand */ place-items: start stretch; /* The above is the same as below long-hand */ align-items: start; justify-items: stretch; ``` ```css /* Content justification (horizontal or column alignment) */ justify-content: start; /* Align content to the left */ justify-content: center; /* Align content centered horizontally within the grid */ justify-content: end; /* Align content to the right */ justify-content: stretch; /* (default) Fills available area (horizontally) */ justify-content: space-around; /* Chooses a space for both sides of the columns like a left and right margin */ justify-content: space-between; /* Chooses a space to go between columns, no margins on outside of content */ justify-content: space-evenly; /* Chooses a space that goes between all columns and edges consistently */ ``` ```css /* Content alignment (horizontal or column alignment) */ align-content: start; /* Align content to the top */ align-content: center; /* Align content centered vertically within the grid */ align-content: end; /* Align content to the bottom */ align-content: stretch; /* (default) Fills available area (vertically) */ align-content: space-around; /* Chooses a space for the top and bottom of the rows like a top and bottom margin */ align-content: space-between; /* Chooses a space to go between rows, no margins on outside of content */ align-content: space-evenly; /* Chooses a space that goes between all rows and edges consistently */ ``` ```css /* Place item shorthand */ place-content: center start; /* The above is the same as below long-hand */ align-content: center; justify-content: start; ``` ```css /* Automatic grid positioning */ grid-auto-flow: row; /* Left-to-right rows, then top-to-bottom*/ grid-auto-flow: column; /* Top-to-bottom columns, then left-to-right */ grid-auto-flow: dense; /* Responds with best-guess on left-to-right, top-to-bottom order with advanced layouts */ ``` ```css /* There is one final shorthand for all container properties in one */ /* Explicit grid columns, rows, and areas */ grid: "header header" auto "main aside" 100vh "footer footer" 10rem / 80% 20%; /* You can include a template as the only value, which is equivalent to below */ grid-template: "header header" auto "main aside" 100vh "footer footer" 10rem / 80% 20%; /* Which is again equivalent to below */ grid-template-columns: 80% 20%; grid-template-rows: auto 100vh 10rem; grid-template-areas: "header header" "main aside" "footer footer"; /* Automatic grid flows */ grid: 1rem / auto-flow dense 1fr; /* You can include rows, a flow, and automatic columns, which is equivalent to below */ grid-template-rows: 1rem; grid-auto-flow: dense; grid-auto-columns: 1fr; grid: auto-flow dense 1rem / repeat(10, 10%); /* Conversely, you can do the same thing with automatic rows, and defined columns */ grid-auto-flow: dense; grid-auto-rows: 1rem; grid-template-columns: repeat(10, 10%); ``` ```css } ``` {: .-setup} ### Child ```css .grid-child { ``` {: .-setup} ```css /* Column position */ grid-column-start: 1; grid-column-end: 2; grid-column: 1 / 2; /* Short hand */ grid-column: 1 / span 2; /* Span 2 columns without explicitly defining an endpoint */ grid-column: 1; /* Start in and occupy a single column */ ``` ```css /* Row position */ grid-row-start: 2; grid-row-end: 4; grid-row: 2 / 4; /* Short hand */ grid-row: 2 / span 3;/* Span 3 rows without explicitly defining an endpoint */ grid-row: 1; /* Start in and occupy a single row */ ``` ```css /* Area positioning */ grid-area: header; /* You can use a named grid area from the container */ grid-area: 2 / 1 / 4 / 2; /* Or you can use positioning. This is equivalent to... */ grid-row-start: 2; grid-column-start: 1; grid-row-end: 4; grid-column-end: 2; ``` ```css /* Self justification (horizontal or column alignment) */ justify-self: start; /* Align item to the left */ justify-self: center; /* Align item centered within its column */ justify-self: end; /* Align item to the right */ justify-self: stretch; /* (default) Fills available area (horizontally) */ ``` ```css /* Self alignment (vertical or row alignment) */ align-self: start; /* Align item to the top */ align-self: center; /* Align item centered within its row */ align-self: end; /* Align item to the bottom */ align-self: stretch; /* (default) Fills available area (vertically) */ ``` ```css /* Placement shorthand */ place-self: start stretch; /* The above is the same as below long-hand */ align-self: start; justify-self: stretch; ``` ```css } ``` {: .-setup} ## References {: .-one-column} * [GRID: A simple visual cheatsheet](http://grid.malven.co/) * [CSS Tricks: A Complete Guide to Grid](https://css-tricks.com/snippets/css/complete-guide-grid/) * [Browser support](https://caniuse.com/#feat=css-grid) ================================================ FILE: css-system-font-stack.md ================================================ --- title: "CSS system fonts" category: CSS weight: -3 tags: [Featurable] --- ### System fonts ```css font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; ``` This uses whatever system font is available. See: [System shock - Designing Medium](https://medium.design/system-shock-6b1dc6d6596f?gi=90078e194544) _(medium.com)_ ### Explanation | Font | OS | | ---- | -- | | `-apple-system` | OS X (10.11+), iOS (9+) | | `BlinkMacSystemFont` | OS X, Chrome | | `Segoe UI` | Windows | | `Roboto` | Android 4.0+ | | `Oxygen` | Linux, KDE | | `Ubuntu` | Linux, Ubuntu | | `Cantarell` | Linux, GNOME | | `Fira Sans` | Firefox OS | | `Droid Sans` | Android (until 3.2) | | `Helvetica Neue` | OS X (10.9) | ================================================ FILE: css-tricks.md ================================================ --- title: CSS tricks category: CSS --- ### Heading kerning pairs and ligature ```css h1, h2, h3 { text-rendering: optimizeLegibility; } ``` ### Native-like iOS scrolling ```css -webkit-overflow-scrolling: touch; overflow-y: auto; ``` ### Gradient text ```css background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#333)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; ``` ### Text stroke ```css -webkit-text-stroke: 3px black; ``` See: [Introducing text stroke](http://www.webkit.org/blog/85/introducing-text-stroke/) ### iOS Scrolling prevention ```css document.ontouchstart = (e) -> $pane = $(e.target).closest('.scrollable>div') if $pane.length is 0 or $pane[0].scrollHeight <= $pane.innerHeight() e.preventDefault() ``` ```scss %ios-scrollable { &, >div { -webkit-overflow-scrolling: touch; overflow: auto; } >div { position: absolute; top: 0; left: 0; right: 0; bottom: 0; } } ``` Relevant in iOS6, but maybe not anymore. ### UIWebView optimizations ```css * { -webkit-tap-highlight-color: rgba(0,0,0,0); -webkit-user-select: none; /* disable text select */ -webkit-touch-callout: none; /* disable callout, image save panel (popup) */ -webkit-tap-highlight-color: transparent; /* "turn off" link highlight */ } a:focus { outline: 0; // Firefox (remove border on link click) } ``` See: See: Browser hacks ------------- {: .-three-column} ### Disclaimer Not recommended, but here they are if you ever need them. Note that vendor prefixes may go away eventually. ### Mozilla-only ```css @-moz-document url-prefix() { .box { color: blue; } } ``` ### Webkit-only ```css @media all and (-webkit-min-device-pixel-ratio: 1) { } ``` ================================================ FILE: css.md ================================================ --- title: CSS category: CSS weight: -1 keywords: - "margin, padding, border" - "div, .class, #id, [attr]" - "font, background" - "display: block, inline, flex" - Selectors - Properties --- ## Basics {: .-three-column} ### Selectors ```css .class { font-weight: bold; } ``` {: .-setup} | Selector | Description | | ----------------- | ------------ | | `*` | All elements | | `div` | Element | | `.class` | Class | | `#id` | ID | | `[disabled]` | Attribute | | `[role="dialog"]` | Attribute | ### Combinators | Selector | Description | | ------------------- | ----------------- | | `.parent .child` | Descendant | | `.parent > .child` | Direct descendant | | `.child + .sibling` | Adjacent sibling | | `.child ~ .sibling` | Far sibling | | `.class1.class2` | Have both classes | ### Attribute selectors | Selector | Description | | ------------------ | ----------------------------------- | | `[role="dialog"]` | `=` Exact | | `[class~="box"]` | `~=` Has word | | `[class|="box"]` | `|=` Exact or prefix (eg, `value-`) | | `[href$=".doc"]` | `$=` Ends in | | `[href^="/index"]` | `^=` Begins with | | `[class*="-is-"]` | `*=` Contains | ### Pseudo-classes | Selector | Description | | -------------------- | ------------------------------------------ | | `:target` | eg, `h2#foo:target` | | --- | --- | | `:focus` | | | `:active` | | | --- | --- | | `:nth-child(3)` | 3rd child | | `:nth-child(3n+2)` | 2nd child in groups of 3 | | `:nth-child(-n+4)` | | | --- | --- | | `:nth-last-child(2)` | | | `:nth-of-type(2)` | | | --- | --- | | `:checked` | Checked inputs | | `:disabled` | Disabled elements | | `:default` | Default element in a group | | --- | --- | | `:empty` | Elements without children | ### Pseudo-class variations | Selector | | ----------------- | | `:first-of-type` | | `:last-of-type` | | `:nth-of-type(2)` | | `:only-of-type` | | --- | | `:first-child` | | `:last-child` | | `:nth-child(2)` | | `:only-child` | {: .-left-align} ## Fonts {: .-left-reference} ### Properties | Property | Description | | ------------------ | ------------------------------------ | | `font-family:` | `, ` | | `font-size:` | `` | | `letter-spacing:` | `` | | `line-height:` | `` | | --- | --- | | `font-weight:` | `bold` `normal` | | `font-style:` | `italic` `normal` | | `text-decoration:` | `underline` `none` | | --- | --- | | `text-align:` | `left` `right` `center` `justify` | | `text-transform:` | `capitalize` `uppercase` `lowercase` | {: .-key-values} ### Shorthand {: .-prime} | | style | weight | size (required) | | line-height | family | | ------- | -------- | ------ | --------------- | --- | ----------- | ----------------- | | `font:` | `italic` | `400` | `14px` | `/` | `1.5` | `sans-serif` | | | style | weight | size (required) | | line-height | family (required) | {: .-css-breakdown} ### Example ```css font-family: Arial; font-size: 12pt; line-height: 1.5; letter-spacing: 0.02em; color: #aa3322; ``` ### Case ```css text-transform: capitalize; /* Hello */ text-transform: uppercase; /* HELLO */ text-transform: lowercase; /* hello */ ``` ## Background {: .-left-reference} ### Properties | Property | Description | | ------------------------ | ---------------------------------------- | | `background:` | _(Shorthand)_ | | --- | --- | | `background-color:` | `` | | `background-image:` | `url(...)` | | `background-position:` | `left/center/right` `top/center/bottom` | | `background-size:` | `cover` `X Y` | | `background-clip:` | `border-box` `padding-box` `content-box` | | `background-repeat:` | `no-repeat` `repeat-x` `repeat-y` | | `background-attachment:` | `scroll` `fixed` `local` | {: .-key-values} ### Shorthand | | color | image | positionX | positionY | | size | repeat | attachment | | ------------- | ------ | ------------- | --------- | --------- | --- | -------------- | ----------- | ---------- | | `background:` | `#ff0` | `url(bg.jpg)` | `left` | `top` | `/` | `100px` `auto` | `no-repeat` | `fixed;` | | `background:` | `#abc` | `url(bg.png)` | `center` | `center` | `/` | `cover` | `repeat-x` | `local;` | | | color | image | positionX | positionY | | size | repeat | attachment | {: .-css-breakdown} ### Multiple backgrounds ```css background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('background.jpg') center center / cover, #333; ``` ## Animation {: .-left-reference} ### Properties | Property | Value | | ---------------------------- | -------------------------------------------------------- | | `animation:` | _(shorthand)_ | | `animation-name:` | `` | | `animation-duration:` | `
``` ```bash -E, --cert # --cert: Client cert file --cert-type # der/pem/eng -k, --insecure # for self-signed certs ``` ## Examples {: .-one-column} ```bash # Post data: curl -d password=x http://x.com/y ``` ```bash # Auth/data: curl -u user:pass -d status="Hello" http://twitter.com/statuses/update.xml ``` ```bash # multipart file upload curl -v --include --form key1=value1 --form upload=@localfilename URL # multipart form: send data from text field and upload file curl -F person=anonymous -F secret=@file.txt http://example.com/submit.cgi ``` ```bash # Use Curl to Check if a remote resource is available # details: https://matthewsetter.com/check-if-file-is-available-with-curl/ curl -o /dev/null --silent -Iw "%{http_code}" https://example.com/my.remote.tarball.gz ``` ================================================ FILE: datetime.md ================================================ --- title: Date & time formats weight: -5 updated: 2017-11-27 tags: [Featurable] --- ## Common time formats {: .-one-column} - [UNIX strftime](./strftime) - Used by Ruby, `date`, and more - [Moment.js](./moment#formatting) - Used by Moment.js, date-fns, and more {% include common/strftime_format.md title="strftime format" %} {% include common/moment_format.md title="Moment.js format" %} ================================================ FILE: deis.md ================================================ --- title: Deis category: Devops --- ### Deploy ``` deis create app-name git push deis master deis open ``` ### Deploy dockerfile ```sh $ deis create app-name $ deis pull redis:latest Creating build... done, v2 # default process type is `cmd` ``` ### Config ``` deis config:list deis config:set FOO=bar BAZ=foo deis config:unset FOO deis config:pull # writes to .env deis config:push # reads from .env ``` ### Managing instances ``` deis logs deis run rake db:migrate deis ps ``` ### Custom domains ``` deis domains:list deis domains:add www.myapp.com deis domains:remove www.myapp.com ``` ### Limits ```sh deis limits:set web=1G deis limits:set web=1024 --cpu # (`web` is a process type) ``` ### Sharing ``` deis perms:create otheruser ``` ### SSL ``` deis certs:add server.crt server.key ``` See: [SSL](http://docs.deis.io/en/latest/using_deis/app-ssl/) ================================================ FILE: deku.md ================================================ --- title: Deku v2 category: JavaScript libraries intro: | Quick reference for [Deku](https://www.npmjs.com/package/deku), a minimal virtual DOM library. --- ### Components ```js /** @jsx element */ import { element } from 'deku' function render ({ props, children, context, path }) { // props = properties object // children = children array // path = path to current component (like 0.1.5.2) // context = common properties in all components return ( } } function onCreate ({ props, dispatch, path }) { ... } function onUpdate ({ props, dispatch, path }) { ... } function onRemove ({ props, dispatch, path }) { ... } // actually { children, props, path, context } export default { render, onCreate, onRemove } ``` ### Rendering ```js import { createStore } from 'redux' import { dom, element } from 'deku' // Create a Redux store to handle all UI actions and side-effects let store = createStore(reducer) // Create a renderer that can turn vnodes into real DOM elements let render = createRenderer(document.body, store.dispatch) // Update the page and add redux state to the context render(Hello World!, store.getState()) ``` ================================================ FILE: deku@1.md ================================================ --- title: Deku v1 category: JavaScript libraries intro: | Quick reference for [Deku](https://www.npmjs.com/package/deku), a minimal virtual DOM library. **Deprecated:** This is for Deku v1. See [deku](./deku) for a more updated cheatsheet. --- ### Example ```js /** @jsx element */ import element from 'virtual-element' // replacement for React.createElement import { render, tree } from 'deku' var app =
Hello World!
render(tree(app), document.body) ``` ### Components ```js Button = { render() { return } } App = { render() { return (
) } } render(tree(), document.body) render(tree(element(App)), document.body) ``` ### Component props/state ```js App = { render ({ props, state }) { return
{ /*...use state.store here*/ }
} initialState (props) { return { store: store.getState() } }, afterMount (comp, el, setState) { store.subscribe(() => setState({ store: store.getState() })) } } render(tree(), document.body) ``` ### Events ```js
{props.text} ``` ### Magic virtual element Use [magic-virtual-element](https://github.com/dekujs/magic-virtual-element) to enable nice classnames. ``` import element from 'magic-virtual-element'
``` ### Reference ``` name = 'MyComponent' // Defaults initialState (props) {...} // return initial state defaultProps = { hi: 'hello' } // Render render ({props, state}, setState) {...} // Lifecycle beforeUpdate ({props, state, id}, nextProps, nextState) {} afterRender ({props, state, id}, el) {} afterUpdate ({props, state, id}, prevProps, prevState, setState) {} afterMount ({props, state, id}, el, setState) {} beforeUnmount ({props, state, id}, el) {} ``` See: ================================================ FILE: devise.md ================================================ --- title: Devise --- ### About {: .-intro} [Devise](https://github.com/plataformatec/devise) is a flexible authentication gem. - ### Installation Rails 3: Add the following to your Gemfile gem "devise" gem "hpricot" gem "ruby_parser" Install devise in your project $ rails generate devise:install Generate devise for your model $ rails generate devise MODEL $ rake db:migrate (Optional) Generate devise views $ rails generate devise:views ### Helpers user_signed_in? current_user user_session destroy_user_session_path (Logout) new_user_session_path (Login) edit_user_registration_path (Edit registration) new_user_registration_path (Register new user) ### Controller stuff before_filter :authenticate_user! Model ----- ### Model options class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :trackable, :validatable end ### Migration helpers create_table :users do |t| t.database_authenticatable t.confirmable t.recoverable t.rememberable t.trackable t.timestamps end Routing ------- ### Authenticated and unauthenticated routes unauthenticated do root :to => 'home#index' end authenticated do root :to => 'dashboard#index' end ### As as :user do get 'sign_in', :to => 'devise/sessions#new' end ### Devise_for magic devise_for :users # Session routes for Authenticatable (default) new_user_session GET /users/sign_in {:controller=>"devise/sessions", :action=>"new"} user_session POST /users/sign_in {:controller=>"devise/sessions", :action=>"create"} destroy_user_session GET /users/sign_out {:controller=>"devise/sessions", :action=>"destroy"} # Password routes for Recoverable, if User model has :recoverable configured new_user_password GET /users/password/new(.:format) {:controller=>"devise/passwords", :action=>"new"} edit_user_password GET /users/password/edit(.:format) {:controller=>"devise/passwords", :action=>"edit"} user_password PUT /users/password(.:format) {:controller=>"devise/passwords", :action=>"update"} POST /users/password(.:format) {:controller=>"devise/passwords", :action=>"create"} # Confirmation routes for Confirmable, if User model has :confirmable configured new_user_confirmation GET /users/confirmation/new(.:format) {:controller=>"devise/confirmations", :action=>"new"} user_confirmation GET /users/confirmation(.:format) {:controller=>"devise/confirmations", :action=>"show"} POST /users/confirmation(.:format) {:controller=>"devise/confirmations", :action=>"create"} ### Customizing devise_for devise_for :users, :path => "usuarios", :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification', :unlock => 'unblock', :registration => 'register', :sign_up => 'cmon_let_me_in' } Test helpers ------------ ### Test helpers include Devise::TestHelpers sign_in @user sign_out @user See: ================================================ FILE: divshot.md ================================================ --- title: Divshot tags: [Archived] archived: Divshot is no longer in operation. --- ## Getting started ### About Divshot was a static hosting platform. - ### Install divshot-cli ``` $ npm install -g divshot-cli $ divshot login ``` ### Create divshot.json ```json { "name": "yourapp", "root": "./app" } ``` ### Push your app ``` $ divshot push ``` ## Configuration See [configuration reference](https://docs.divshot.com/guides/configuration) and [routing guide](https://docs.divshot.com/guides/routing). ```json { "name": "yourapp", "root": "./app", "clean_urls": true, "clean_urls": ["/app/**", "/!components/**"],, "error_page": "error.html", "exclude": [ "Gruntfile.js" ], "cache_control": {}, "routes": { "/*.html": "index.html", "/app/**/*.html": "app.html", "**": "index.html" }, "redirects": { "/old/:segment/path": "/new/path/:segment", "/some/old/path": { "status": 302, "url": "/some/new/path" } }, "headers": { "/cors-stuff/**": { "Access-Control-Allow-Origin": "*" }, "/scripts/**": { "content-type": "text/javascript" } } } ``` ## CLI ```sh divshot s # server divshot push [staging|production|development] divshot pull [staging|production|development] divshot purge # cleans cache divshot files divshot promote development production divshot open [] ``` ### Config Edits `divshot.json` ``` divshot config:add name your-app-name divshot config:remove name ``` ### Environment vars ``` divshot env:add KEY=value divshot env:remove KEY divshot env:pull ``` ### App management ``` divshot create divshot rename divshot status divshot destroy ``` divshot apps divshot account ``` ### Password protect ```sh divshot protect ``` ## Custom domains See [custom domains guide](http://docs.divshot.com/guides/domains). ```sh divshot domains:add foo.bar.com ``` In your DNS create a `CNAME`: (no apex domains are supported) ``` www. CNAME yourname.divshot.io ``` ================================================ FILE: do.md ================================================ --- title: Do gem category: Ruby libraries --- ### About {: .-intro} * [DAddYE/do](https://github.com/DAddYE/do) ### Connection server = DO::Server.new('srv1', 'srv1.domain.local', 'root', :key => %w[srv1.pem] ### Run server.run 'uname' # root@srv1 ~ # uname # Linux server.run 'uname', '-a' # root@srv1 ~ # uname -a # Linux srv1.lipsiasoft.net 2.6.18-194.32.1.el5 x86_64 x86_64 x86_64 GNU/Linux server.run 'mysqladmin -u root -p password "oldone"', 'newpassword' # root@srv1 ~ # mysqladmin -u root -p password 'oldone' # Enter password: oldone # mysqladmin: connect to server at 'localhost' failed # error: 'Access denied for user 'root'@'localhost' (using password: YES)' ### Files server.exist?('~/.ssh') # root@srv1 ~ # test -e ~/.ssh && echo True # => true server.read('/etc/redhat-release') # root@srv1 ~ # cat /etc/redhat-release # => "CentOS release 5.5 (Final)" ### Upload/download server.upload '/tmp/file', '/tmp/foo' # root@srv1 ~ # upload from '/tmp/file' to '/tmp/foo' server.download '/tmp/foo', '/tmp/file2' # root@srv1 ~ # download from '/tmp/foo' to '/tmp/file2' ### Replace server.replace :all, 'new content', '/tmp/file' # root@srv1 ~ # replace all in '/tmp/foo' server.read('/tmp/foo') # root@srv1 ~ # cat /tmp/foo # => "new content" ### Replace via regex server.replace /content$/, 'changed content', '/tmp/foo' # root@srv1 ~ # replace /content$/ in '/tmp/foo' server.read('/tmp/foo') # root@srv1 ~ # cat /tmp/foo # => "new changed content" ### Append server.append('appended', '/tmp/foo') # root@srv1 ~ # append to 'bottom' in '/tmp/foo' server.read('/tmp/foo') # root@srv1 ~ # cat /tmp/foo # => "new changed contentappended" ### Append to top server.append('---', '/tmp/foo', :top) # root@srv1 ~ # append to 'top' in '/tmp/foo' server.read('/tmp/foo') # root@srv1 ~ # cat /tmp/foo # => "---new changed contentappended" ### Prompt server.ask "Please choose" # root@srv1 ~ # Please choose: foo # => "foo" server.yes? "Do you want to proceed" # root@srv1 ~ # Do you want to proceed? (y/n): y # => 0 server.wait # Press ENTER to continue... ================================================ FILE: docker-compose.md ================================================ --- title: docker-compose category: Devops prism_languages: [yaml] weight: -1 updated: 2024-04-03 --- ### Basic example ```yaml # docker-compose.yml version: '2' services: web: build: # build from Dockerfile context: ./Path dockerfile: Dockerfile ports: - "5000:5000" volumes: - .:/code redis: image: redis ``` ### Version 1 to 2 Docker compose is now integrated into the official Docker installation. The functionality only improved over that change, and the simple syntax change is : V1 : `docker-compose ARG` to V2 `docker compose ARG` More on that here : [Docker Compose](https://docs.docker.com/compose/) [Migrate to V2](https://docs.docker.com/compose/migrate/) ### Commands ```sh docker compose version docker compose config ``` ```sh docker compose start docker compose stop docker compose restart docker compose run ``` ```sh docker compose create docker compose attach docker compose pause docker compose unpause ``` ```sh docker compose wait docker compose up docker compose down ``` ```sh docker compose ps docker compose top docker compose events docker compose logs ``` ```sh docker compose images docker compose build docker compose push docker compose cp docker compose exec ``` ## Reference {: .-three-column} ### Building ```yaml web: # build from Dockerfile build: . args: # Add build arguments APP_HOME: app ``` ```yaml # build from custom Dockerfile build: context: ./dir dockerfile: Dockerfile.dev ``` ```yaml # build from image image: ubuntu image: ubuntu:14.04 image: tutum/influxdb image: example-registry:4000/postgresql image: a4bc65fd ``` ### Ports ```yaml ports: - "3000" - "8000:80" # host:container ``` ```yaml # expose ports to linked services (not to host) expose: ["3000"] ``` ### Commands ```yaml # command to execute command: bundle exec thin -p 3000 command: [bundle, exec, thin, -p, 3000] ``` ```yaml # override the entrypoint entrypoint: /app/start.sh entrypoint: [php, -d, vendor/bin/phpunit] ``` ### Environment variables ```yaml # environment vars environment: RACK_ENV: development environment: - RACK_ENV=development ``` ```yaml # environment vars from file env_file: .env env_file: [.env, .development.env] ``` ### Dependencies ```yaml # makes the `db` service available as the hostname `database` # (implies depends_on) links: - db:database - redis ``` ```yaml # make sure `db` is alive before starting depends_on: - db ``` ```yaml # make sure `db` is healty before starting # and db-init completed without failure depends_on: db: condition: service_healthy db-init: condition: service_completed_successfully ``` ### Other options ```yaml # make this service extend another extends: file: common.yml # optional service: webapp ``` ```yaml volumes: - /var/lib/mysql - ./_data:/var/lib/mysql ``` ```yaml # automatically restart container restart: unless-stopped # always, on-failure, no (default) ``` ## Advanced features {: .-three-column} ### Labels ```yaml services: web: labels: com.example.description: "Accounting web app" ``` ### DNS servers ```yaml services: web: dns: 8.8.8.8 dns: - 8.8.8.8 - 8.8.4.4 ``` ### Devices ```yaml services: web: devices: - "/dev/ttyUSB0:/dev/ttyUSB0" ``` ### External links ```yaml services: web: external_links: - redis_1 - project_db_1:mysql ``` ### Healthcheck ```yaml # declare service healthy when `test` command succeed healthcheck: test: ["CMD", "curl", "-f", "http://localhost"] interval: 1m30s timeout: 10s retries: 3 start_period: 40s ``` ### Hosts ```yaml services: web: extra_hosts: - "somehost:192.168.1.100" ``` ### Network ```yaml # creates a custom network called `frontend` networks: frontend: ``` ### External network ```yaml # join a pre-existing network networks: default: external: name: frontend ``` ### Volume ```yaml # mount host paths or named volumes, specified as sub-options to a service db: image: postgres:latest volumes: - "/var/run/postgres/postgres.sock:/var/run/postgres/postgres.sock" - "dbdata:/var/lib/postgresql/data" volumes: dbdata: ``` ### User ```yaml # specifying user user: root ``` ```yaml # specifying both user and group with ids user: 0:0 ``` ================================================ FILE: docker.md ================================================ --- title: Docker CLI category: Devops --- Manage images ------------- ### `docker build` ```yml docker build [options] . -t "app/container_name" # name --build-arg APP_HOME=$APP_HOME # Set build-time variables ``` Create an `image` from a Dockerfile. ### `docker run` ```yml docker run [options] IMAGE # see `docker create` for options ``` #### Example ``` $ docker run -it debian:buster /bin/bash ``` Run a command in an `image`. Manage containers ----------------- ### `docker create` ```yml docker create [options] IMAGE -a, --attach # attach stdout/err -i, --interactive # attach stdin (interactive) -t, --tty # pseudo-tty --name NAME # name your image -p, --publish 5000:5000 # port map (host:container) --expose 5432 # expose a port to linked containers -P, --publish-all # publish all ports --link container:alias # linking -v, --volume `pwd`:/app # mount (absolute paths needed) -e, --env NAME=hello # env vars ``` #### Example ``` $ docker create --name app_redis_1 \ --expose 6379 \ redis:3.0.2 ``` Create a `container` from an `image`. ### `docker exec` ```yml docker exec [options] CONTAINER COMMAND -d, --detach # run in background -i, --interactive # stdin -t, --tty # interactive ``` #### Example ``` $ docker exec app_web_1 tail logs/development.log $ docker exec -t -i app_web_1 rails c ``` Run commands in a `container`. ### `docker start` ```yml docker start [options] CONTAINER -a, --attach # attach stdout/err -i, --interactive # attach stdin docker stop [options] CONTAINER ``` Start/stop a `container`. ### `docker ps` ``` $ docker ps $ docker ps -a $ docker kill $ID ``` Manage `container`s using ps/kill. ### `docker logs` ``` $ docker logs $ID $ docker logs $ID 2>&1 | less $ docker logs -f $ID # Follow log output ``` See what's being logged in an `container`. Images ------ ### `docker images` ```sh $ docker images REPOSITORY TAG ID ubuntu 12.10 b750fe78269d me/myapp latest 7b2431a8d968 ``` ```sh $ docker images -a # also show intermediate ``` Manages `image`s. ### `docker rmi` ```yml docker rmi b750fe78269d ``` Deletes `image`s. ## Clean up ### Clean all ```sh docker system prune ``` Cleans up dangling images, containers, volumes, and networks (ie, not associated with a container) ```sh docker system prune -a ``` Additionally remove any stopped containers and all unused images (not just dangling images) ### Containers ```sh # Stop all running containers docker stop $(docker ps -a -q) # Delete stopped containers docker container prune ``` ### Images ```sh docker image prune [-a] ``` Delete all the images ### Volumes ```sh docker volume prune ``` Delete all the volumes ### Systems ```sh docker system df ``` Show docker disk usage ```sh docker system events ``` Get real time events from the server ```sh docker system info ``` Display system-wide information Also see -------- * [Getting Started](https://www.docker.io/gettingstarted/) _(docker.io)_ ================================================ FILE: dockerfile.md ================================================ --- title: Dockerfile category: Devops prism_languages: [docker] updated: 2019-10-20 --- ## Reference {: .-three-column} ### Inheritance ```docker FROM ruby:2.2.2 ``` ### Variables ```docker ENV APP_HOME /myapp RUN mkdir $APP_HOME ``` ```docker ARG APP_HOME="" RUN mkdir $APP_HOME ``` ### Initialization ```docker RUN bundle install ``` ```docker WORKDIR /myapp ``` ```docker VOLUME ["/data"] # Specification for mount point ``` ```docker ADD file.xyz /file.xyz COPY --chown=user:group host_file.xyz /path/container_file.xyz ``` ### Run commands in strict shell ```docker ENV my_var SHELL ["/bin/bash", "-euo", "pipefail", "-c"] # With strict mode: RUN false # fails build like using && RUN echo "$myvar" # will throw error due to typo RUN true | false # will bail out of pipe ``` Using `shell` will turn on strict mode for shell commands. ### Onbuild ```docker ONBUILD RUN bundle install # when used with another file ``` ### Commands ```docker EXPOSE 5900 CMD ["bundle", "exec", "rails", "server"] ``` ### Entrypoint ```docker ENTRYPOINT ["executable", "param1", "param2"] ENTRYPOINT command param1 param2 ``` Configures a container that will run as an executable. ```docker ENTRYPOINT exec top -b ``` This will use shell processing to substitute shell variables, and will ignore any `CMD` or `docker run` command line arguments. ### Metadata ```docker LABEL version="1.0" ``` ```docker LABEL "com.example.vendor"="ACME Incorporated" LABEL com.example.label-with-value="foo" ``` ```docker LABEL description="This text illustrates \ that label-values can span multiple lines." ``` ## See also {: .-one-column} - ================================================ FILE: dom-range.md ================================================ --- title: DOM Range category: JavaScript intro: | Quick reference to the HTML [DOM createRange API](https://devdocs.io/dom/range). --- ## Reference {:.-three-column} ### Creating ranges ```js var range = document.createRange() ``` See: ## Methods ```js range .setStart(startNode, startOffset) .setEnd(endNode, endOffset) .setStartBefore(node) .setStartAfter(node) .setEndBefore(node) .setEndAfter(node) .selectNode(node) .selectNodeContents(node) ``` See: ### Collapsing ```js range.collapse() // to end (a single point) range.collapse(true) // to start (a single point) range.collapsed // true | false ``` ### Operations ```js range.cloneContents() // copy => DocumentFragment range.extractContents() // cut => DocumentFragment range.deleteContents() // delete ``` ```js range.insertNode(node) ``` ### String ```js range.toString() ``` ### Read-only attributes ```js range.collapsed // => true/false range.startContainer // => Node range.startOffset range.endContainer // => Node range.endOffset range.commonAncestorContainer // closest of start and end containers ``` ================================================ FILE: dom-selection.md ================================================ --- title: DOM Selection category: JavaScript intro: | Quick introduction to the HTML [DOM selection API](https://devdocs.io/dom/selection). --- ## Reference {: .-three-column} ### Selection ```js var sel = document.getSelection() ``` See: ### Methods ```js sel.removeAllRanges() // deselects sel.addRange(range) // sets a selection sel.removeRange(range) // remove a range ``` ```js sel.rangeCount sel.getRangeAt(0) // get the 0th range ``` ### Collapsing ```js sel.collapse(parent, offset) sel.collapseToEnd() sel.collapseToStart() sel.isCollapsed ``` ```js sel.containsNode(node) ``` ### Deleting ```js sel.deleteFromDocument() ``` ### Events ```js document.addEventListener('selectionchange', () => {}) ``` ================================================ FILE: editorconfig.md ================================================ --- title: editorconfig prism_languages: [ini] weight: -1 updated: 2019-09-25 category: Apps --- ### Short example {: .-prime} ```ini # editorconfig.org root = true [*] indent_style = space indent_size = 2 tab_width = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true ``` This example should be fine for most projects indented by 2 spaces. See: [animate.css editorconfig](https://github.com/daneden/animate.css/blob/master/.editorconfig) ### Properties ```ini indent_style = {space|tab} indent_size = {4|tab} tab_width = 2 end_of_line = {cr|lf|crlf} charset = {utf-8|utf-16be|utf-16le|latin1} trim_trailing_whitespace = false insert_final_newline = true max_line_length = 80 ``` ### Full example ```ini # top-most EditorConfig file root = true # Unix-style newlines with a newline ending every file [*] end_of_line = lf insert_final_newline = true # 4 space indentation [*.py] indent_style = space indent_size = 4 # Tab indentation (no size specified) [*.js] indent_style = tab # Indentation override for all JS under lib directory [lib/**.js] indent_style = space indent_size = 2 # Matches the exact files either package.json or .travis.yml [{package.json,.travis.yml}] indent_style = space indent_size = 2 ``` ### References - ================================================ FILE: elixir-metaprogramming.md ================================================ --- title: Elixir metaprogramming category: Elixir --- ### Kernel Most of these magic is defined in [Kernel.SpecialForms](http://devdocs.io/elixir/elixir/kernel.specialforms). ### Pseudo-variables ```elixir __DIR__ # current dir __MODULE__ # current module __CALLER__ # caller of the function ``` ### [`__ENV__`](http://devdocs.io/elixir/elixir/kernel.specialforms#__ENV__/0) ```elixir Map.keys(__ENV__) [:__struct__, :aliases, :context, :context_modules, :export_vars, :file, :function, :functions, :lexical_tracker, :line, :macro_aliases, :macros, :module, :requires, :vars] ``` ```elixir __CALLER__.module |> Module.definitions_in |> IO.inspect ``` ```elixir apply(Enum, :reverse, [[1, 2, 3]]) ``` ================================================ FILE: elixir.md ================================================ --- title: Elixir category: Elixir tags: [New] updated: 2018-07-04 weight: -10 --- ## Getting started {: .-three-column} ### Hello world {: .-prime} ```elixir # hello.exs defmodule Greeter do def greet(name) do message = "Hello, " <> name <> "!" IO.puts message end end Greeter.greet("world") ``` ```bash elixir hello.exs # Hello, world! ``` {: .-setup} ### Variables ```elixir age = 23 ``` ### Maps ```elixir user = %{ name: "John", city: "Melbourne" } ``` ```elixir IO.puts "Hello, " <> user.name ``` {: .-setup} ### Lists ```elixir users = [ "Tom", "Dick", "Harry" ] ``` {: data-line="1"} ```elixir Enum.map(users, fn user -> IO.puts "Hello " <> user end) ``` ### Piping ```elixir source |> transform(:hello) |> print() ``` {: data-line="2,3"} ```elixir # Same as: print(transform(source, :hello)) ``` These two are equivalent. ### Pattern matching ```elixir user = %{name: "Tom", age: 23} %{name: username} = user ``` {: data-line="2"} This sets `username` to `"Tom"`. ### Pattern matching in functions ```elixir def greet(%{name: username}) do IO.puts "Hello, " <> username end user = %{name: "Tom", age: 23} ``` {: data-line="1"} Pattern matching works in function parameters too. Control flow ------------ {: .-three-column} ### If ```elixir if false do "This will never be seen" else "This will" end ``` ### Case ```elixir case {1, 2, 3} do {4, 5, 6} -> "This clause won't match" {1, x, 3} -> "This will match and bind x to 2" _ -> "This will match any value" end ``` ### Cond ```elixir cond do 1 + 1 == 3 -> "I will never be seen" 2 * 5 == 12 -> "Me neither" true -> "But I will (this is essentially an else)" end ``` ### With ```elixir with {:ok, {int, _asdf}} <- Integer.parse("123asdf"), {:ok, datetime, _utc_offset} <- DateTime.from_iso8601("2021-10-27T12:00:00Z") do DateTime.add(datetime, int, :second) # optional else clause. if not provided and an error occurs, the error is returned else :error -> "couldn't parse integer string" {:error, :invalid_format} -> "couldn't parse date string" _ -> "this will never get hit because all errors are handled" end ``` ### Errors ```elixir try do throw(:hello) catch message -> "Got #{message}." after IO.puts("I'm the after clause.") end ``` ## Types ### Primitives | Sample | Type | | --- | --- | | `nil` | Nil/null | | `true` _/_ `false` | Boolean | | --- | --- | | `?a` | Integer (ASCII) | | `23` | Integer | | `3.14` | Float | | --- | --- | | `'hello'` | Charlist | | `<<2, 3>>` | Binary | | `"hello"` | Binary string | | `:hello` | Atom | | --- | --- | | `[a, b]` | List | | `{a, b}` | Tuple | | --- | --- | | `%{a: "hello"}` | Map | | `%MyStruct{a: "hello"}` | Struct | | `fn -> ... end` | Function | ### Type checks ```elixir is_atom/1 is_bitstring/1 is_boolean/1 is_function/1 is_function/2 is_integer/1 is_float/1 ``` ```elixir is_binary/1 is_list/1 is_map/1 is_tuple/1 ``` ```elixir is_nil/1 is_number/1 is_pid/1 is_port/1 is_reference/1 ``` ### Operators ```elixir left != right # equal left !== right # match left ++ right # concat lists left <> right # concat string/binary left =~ right # regexp ``` Modules ------- ### Importing ```elixir require Redux # compiles a module import Redux # compiles, and you can use without the `Redux.` prefix use Redux # compiles, and runs Redux.__using__/1 use Redux, async: true import Redux, only: [duplicate: 2] import Redux, only: :functions import Redux, only: :macros import Foo.{Bar, Baz} ``` ### Aliases ```elixir alias Foo.Bar, as: Bar alias Foo.Bar # same as above alias Foo.{Bar, Baz} ``` ## String ### Functions ```elixir import String ``` {: .-setup} ```elixir str = "hello" str |> length() # → 5 str |> codepoints() # → ["h", "e", "l", "l", "o"] str |> slice(2..-1) # → "llo" str |> split(" ") # → ["hello"] str |> capitalize() # → "Hello" str |> match(regex) ``` ### Inspecting objects ```elixir inspect(object, opts \\ []) ``` ```elixir value |> IO.inspect() ``` ```elixir value |> IO.inspect(label: "value") ``` ## Numbers ### Operations ```elixir abs(n) round(n) rem(a, b) # remainder (modulo) div(a, b) # integer division ``` ### Float ```elixir import Float ``` {: .-setup} ```elixir n = 10.3 ``` {: .-setup} ```elixir n |> ceil() # → 11.0 n |> ceil(2) # → 11.30 n |> to_string() # → "1.030000+e01" n |> to_string([decimals: 2, compact: true]) ``` ```elixir Float.parse("34") # → { 34.0, "" } ``` ### Integer ```elixir import Integer ``` {: .-setup} ```elixir n = 12 ``` {: .-setup} ```elixir n |> digits() # → [1, 2] n |> to_charlist() # → '12' n |> to_string() # → "12" n |> is_even() n |> is_odd() ``` ```elixir # Different base: n |> digits(2) # → [1, 1, 0, 0] n |> to_charlist(2) # → '1100' n |> to_string(2) # → "1100" ``` ```elixir parse("12") # → {12, ""} undigits([1, 2]) # → 12 ``` ### Type casting ```elixir Float.parse("34.1") # → {34.1, ""} Integer.parse("34") # → {34, ""} ``` ```elixir Float.to_string(34.1) # → "3.4100e+01" Float.to_string(34.1, [decimals: 2, compact: true]) # → "34.1" ``` ## Map ### Defining ```elixir m = %{name: "hi"} # atom keys (:name) m = %{"name" => "hi"} # string keys ("name") ``` ### Updating ```elixir import Map ``` {: .-setup} ```elixir m = %{m | name: "yo"} # key must exist ``` ```elixir m |> put(:id, 2) # → %{id: 2, name: "hi"} m |> put_new(:id, 2) # only if `id` doesn't exist (`||=`) ``` ```elixir m |> put(:b, "Banana") m |> merge(%{b: "Banana"}) m |> update(:a, &(&1 + 1)) m |> update(:a, fun a -> a + 1 end) ``` ```elixir m |> get_and_update(:a, &(&1 || "default")) # → {old, new} ``` ### Deleting ```elixir m |> delete(:name) # → %{} m |> pop(:name) # → {"John", %{}} ``` ### Reading ```elixir m |> get(:id) # → 1 m |> keys() # → [:id, :name] m |> values() # → [1, "hi"] ``` ```elixir m |> to_list() # → [id: 1, name: "hi"] # → [{:id, 1}, {:name, "hi"}] ``` ### Deep ```elixir put_in(map, [:b, :c], "Banana") put_in(map[:b][:c], "Banana") # via macros ``` ```elixir get_and_update_in(users, ["john", :age], &{&1, &1 + 1}) ``` ### Constructing from lists ```elixir Map.new([{:b, 1}, {:a, 2}]) Map.new([a: 1, b: 2]) Map.new([:a, :b], fn x -> {x, x} end) # → %{a: :a, b: :b} ``` ### Working with structs #### Struct to map ```elixir Map.from_struct(%AnyStruct{a: "b"}) # → %{a: "b"} ``` #### Map to struct ```elixir struct(AnyStruct, %{a: "b"}) # → %AnyStruct{a: "b"} ``` ## List ```elixir import List ``` {: .-setup} ```elixir l = [ 1, 2, 3, 4 ] ``` {: .-setup} ```elixir l = l ++ [5] # push (append) l = [ 0 | list ] # unshift (prepend) ``` ```elixir l |> first() l |> last() ``` ```elixir l |> flatten() l |> flatten(tail) ``` Also see [Enum](#enum). ## Enum ### Usage ```elixir import Enum ``` {: .-setup} ```elixir list = [:a, :b, :c] ``` {: .-setup} ```elixir list |> at(0) # → :a list |> count() # → 3 list |> empty?() # → false list |> any?() # → true ``` ```elixir list |> concat([:d]) # → [:a, :b, :c, :d] ``` Also, consider streams instead. ### Map/reduce ```elixir list |> reduce(fn) list |> reduce(acc, fn) list |> map(fn) list |> reject(fn) list |> any?(fn) list |> empty?(fn) ``` ```elixir [1, 2, 3, 4] |> Enum.reduce(0, fn(x, acc) -> x + acc end) ``` ## Tuple ### Tuples ```elixir import Tuple ``` {: .-setup} ```elixir t = { :a, :b } ``` ```elixir t |> elem(1) # like tuple[1] t |> put_elem(index, value) t |> tuple_size() ``` ### Keyword lists ```elixir list = [{ :name, "John" }, { :age, 15 }] list[:name] ``` ```elixir # For string-keyed keyword lists list = [{"size", 2}, {"type", "shoe"}] List.keyfind(list, "size", 0) # → {"size", 2} ``` ## Functions ### Lambdas ```elixir square = fn n -> n*n end square.(20) ``` ### & syntax ```elixir square = &(&1 * &1) square.(20) square = &Math.square/1 ``` ### Running ```elixir fun.(args) apply(fun, args) apply(module, fun, args) ``` ### Function heads ```elixir def join(a, b \\ nil) def join(a, b) when is_nil(b) do: a def join(a, b) do: a <> b ``` ## Structs ### Structs ```elixir defmodule User do defstruct name: "", age: nil end %User{name: "John", age: 20} %User{}.struct # → User ``` See: [Structs](http://elixir-lang.org/getting-started/structs.html) ## Protocols ### Defining protocols ```elixir defprotocol Blank do @doc "Returns true if data is considered blank/empty" def blank?(data) end ``` ```elixir defimpl Blank, for: List do def blank?([]), do: true def blank?(_), do: false end Blank.blank?([]) # → true ``` ### Any ```elixir defimpl Blank, for: Any do ... end defmodule User do @derive Blank # Falls back to Any defstruct name: "" end ``` ### Examples - `Enumerable` and `Enum.map()` - `Inspect` and `inspect()` ## Comprehensions ### For ```elixir for n <- [1, 2, 3, 4], do: n * n for n <- 1..4, do: n * n ``` ```elixir for {key, val} <- %{a: 10, b: 20}, do: val # → [10, 20] ``` ```elixir for {key, val} <- %{a: 10, b: 20}, into: %{}, do: {key, val*val} ``` ### Conditions ```elixir for n <- 1..10, rem(n, 2) == 0, do: n # → [2, 4, 6, 8, 10] ``` ### Complex ```elixir for dir <- dirs, file <- File.ls!(dir), # nested comprehension path = Path.join(dir, file), # invoked File.regular?(path) do # condition IO.puts(file) end ``` ## Misc ### Metaprogramming ```elixir __MODULE__ __MODULE__.__info__ @after_compile __MODULE__ def __before_compile__(env) def __after_compile__(env, _bytecode) def __using__(opts) # invoked on `use` @on_definition {__MODULE__, :on_def} def on_def(_env, kind, name, args, guards, body) @on_load :load_check def load_check ``` ### Regexp ```elixir exp = ~r/hello/ exp = ~r/hello/i "hello world" =~ exp ``` ### Sigils ```elixir ~r/regexp/ ~w(list of strings) ~s|strings with #{interpolation} and \x20 escape codes| ~S|no interpolation and no escapes| ~c(charlist) ``` Allowed chars: `/` `|` `"` `'` `(` `[` `{` `<` `"""`. See: [Sigils](http://elixir-lang.org/getting-started/sigils.html) ### Type specs ```elixir @spec round(number) :: integer @type number_with_remark :: {number, String.t} @spec add(number, number) :: number_with_remark ``` Useful for [dialyzer](http://www.erlang.org/doc/man/dialyzer.html). See: [Typespecs](http://elixir-lang.org/getting-started/typespecs-and-behaviours.html) ### Behaviours ```elixir defmodule Parser do @callback parse(String.t) :: any @callback extensions() :: [String.t] end ``` ```elixir defmodule JSONParser do @behaviour Parser def parse(str), do: # ... parse JSON def extensions, do: ["json"] end ``` See: [Module](http://elixir-lang.org/docs/stable/elixir/Module.html) ## References {: .-one-column} - [Learn Elixir in Y minutes](https://learnxinyminutes.com/docs/elixir/) ================================================ FILE: emacs.md ================================================ --- title: Emacs category: CLI --- ### Movements ^n ^p # up/down ^f ^b # left/right ^v Mv # up/down page ^a ^e # begin/end of line Ma Me # begin/end of sentence ### Basic ^x ^f # find file ^x ^s # save file ### Command line Mx ### Packages Mx package-install RET evil RET ================================================ FILE: ember.md ================================================ --- title: Ember.js category: JavaScript libraries tags: [Archived] archived: This sheet describes an older version of Ember. --- {% raw %} ### Routes Router.map(function() { this.route('trips', function() { this.route('item', { path: '/:tripId' }); }); this.route('upcoming'); this.route('about', { path: '/aboutus' }); this.route('schedules'); this.route('history'); this.route('post', { path: '/post/:postId' }); }); ### A route import Route from '@ember/routing/route'; export default PostRoute extends Route { model({ postId }) { // Post will be accessible as `this.model` in the controller // or `{{@model}}` in the template. return this.store.find('post', postId); } } ### Component import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; export default PostEditor extends Component { @tracked title; get fullTitle() { return `Post: ${title}`; } titleUpdate(event) { this.title = event.target.value; } } ### Template

{{this.fullTitle}}

Invoking the component: {% endraw %} ================================================ FILE: emmet.md ================================================ --- title: Emmet category: Markup prism_languages: [html, css] updated: 2020-07-03 intro: | Emmet is a markup language for expanding CSS rules into HTML --- ### Child: > ```css nav>ul>li ``` Expands to ```html ``` ### Sibling: + ```css section>p+p+p ``` Expands to ```html

``` ### Climb Up: ^ ```css section>header>h1^footer ``` Expands to ```html

``` ### Grouping: () ```css section>(header>nav>ul>li)+footer>p ``` Expands to ```html

``` ### Multiplication: \* ```css ul>li*3 ``` Expands to ```html
``` ### IDs and Classes: . # ```css ul.menu>li.menu__item+li#id_item+li.menu__item#id_2 ``` Expands to ```html ``` ### Numbering: $ ```css ul>li.item$*3 ul>li.item$$*3 ul>li.item$@-*3 ul>li.item$@3*5 ``` Expands to ```html
``` ### Attributes: [] ```css input[type="text"] div[data-attr="test"] ``` Expands to ```html
``` ### Text: {} ```css p{Lorem ipsum} ``` Expands to ```html

Lorem ipsum

``` ### Implicit tags ```css .default-block em>.default-inline ul>.default-list table>.default-table-row>.default-table-column ``` Expands to ```html
``` ================================================ FILE: enzyme.md ================================================ --- title: Enzyme category: React updated: 2020-02-12 tags: [Featured] weight: -1 keywords: - shallow() - mount() - wrap.setProps() - "wrap.find().simulate('click')" - "wrap.contains(
)" --- ## Getting started ### Introduction {: .-intro} [Enzyme](https://airbnb.io/enzyme) lets you write unit tests for React components. This guide covers Enzyme 3.x. - [Enzyme website](https://enzymejs.github.io/enzyme/) _(enzymejs.github.io)_ ### Mounting {: .-prime} ```js import {shallow, mount} from 'enzyme' ``` {: .-setup} ```js wrap = shallow() ``` ```js wrap = mount() ``` Shallow wrapping doesn't descend down to sub-components. A full mount also mounts sub-components. See: [Shallow rendering](https://airbnb.io/enzyme/docs/api/shallow.html), [Full rendering](https://airbnb.io/enzyme/docs/api/mount.html) ### Debugging ```js console.log(wrap.debug()) ``` Shows HTML for debugging purposes. See: [debug()](https://airbnb.io/enzyme/docs/api/ReactWrapper/debug.html) ## Examples {: .-three-column} ### Basic example {: .-prime} ```js import { shallow } from 'enzyme' import MyComponent from '../MyComponent' ``` {: .-setup} ```js it('works', () => { const wrap = shallow( ) expect(wrap.text()).toEqual('I am Groot') }) ``` ### Props and state #### Setting ```js wrap.setProps({ name: 'Moe' }) wrap.setState({ show: true }) ``` #### Asserting ```js expect(wrap.prop('name')).toEqual('Moe') expect(wrap.state('show')).toEqual(true) ``` ```js expect('name' in wrap.props()).toEqual('Moe') expect('show' in wrap.state()).toEqual(true) ``` ### Matching elements ```js expect( wrap.containsMatchingElement( I am groot ) ).toBeTruthy() ``` `containsMatchingElement()` is probably the most useful assertion in Jest. ### Snapshots ```js expect(wrap).toMatchSnapshot() ``` Be sure you've set up enzyme-to-json for snapshots (see [Installing](#installing) below). ### Traversions ```js expect( wrap.find('button').text() ).toEqual('Submit') ``` Use `.find()` to traverse down to nodes. It will return wrapper objects, too. ### Simulating events ```js wrap.find('input').simulate('click') ``` #### With event object props ```js wrap.find('input').simulate('change', { target: { value: 'hello' } }) ``` ## Installing ### Initial setup ``` npm install --save-dev enzyme \ enzyme-adapter-react-16 \ react-test-renderer ``` {: .-setup} #### test/setup.js ```js import Enzyme from 'enzyme' import Adapter from 'enzyme-adapter-react-16' Enzyme.configure({ adapter: new Adapter() }) ``` #### package.json ```js "jest": { "setupFiles": [ "test/setup.js" ] } ``` This configures Enzyme for React v16, and Jest to automatically configure Enzyme for you. There are other adapters in Enzyme's installation instructions. See: [Installation](https://airbnb.io/enzyme/#installation) ### Jest snapshots ``` npm install --save-dev enzyme-to-json ``` {: .-setup} #### package.json ```js "jest": { "snapshotSerializers": [ "enzyme-to-json/serializer" ] } ``` #### Test ```js it('works', () => { wrap = mount() expect(wrap).toMatchSnapshot() }) ``` Optional, but recommended: This allows you to use Enzyme wrappers with Jest snapshots. See: [enzyme-to-json](https://www.npmjs.com/package/enzyme-to-json) ## ReactWrapper ### Traversing ```js wrap.find('button') // → ReactWrapper wrap.filter('button') // → ReactWrapper wrap.not('span') // → ReactWrapper (inverse of filter()) wrap.children() // → ReactWrapper wrap.parent() // → ReactWrapper wrap.closest('div') // → ReactWrapper wrap.childAt(0) // → ReactWrapper wrap.at(0) // → ReactWrapper wrap.first() // → ReactWrapper wrap.last() // → ReactWrapper ``` ```js wrap.get(0) // → ReactElement wrap.getElement() // → ReactElement wrap.getElements() // → Array wrap.getDOMNode() // → DOMComponent ``` See: [Full rendering API](https://airbnb.io/enzyme/docs/api/mount.html) ### Actions ```js wrap.simulate('click') ``` ### React components ```js wrap.setState({ ··· }) wrap.setProps({ ··· }) wrap.setContext({ ··· }) ``` ```js wrap.state() // get full state wrap.props() // get full props wrap.context() // get full context ``` ```js wrap.state('key') // → any wrap.prop('key') // → any wrap.context('key') // → any ``` ```js wrap.instance() // → ReactComponent ``` ### Mount ```js wrap.mount() wrap.unmount() wrap.update() // calls forceUpdate() ``` ### Tests ```js wrap.debug() // → string wrap.html() // → string wrap.text() // → string wrap.type() // → string | function wrap.name() // → string wrap.is('.classname') // → boolean wrap.hasClass('class') // → boolean wrap.exists() // → boolean wrap.contains(
) // → boolean wrap.contains([
]) // → boolean wrap.some('.child') // → boolean wrap.someWhere(n => n.hasClass('foo')) wrap.containsMatchingElement(
) // → boolean wrap.containsAllMatchingElements([
]) // → boolean wrap.containsAnyMatchingElements([
]) // → boolean ``` ## References - [Enzyme website](https://airbnb.io/enzyme) _(airbnb.io)_ - [Enzyme v2 cheatsheet](./enzyme@2) _(devhints.io)_ (old version) ================================================ FILE: enzyme@2.md ================================================ --- title: Enzyme v2 category: React updated: 2017-10-12 weight: -1 deprecated_by: /enzyme --- ## Getting started {: .-three-column} ### Introduction {: .-intro} **(Deprecated)** [Enzyme](http://airbnb.io/enzyme) lets you write unit tests for React components. This guide covers a previous version (v2.x). ### Mounting {: .-prime} ```js import {shallow, mount} from 'enzyme' ``` {: .-setup} ```js wrap = shallow() ``` ```js wrap = mount() ``` Shallow wrapping doesn't descend down to sub-components. A full mount also mounts sub-components. See: [Shallow rendering](http://airbnb.io/enzyme/docs/api/shallow.html), [Full rendering](http://airbnb.io/enzyme/docs/api/mount.html) ### Jest ```js import toJson from 'enzyme-to-json' ``` {: .-setup} ```js it('works', () => { wrap = mount() expect(toJson(wrap)).toMatchSnapshot() }) ``` Converts an Enzyme wrapper to a format compatible with Jest snapshots. See: [enzyme-to-json](https://www.npmjs.com/package/enzyme-to-json) ### Debugging ```js console.log(wrap.debug()) ``` Shows HTML for debugging purposes. See: [debug()](http://airbnb.io/enzyme/docs/api/ReactWrapper/debug.html) ## ReactWrapper ### Traversing ```js wrap.find('button') // => ReactWrapper wrap.filter('button') // => ReactWrapper wrap.not('span') // => ReactWrapper (inverse of filter()) wrap.children() // => ReactWrapper wrap.parent() // => ReactWrapper wrap.closest('div') // => ReactWrapper wrap.childAt(0) // => ReactWrapper wrap.at(0) // => ReactWrapper wrap.first() // => ReactWrapper wrap.last() // => ReactWrapper ``` ```js wrap.get(0) // => ReactElement wrap.getNode() // => ReactElement wrap.getNodes() // => Array wrap.getDOMNode() // => DOMComponent ``` See: [Full rendering API](http://airbnb.io/enzyme/docs/api/mount.html) ### Actions ```js wrap.simulate('click') ``` ### React components ```js wrap.setState({ ... }) wrap.setProps({ ... }) wrap.setContext({ ... }) wrap.state() // => Any (get state) wrap.props() // => object (get props) wrap.context() // => Any (get context) wrap.instance() // => ReactComponent ``` ### Mount ```js wrap.mount() wrap.unmount() wrap.update() // calls forceUpdate() ``` ### Tests ```js wrap.debug() // => string wrap.html() // => string wrap.text() // => string wrap.type() // => string | function wrap.name() // => string wrap.is('.classname') // => boolean wrap.hasClass('class') // => boolean wrap.exists() // => boolean wrap.contains(
) // => boolean wrap.contains([
]) // => boolean wrap.containsMatchingElement(
) // => boolean wrap.containsAllMatchingElements([
]) // => boolean wrap.containsAnyMatchingElements([
]) // => boolean ``` ## References - ================================================ FILE: es6.md ================================================ --- title: ES2015+ category: JavaScript tags: [Featured] updated: 2019-11-14 weight: -10 intro: | A quick overview of new JavaScript features in ES2015, ES2016, ES2017, ES2018 and beyond. --- ### Block scoping #### Let ```js function fn () { let x = 0 if (true) { let x = 1 // only inside this `if` } } ``` {: data-line="2,4"} #### Const ```js const a = 1 ``` `let` is the new `var`. Constants work just like `let`, but can't be reassigned. See: [Let and const](https://babeljs.io/learn-es2015/#let--const) ### Backtick strings #### Interpolation ```js const message = `Hello ${name}` ``` #### Multiline strings ```js const str = ` hello world ` ``` Templates and multiline strings. See: [Template strings](https://babeljs.io/learn-es2015/#template-strings) ### Binary and octal literals ```js let bin = 0b1010010 let oct = 0o755 ``` See: [Binary and octal literals](https://babeljs.io/learn-es2015/#binary-and-octal-literals) ### New methods #### New string methods ```js "hello".repeat(3) "hello".includes("ll") "hello".startsWith("he") "hello".padStart(8) // " hello" "hello".padEnd(8) // "hello " "hello".padEnd(8, '!') // hello!!! "\u1E9B\u0323".normalize("NFC") ``` See: [New methods](https://babeljs.io/learn-es2015/#math--number--string--object-apis) ### Classes ```js class Circle extends Shape { ``` #### Constructor ```js constructor (radius) { this.radius = radius } ``` {: data-line="1"} #### Methods ```js getArea () { return Math.PI * 2 * this.radius } ``` {: data-line="1"} #### Calling superclass methods ```js expand (n) { return super.expand(n) * Math.PI } ``` {: data-line="2"} #### Static methods ```js static createFromDiameter(diameter) { return new Circle(diameter / 2) } } ``` {: data-line="1"} Syntactic sugar for prototypes. See: [Classes](https://babeljs.io/learn-es2015/#classes) ### Exponent operator ```js const byte = 2 ** 8 // Same as: Math.pow(2, 8) ``` {: data-line="1"} Promises -------- {: .-three-column} ### Making promises ```js new Promise((resolve, reject) => { if (ok) { resolve(result) } else { reject(error) } }) ``` {: data-line="1"} For asynchronous programming. See: [Promises](https://babeljs.io/learn-es2015/#promises) ### Using promises ```js promise .then((result) => { ··· }) .catch((error) => { ··· }) ``` {: data-line="2,3"} ### Using promises with finally ```js promise .then((result) => { ··· }) .catch((error) => { ··· }) .finally(() => { // logic independent of success/error }) ``` {: data-line="4"} The handler is called when the promise is fulfilled or rejected. ### Promise functions ```js Promise.all(···) Promise.race(···) Promise.reject(···) Promise.resolve(···) ``` ### Async-await ```js async function run () { const user = await getUser() const tweets = await getTweets(user) return [user, tweets] } ``` {: data-line="2,3"} `async` functions are another way of using functions. See: [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) Destructuring ------------- {: .-three-column} ### Destructuring assignment #### Arrays ```js const [first, last] = ['Nikola', 'Tesla'] ``` {: data-line="1"} #### Objects ```js let {title, author} = { title: 'The Silkworm', author: 'R. Galbraith' } ``` {: data-line="1"} Supports for matching arrays and objects. See: [Destructuring](https://babeljs.io/learn-es2015/#destructuring) ### Default values ```js const scores = [22, 33] const [math = 50, sci = 50, arts = 50] = scores ``` ```js // Result: // math === 22, sci === 33, arts === 50 ``` Default values can be assigned while destructuring arrays or objects. ### Function arguments ```js function greet({ name, greeting }) { console.log(`${greeting}, ${name}!`) } ``` {: data-line="1"} ```js greet({ name: 'Larry', greeting: 'Ahoy' }) ``` Destructuring of objects and arrays can also be done in function arguments. ### Default values ```js function greet({ name = 'Rauno' } = {}) { console.log(`Hi ${name}!`); } ``` {: data-line="1"} ```js greet() // Hi Rauno! greet({ name: 'Larry' }) // Hi Larry! ``` ### Reassigning keys ```js function printCoordinates({ left: x, top: y }) { console.log(`x: ${x}, y: ${y}`) } ``` {: data-line="1"} ```js printCoordinates({ left: 25, top: 90 }) ``` This example assigns `x` to the value of the `left` key. ### Loops ```js for (let {title, artist} of songs) { ··· } ``` {: data-line="1"} The assignment expressions work in loops, too. ### Object destructuring ```js const { id, ...detail } = song; ``` {: data-line="1"} Extract some keys individually and remaining keys in the object using rest (...) operator Spread ------ ### Object spread #### with Object spread ```js const options = { ...defaults, visible: true } ``` {: data-line="2"} #### without Object spread ```js const options = Object.assign( {}, defaults, { visible: true }) ``` The Object spread operator lets you build new objects from other objects. See: [Object spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator) ### Array spread #### with Array spread ```js const users = [ ...admins, ...editors, 'rstacruz' ] ``` {: data-line="2,3"} #### without Array spread ```js const users = admins .concat(editors) .concat([ 'rstacruz' ]) ``` The spread operator lets you build new arrays in the same way. See: [Spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator) Functions --------- ### Function arguments #### Default arguments ```js function greet (name = 'Jerry') { return `Hello ${name}` } ``` {: data-line="1"} #### Rest arguments ```js function fn(x, ...y) { // y is an Array return x * y.length } ``` {: data-line="1"} #### Spread ```js fn(...[1, 2, 3]) // same as fn(1, 2, 3) ``` {: data-line="1"} Default, rest, spread. See: [Function arguments](https://babeljs.io/learn-es2015/#default--rest--spread) ### Fat arrows #### Fat arrows ```js setTimeout(() => { ··· }) ``` {: data-line="1"} #### With arguments ```js readFile('text.txt', (err, data) => { ... }) ``` {: data-line="1"} #### Implicit return ```js numbers.map(n => n * 2) // No curly braces = implicit return // Same as: numbers.map(function (n) { return n * 2 }) numbers.map(n => ({ result: n * 2 })) // Implicitly returning objects requires parentheses around the object ``` {: data-line="1,4,5,6"} Like functions but with `this` preserved. See: [Fat arrows](https://babeljs.io/learn-es2015/#arrows-and-lexical-this) Objects ------- ### Shorthand syntax ```js module.exports = { hello, bye } // Same as: module.exports = { hello: hello, bye: bye } ``` See: [Object literal enhancements](https://babeljs.io/learn-es2015/#enhanced-object-literals) ### Methods ```js const App = { start () { console.log('running') } } // Same as: App = { start: function () {···} } ``` {: data-line="2"} See: [Object literal enhancements](https://babeljs.io/learn-es2015/#enhanced-object-literals) ### Getters and setters ```js const App = { get closed () { return this.status === 'closed' }, set closed (value) { this.status = value ? 'closed' : 'open' } } ``` {: data-line="2,5"} See: [Object literal enhancements](https://babeljs.io/learn-es2015/#enhanced-object-literals) ### Computed property names ```js let event = 'click' let handlers = { [`on${event}`]: true } // Same as: handlers = { 'onclick': true } ``` {: data-line="3"} See: [Object literal enhancements](https://babeljs.io/learn-es2015/#enhanced-object-literals) ### Extract values ```js const fatherJS = { age: 57, name: "Brendan Eich" } Object.values(fatherJS) // [57, "Brendan Eich"] Object.entries(fatherJS) // [["age", 57], ["name", "Brendan Eich"]] ``` {: data-line="3,5"} Modules ------- ### Imports ```js import 'helpers' // aka: require('···') ``` ```js import Express from 'express' // aka: const Express = require('···').default || require('···') ``` ```js import { indent } from 'helpers' // aka: const indent = require('···').indent ``` ```js import * as Helpers from 'helpers' // aka: const Helpers = require('···') ``` ```js import { indentSpaces as indent } from 'helpers' // aka: const indent = require('···').indentSpaces ``` `import` is the new `require()`. See: [Module imports](https://babeljs.io/learn-es2015/#modules) ### Exports ```js export default function () { ··· } // aka: module.exports.default = ··· ``` ```js export function mymethod () { ··· } // aka: module.exports.mymethod = ··· ``` ```js export const pi = 3.14159 // aka: module.exports.pi = ··· ``` `export` is the new `module.exports`. See: [Module exports](https://babeljs.io/learn-es2015/#modules) Generators ---------- ### Generators ```js function* idMaker () { let id = 0 while (true) { yield id++ } } ``` ```js let gen = idMaker() gen.next().value // → 0 gen.next().value // → 1 gen.next().value // → 2 ``` It's complicated. See: [Generators](https://babeljs.io/learn-es2015/#generators) ### For..of iteration ```js for (let i of iterable) { ··· } ``` For iterating through generators and arrays. See: [For..of iteration](https://babeljs.io/learn-es2015/#iterators--forof) ================================================ FILE: ets.md ================================================ --- title: Erlang ETS category: Elixir weight: -1 --- ## ETS ### Usage ```elixir iex> table = :ets.new(:my_table, []) 8211 ``` ```elixir iex> :ets.insert(table, {:fruit, "Apple"}) iex> :ets.lookup(table, :fruit) [{:fruit, "Apple"}] ``` ```elixir iex> :ets.delete(table) iex> :ets.delete_all_objects(table) ``` ### Flags ```elixir iex> table = :ets.new(:my_table, [:set, :protected]) ``` {: .-setup} | `:set` | no duplicate keys (or: `:ordered_set`, `:bag`, `:duplicate_bag`) | | `:protected` | only this process can use it (or: `:public`, `:private`) | ### Ordered sets ```elixir :ets.first(table) :ets.last(table) :ets.next(table, key) :ets.prev(table, key) ``` ## References {: .-one-column} * * ================================================ FILE: expectjs.md ================================================ --- title: expect.js category: JavaScript libraries updated: 2017-09-02 weight: -1 --- ### Using ``` npm install --save-dev expect ``` {: .-setup} ```js // using ES6 modules import expect, { createSpy, spyOn, isSpy } from 'expect' ``` ```js // using CommonJS modules var expect = require('expect') var createSpy = expect.createSpy var spyOn = expect.spyOn var isSpy = expect.isSpy ``` Expect is a library for assertions in tests. See: [mjackson/expect](https://github.com/mjackson/expect) ### Assertions ```js expect(x).toBe(y) .toBe(val) .toEqual(val) .toThrow(err) .toExist() // aka: toBeTruthy() .toNotExist() // aka: toBeFalsy() .toBeA(constructor) .toBeA('string') .toMatch(/expr/) .toBeLessThan(n) .toBeGreaterThan(n) .toBeLessThanOrEqualTo(n) .toBeGreaterThanOrEqualTo(n) .toInclude(val) // aka: toContain(val) .toExclude(val) .toIncludeKey(key) .toExcludeKey(key) ``` Also: `toNotBe`, `toNotEqual`, etc for negatives. ### Chaining assertions ```js expect(3.14) .toExist() .toBeLessThan(4) .toBeGreaterThan(3) ``` Assertions can be chained. ### Spies ```js const video = { play: function () { ··· } } ``` {: .-setup} ```js spy = expect.spyOn(video, 'play') ``` ```js spy = expect.spyOn(···) .andCallThrough() // pass through .andCall(fn) .andThrow(exception) .andReturn(value) ``` ### Assertions on spies ```js expect(spy.calls.length).toEqual(1) expect(spy.calls[0].context).toBe(video) expect(spy.calls[0].arguments).toEqual([ 'some', 'args' ]) expect(spy.getLastCall().arguments).toEqual(...) ``` ```js expect(spy).toHaveBeenCalled() expect(spy).toHaveBeenCalledWith('some', 'args') ``` ### References - - ================================================ FILE: express.md ================================================ --- title: Express.js category: JavaScript libraries --- ### Settings ```js app.set('x', 'yyy') app.get('x') //=> 'yyy' app.enable('trust proxy') app.disable('trust proxy') app.enabled('trust proxy') //=> true ``` ### Env ```js app.get('env') ``` ### Config ```js app.configure('production', function() { app.set... }) ``` ### Wares ```js app.use(express.static(__dirname + '/public')) app.use(express.logger()) ``` ### Helpers ```js app.locals({ title: "MyApp", }) ``` ## Request & response ### Request ```js // GET /user/tj req.path //=> "/user/tj" req.url //=> "/user/tj" req.xhr //=> true|false req.method //=> "GET" req.params req.params.name //=> "tj" req.params[0] ``` ```js // GET /search?q=tobi+ferret req.query.q // => "tobi ferret" ``` ```js req.cookies ``` ```js req.accepted // [ { value: 'application/json', quality: 1, type: 'application', subtype: 'json' }, // { value: 'text/html', quality: 0.5, type: 'text',subtype: 'html' } ] ``` ```js req.is('html') req.is('text/html') ``` ```js req.headers req.headers['host'] req.headers['user-agent'] req.headers['accept-encoding'] req.headers['accept-language'] ``` ### Response ```js res.redirect('/') res.redirect(301, '/') ``` ```js res.set('Content-Type', 'text/html') ``` ```js res.send('hi') res.send(200, 'hi') ``` ```js res.json({ a: 2 }) ``` ================================================ FILE: exunit.md ================================================ --- title: ExUnit category: Elixir updated: 2018-11-19 --- ### Test cases ```elixir defmodule MyTest do use ExUnit.Case use ExUnit.Case, async: true # for async test "the truth" do assert 1 + 1 == 2 end end ``` ### Capture IO ```elixir import ExUnit.CaptureIO test "capture io" do result = capture_io(fn -> IO.puts "sup" end) assert result == "sup\n" end ``` ### Capture logs ```elixir config :ex_unit, capture_logs: true ``` ### Async ```elixir defmodule AssertionTest do # run concurrently with other test cases use ExUnit.Case, async: true end ``` ### Assertions ```elixir assert x == y refute x == y assert_raise ArithmeticError, fn -> 1 + "test" end assert_raise ArithmeticError, "message", fn -> ... assert_raise ArithmeticError, ~r/message/, fn -> ... flunk "This should've been an error" ``` See: [Assertions](http://devdocs.io/elixir/ex_unit/exunit.assertions) ## Setup ### Pattern matching ```elixir setup do {:ok, name: "John"} end ``` ```elixir test "it works", %{name: name} do assert name == "John" end ``` ### Setup ```elixir defp my_hook(_context) do # Invoked in every block in "a block" {:ok, name: "John", age: 54} end describe "a block" do setup [:my_hook] test "John's age", context do assert context[:name] == "John" assert context[:age] == 54 end end ``` ## Also see {: .-one-column} * [ExUnit Docs](http://devdocs.io/elixir/ex_unit/exunit#configure/1) ================================================ FILE: factory_bot.md ================================================ --- title: Factory Bot category: Ruby libraries weight: -3 updated: 2020-07-06 keywords: - "FactoryBot.define do" - "factory :user" - "first_name 'John'" - "sequence(:username) { |n| \"user#{n}\" }" tags: [Featurable] --- ## Factories {: .-three-column} ### Introduction {: .-intro} [Factory Bot](http://www.rubydoc.info/gems/factory_bot/) is a helper for writing factories for Ruby tests. It was previously known as Factory Girl. For older versions, use `FactoryGirl` instead of `FactoryBot`. - [Factory Bot documentation](http://www.rubydoc.info/gems/factory_bot/) _(rubydoc.info)_ - [Getting started](https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md) _(github.com)_ - [Source code](https://github.com/thoughtbot/factory_bot) _(github.com)_ ### Defining factories ```ruby FactoryBot.define do factory :user do first_name { 'John' } last_name { 'Doe' } birthdate { 21.years.ago } admin { false } sequence(:username) { |n| "user#{n}" } end end ``` {: data-line="2"} See: [Defining factories](http://www.rubydoc.info/gems/factory_bot/file/GETTING_STARTED.md#Defining_factories) ### Extra options #### Custom class names ```ruby factory :user, class: 'User' do ··· end ``` #### Aliases ```ruby factory :user, aliases: [:author] do ··· end ``` ### Using #### Build a model ```ruby FactoryBot.build(:user) ``` #### Other ways ```ruby build(:user) # → model (not saved) create(:user) # → model (saved) attributes_for(:user) # → hash build_stubbed(:user) # stubbed out attributes ``` #### With options ```ruby build(:user, name: 'John') ``` #### Lists ```ruby create_list(:user, 3) build_list(:user, 3) ``` ## Associations ### Defining ```ruby factory :post do association :author, factory: :user association :author, factory: [:user, :admin] end ``` {: data-line="2,3"} #### or ```ruby factory :post do author # assumes there's a factory :author end ``` ### After-create hooks ```ruby factory :post do after :create do |post| create :theme, post: post # has_one create_list :comment, 3, post: post # has_many end end ``` {: data-line="2"} ## Other features {: .-three-column} ### Traits ```ruby factory :user do trait :admin do admin { true } end end ``` {: data-line="2,3,4"} ```ruby create :user, :admin ``` Traits allow you to group attributes together. See: [Traits](http://www.rubydoc.info/gems/factory_bot/file/GETTING_STARTED.md#Traits) ### Nested factories ```ruby factory :user do first_name { 'John' } factory :sample_user do first_name { FFaker::Name.first_name } end end ``` {: data-line="4,5,6"} ```ruby create :sample_user ``` See: [Inheritance](http://www.rubydoc.info/gems/factory_bot/file/GETTING_STARTED.md#Inheritance) ### Sub-factories ```ruby factory :user do ··· end ``` ```ruby factory :sample_user, parent: :user do first_name { FFaker::Name.first_name } end ``` {: data-line="1"} ```ruby create :sample_user ``` Works the same as nested factories. ### Options (transients) ```ruby factory :user do transient do upcased { true } end after :create do |user, options| user.name.upcase! if options.upcased end end ``` {: data-line="2,3,4"} ```ruby create(user, upcased: true) ``` Transient attributes will not get passed to the model, but will be available in after-create hooks. See: [Transient attributes](http://www.rubydoc.info/gems/factory_bot/file/GETTING_STARTED.md#Transient_Attributes) ### Paths * test/factories.rb * spec/factories.rb * test/factories/*.rb * spec/factories/*.rb Place your factories in these locations. {: .-setup} ## See also {: .-one-column} * ================================================ FILE: fastify.md ================================================ --- title: Fastify category: JavaScript libraries updated: 2017-09-23 --- ## Getting started ### Introduction {: .-intro} [Fastify](https://github.com/fastify/fastify) lets you create HTTP servers in Node.js with good performance. This guide targets fastify v0.28.x. - [Fastify source code](https://github.com/fastify/fastify) _(github.com)_ - [Documentation](https://github.com/fastify/fastify#documentation) _(github.com)_ ### Hello world {: .-prime} ```js const fastify = require('fastify')() fastify.get('/', (req, reply) => { reply.send({ hello: 'world' }) }) fastify.listen(3000, err => { if (err) throw err const port = fastify.server.address().port console.log(`server listening on ${port}`) }) ``` ### Plugins #### app.js ```js fastify.register(require('./route')) ``` #### route.js ```js function (fastify, opts, next) { fastify.get('/', (req, reply) => { reply.send({ hello: 'world' }) }) next() }) ``` Compose your app functionality into plugins. Plugins are simply functions. See: [Plugins](https://github.com/fastify/fastify/blob/master/docs/Plugins.md) ## Routes ### Writing routes ```js fastify.route({ method: 'GET', url: '/', schema: { ··· }, handler: (req, reply) => { ··· } beforeHandler: (req, reply, done) => { ··· } }) ``` ### Shorthand declarations ```js fastify.get(path, [options], handler) fastify.head(···) fastify.post(···) fastify.put(···) fastify.delete(···) fastify.options(···) fastify.patch(···) ``` ### Async/await ```js fastify.get('/', options, async (req, reply) => { return data // or reply.send(data) }) ``` When using async functions, you can either `return` data or use `reply.send`. Request/reply ------------- ### Request ```js request.query request.body request.params request.headers request.req // Node.js core request.log.info('hello') ``` See: [Request](https://github.com/fastify/fastify/blob/master/docs/Request.md) ### Reply #### Response headers ```js reply.code(404) reply.header('Content-Type', 'text/html') reply.type('text/html') ``` #### Redirects ```js reply.redirect('/foo') reply.redirect(302, '/foo') ``` #### Sending ```js reply.send(payload) reply.sent // → true|false ``` See: [Reply](https://github.com/fastify/fastify/blob/master/docs/Reply.md) ### JSON schema #### Define a JSON schema ```js const schema = { querystring: { name: { type: 'string' }, excitement: { type: 'integer' } }, response: { 200: { type: 'object', properties: { hello: { type: 'string' } } } } } ``` #### Pass it to the route ```js fastify.get('/', { schema }, (req, reply) => { ··· }) ``` {: data-line="1"} #### or (same as above) ```js fastify.route({ method: 'GET', url: '/', schema, handler: (req, reply) => { ··· } }) ``` {: data-line="4"} By defining a JSON schema, you get validation and improved performance. See: [Validation and serialization](https://github.com/fastify/fastify/blob/master/docs/Validation-and-Serialization.md) Plugins ------- ### With function ```js fastify.register( require('./route'), err => { if (err) throw err } ) ``` {: data-line="3"} #### route.js ```js module.exports = (fastify, options, next) => { fastify.get('/', ···) next() } ``` See: [Register](https://github.com/fastify/fastify/blob/master/docs/Getting-Started.md#register) ### Multiple ```js fastify.register([ require('./another-route'), require('./yet-another-route') ], opts, (err) => { if (err) throw err }) ``` You can pass arrays to `register()`. ### Register with prefix ```js fastify.register( require('./route'), { prefix: '/v1' } ) ``` This prefixes all routes in that module. ### Helmet ```js const helmet = require('fastify-helmet') fastify.register(helmet) ``` See: [fastify-helmet](https://github.com/fastify/fastify-helmet) ### fastify-plugin ```js const fp = require('fastify-plugin') module.exports = fp((fastify, opts, next) => { // your plugin code fastify.decorate('utility', () => {}) next() }, '0.x') ``` Allows you to limit Fastify versions via semver, and allows you not make a new Fastify scope. See: [fastify-plugin](https://github.com/fastify/fastify-plugin) ### Decorators Middleware ---------- ### Middleware ```js fastify.use(require('cors')()) fastify.use(require('dns-prefetch-control')()) fastify.use(require('frameguard')()) fastify.use(require('hide-powered-by')()) fastify.use(require('hsts')()) fastify.use(require('ienoopen')()) fastify.use(require('x-xss-protection')()) ``` Compatible with Express and Restify middlewares. (Don't use these middleware, these are covered by [fastify-helmet](https://github.com/fastify/fastify-helmet).) See: [Middlewares](https://github.com/fastify/fastify/blob/master/docs/Middleware.md) Template rendering ------------------ ### point-of-view ```js const fastify = require('fastify')() fastify.register(require('point-of-view'), { engine: { ejs: require('ejs') } }) ``` {: data-line="3"} ```js fastify.get('/', (req, reply) => { reply.view('/templates/index.ejs', { text: 'text' }) }) ``` {: data-line="2"} Support `ejs`, `pug`, `handlebars` and `marko`. See: [point-of-view](https://github.com/fastify/point-of-view) ### Options ```js fastify.register(require('point-of-view'), { engine: { ejs: require('ejs') }, templates: '/templates', options: {} }) ``` `templates` lets you update the templates folder. `options` are options passed onto the template engines. ================================================ FILE: ffaker.md ================================================ --- title: FFaker category: Ruby libraries updated: 2017-09-12 --- ## FFaker {: .-one-column} ### Installing ```ruby # gem install ffaker require 'ffaker' ``` ## Faker::Address {: .-one-column} ```ruby Faker::Address.city #=> "Autumnside" #=> "South Brielleberg" #=> "West Alvera" ``` ```ruby Faker::Address.street_name #=> "Greyson Rapid" #=> "Hoppe Grove" #=> "Reichert Lights" ``` ```ruby Faker::Address.street_address #=> "98786 Neal Motorway" #=> "6619 Yvonne Dale" #=> "6143 Bailey Plaza" ``` ```ruby Faker::Address.secondary_address #=> "Suite 560" #=> "Apt. 332" #=> "Apt. 411" ``` ## Faker::Company {: .-one-column} ```ruby Faker::Company.name #=> "Pouros-Ondricka" #=> "Ward Group" #=> "Walter-Romaguera" ``` ```ruby Faker::Company.suffix #=> "and Sons" #=> "LLC" #=> "and Sons" ``` ```ruby Faker::Company.catch_phrase #=> "Versatile mobile help-desk" #=> "Extended fresh-thinking utilisation" #=> "Reactive coherent flexibility" ``` ```ruby Faker::Company.bs #=> "extend one-to-one convergence" #=> "architect 24/7 interfaces" #=> "revolutionize viral vortals" ``` ```ruby Faker::Company.position #=> "General Corporate President" #=> "Executive Department Consultant" #=> "Associate Director" ``` ## Faker::Education {: .-one-column} ```ruby Faker::Education.school #=> "Larkwood Institution" #=> "Whiteshire School" #=> "California International College" ``` ```ruby Faker::Education.degree #=> "Bachelor of Science in Political Administration" #=> "Doctor of Medicine in Marketing Economics" #=> "Bachelor of Music in Marketing Development" ``` ```ruby Faker::Education.degree_short #=> "MD in Industrial Arts" #=> "DPhil in Social Management" #=> "AB in Political Science" ``` ```ruby Faker::Education.major #=> "Financial Philosophy" #=> "Social Arts" #=> "Business Accountancy" ``` ```ruby Faker::Education.school_name #=> "Larkfield" #=> "Northshire" #=> "Lakepoint" ``` ## Faker::Geolocation {: .-one-column} ```ruby Faker::Geolocation.lat #=> 40.89505 #=> 41.77117 #=> 41.022921 ``` ```ruby Faker::Geolocation.lng #=> -115.120716573 #=> -118.427610513239 #=> -72.204989 ``` ## Faker::Internet {: .-one-column} ```ruby Faker::Internet.email #=> "dayna@auer.name" #=> "joy@nienowbradtke.info" #=> "bernhard@wyman.ca" ``` ```ruby Faker::Internet.user_name #=> "emory" #=> "janelle_schamberger" #=> "brigitte.dooley" ``` ```ruby Faker::Internet.domain_name #=> "langworth.biz" #=> "corkery.info" #=> "schroeder.uk" ``` ```ruby Faker::Internet.disposable_email #=> "barrett_schroeder@spamherelots.com" #=> "nicholaus@suremail.info" #=> "gladys@safetymail.info" ``` ```ruby Faker::Internet.free_email #=> "lemuel@yahoo.com" #=> "nickolas.gulgowski@gmail.com" #=> "isaac_ankunding@gmail.com" ``` ```ruby Faker::Internet.domain_word #=> "purdykutch" #=> "sauer" #=> "trantowmaggio" ``` ```ruby Faker::Internet.domain_suffix #=> "us" #=> "info" #=> "biz" ``` ## Faker::Job {: .-one-column} ```ruby Faker::Job.title #=> "Future Data Assistant" #=> "Product Division Technician" #=> "Product Research Developer" ``` ## Faker::Lorem {: .-one-column} ```ruby Faker::Lorem.word #=> "sint" #=> "sit" #=> "omnis" ``` ```ruby Faker::Lorem.sentence #=> "Expedita et aspernatur eum sit ipsam culpa." #=> "Rem sunt voluptatem laborum dolores." #=> "Ad explicabo atque culpa." ``` ```ruby Faker::Lorem.paragraph #=> "Quidem deserunt qui atque labore sunt quis laborum. Et iste # laudantium nobis adipisci delectus. Quod vero repudiandae m # agni repellat totam. Id ullam a aperiam et laboriosam. Volup # tas aut perspiciatis o..." #=> "Dolor et quae quisquam placeat. Accusantium quidem totam no # n et deleniti accusamus hic. Iure quidem inventore molestiae # harum magni dolor. Deleniti ex a voluptas nihil temporibus. # " #=> "Fugiat sapiente vero voluptatum natus assumenda quam beatae # in. Nemo velit incidunt dolor perspiciatis. Ipsum minima oc # caecati est laudantium ducimus libero. Et fugit et adipisci # molestias. Cupiditate ..." ``` ```ruby Faker::Lorem.words(4) #=> ["repellat", "quos", "amet", "voluptatem"] #=> ["porro", "molestias", "ut", "qui"] #=> ["blanditiis", "soluta", "enim", "fugit"] ``` ```ruby Faker::Lorem.sentence(5) #=> "Laborum sint voluptate voluptatem rem doloremque et incidun # t itaque." #=> "Autem atque eum laborum alias perspiciatis debitis suscipit # deserunt sint." #=> "Quaerat nam consectetur eum dolor deleniti tempore doloremq # ue et aspernatur." ``` ```ruby Faker::Lorem.sentences(3) #=> ["Culpa debitis architecto est.", "Quo et voluptatem distinc # tio repellendus qui cupiditate.", "Quo repellendus ut eius." # ] #=> ["Quos nihil dolorem quidem maxime.", "Expedita ab veniam do # lorum at et placeat iure.", "In perspiciatis cupiditate amet # non saepe consequatur molestias minus."] #=> ["Quasi velit et voluptas est.", "Dolores ut dolor aut repel # lat fuga minima sed quia.", "Eum id minus atque ex modi."] ``` ```ruby Faker::Lorem.paragraphs(3) #=> ["Iusto mollitia sequi nam perspiciatis fuga aut. Modi moles # tiae consectetur architecto et dolorem aut perferendis. Cumq # ue rerum aliquam sapiente. Dolorum quo reiciendis nemo vero. # Quo earum explicabo pariatur.", "Possimus omnis accusamus f # uga. Harum sint facere sed dolor itaque quia. Ullam optio at # que vel nihil facilis quidem accusantium sint.", "Itaque per # ferendis saepe pariatur maxime expedita laborum qui. Ea nemo # dolor aut. In sed sit minus itaque sit."] #=> ["Ducimus non quo qui doloremque aperiam aspernatur. Consequ # atur id qui sit occaecati. Incidunt tempora quia et. Esse vo # luptatem debitis similique ab totam sit. Illo neque vel face # re maxime voluptatum non voluptatem.", "Aut eveniet consequa # tur laudantium veniam qui dolores. Provident pariatur perspi # ciatis id. Eum iste id quasi. Esse nihil quis rerum laudanti # um aliquam molestiae eum tempora.", "Quia porro sint numquam # qui. Ut sint reiciendis quis pariatur veniam nesciunt optio # . Officia unde fugit distinctio dolorem voluptatem incidunt. # Ex omnis sit et non aut."] #=> ["Dicta consequatur sapiente saepe fugiat ut. Necessitatibus # enim explicabo qui fugiat occaecati expedita quis. Quo iust # o magnam facere nihil earum.", "In deleniti explicabo veniam # dolorem temporibus enim. Delectus exercitationem ipsum dolo # r modi. Aut quia voluptas velit sint aperiam sed eveniet.", # "Quo doloribus explicabo ut magnam quasi. Voluptatem debitis # quaerat aperiam. Accusantium quis voluptatem dolorem."] ``` ## Faker::HipsterIpsum {: .-one-column} ```ruby Faker::HipsterIpsum.paragraph #=> "Wayfarers mustache thundercats pitchfork messenger bag high # life. Beard messenger bag wayfarers squid vinyl letterpress # party iphone jean shorts. Lomo irony before they sold out e # thical wayfarers scene..." #=> "Tofu stumptown cliche sartorial vhs letterpress keffiyeh wi # lliamsburg. Whatever jean shorts williamsburg lomo salvia fo # od truck 8-bit. Cosby sweater portland artisan wayfarers vhs # photo booth." #=> "Skateboard fanny pack wes anderson sartorial cred gluten-fr # ee vinyl marfa locavore. Messenger bag master cleanse mlkshk # vegan thundercats beard wes anderson brunch. Helvetica mess # enger bag lo-fi four l..." ``` ## Faker::HTMLIpsum {: .-one-column} ```ruby Faker::HTMLIpsum.body #=> "

Exercitationem et

<..." #=> "

Excepturi sequi

EligendiVelSedAt
..." #=> "

Iusto voluptatem

Laborum velit ducimus eius. Mol # estiae id vel ipsam a accusantium et ut. Sunt et fugiat qui # sint ab quia. Eum ut molestiae cumque molestiae error volupt # ates. Ipsum molestiae ..." ``` ```ruby Faker::HTMLIpsum.table #=> "

Quam # EiusQuibusdamTotam
VoluptatemPorroTene # turFacilis
Numquam< # /t..." #=> "..." #=> "
ImpeditVoluptatemQu # iEst
Nihil
..." ``` ```ruby Faker::HTMLIpsum.fancy_string #=> "Velit e # staperiam reiciendis Consectetur aut hic e # um quisquam. Dolore aut rerum dolor accusantium ab repellend # us magni. Deserunt optio o..." #=> "Et vel similique ullam accusantium laboriosam. Sit ut ea to # tam. Iusto praesentium ut molestiae. Voluptatem laudantium a # ut qui adipisci. Est saepe repellendus qui blanditiis volupt # ates sed odit ullam. <..." #=> "Neque et omnis ipsam ad culpa maiores inventore. Laborum cu # m est fugit libero repellendus vero. Modi pariatur sunt tene # tur soluta inventore ratione. Iste consequuntur quia omnis n # umquam excepturi quod ..." ``` ## Faker::Name {: .-one-column} ```ruby Faker::Name.name #=> "Trevion Herman V" #=> "Aracely Balistreri" #=> "Daphnee Terry Sr." ``` ```ruby Faker::Name.first_name #=> "Aliza" #=> "Joseph" #=> "Orland" ``` ```ruby Faker::Name.last_name #=> "Hand" #=> "Macejkovic" #=> "Heller" ``` ```ruby Faker::Name.prefix #=> "Dr." #=> "Ms." #=> "Mr." ``` ```ruby Faker::Name.suffix #=> "I" #=> "III" #=> "DDS" ``` ## Faker::PhoneNumber {: .-one-column} ```ruby Faker::PhoneNumber.phone_number #=> "335-364-4549 x430" #=> "040-278-4021 x753" #=> "420.645.4382" ``` ```ruby Faker::PhoneNumber.short_phone_number #=> "473-412-3192" #=> "353-084-1297" #=> "080-546-2356" ``` ## Faker::Product {: .-one-column} ```ruby Faker::Product.brand #=> "Trouffeforge" #=> "VIG" #=> "NDZ" ``` ```ruby Faker::Product.product_name #=> "Air HD Viewer" #=> "HD Kit" #=> "Air HD Bridge" ``` ```ruby Faker::Product.product #=> "Amnix Air HD Tuner" #=> "Panapod Audible Filter" #=> "Phuffe Disc Receiver" ``` ```ruby Faker::Product.model #=> "I-422" #=> "J89" #=> "L6" ``` ## Faker::NameCN {: .-one-column} ```ruby Faker::NameCN.name #=> "姵书虞" #=> "修男嵇" #=> "瑜人军" ``` ```ruby Faker::NameCN.last_first #=> "向坚舜" #=> "疏骏哲" #=> "秘合雪" ``` ```ruby Faker::NameCN.first_name #=> "佑淑" #=> "燕谦" #=> "重生" ``` ```ruby Faker::NameCN.last_name #=> "释" #=> "巩" #=> "麻" ``` ## Faker::NameDE {: .-one-column} ```ruby Faker::NameDE.name #=> "Noelle Schuster" #=> "Bendix Schmid" #=> "Azra Neumann" ``` ```ruby Faker::NameDE.first_name #=> "Victoria" #=> "Lotta" #=> "Mads" ``` ```ruby Faker::NameDE.last_name #=> "Martin" #=> "Klein" #=> "Walter" ``` ```ruby Faker::NameDE.prefix #=> "Frau" #=> "Prof." #=> "Prof." ``` ## Faker::NameJA {: .-one-column} ```ruby Faker::NameJA.name #=> "飛鳥田部" #=> "未杉浦" #=> "功本間" ``` ```ruby Faker::NameJA.last_first #=> "青木杏子" #=> "棚原大貴" #=> "知名翔" ``` ```ruby Faker::NameJA.first_name #=> "巴" #=> "浩子" #=> "沙耶" ``` ```ruby Faker::NameJA.last_name #=> "小栗" #=> "高江洲" #=> "友寄" ``` ## Faker::NameRU {: .-one-column} ```ruby Faker::NameRU.name #=> "Стелла Карнилина" #=> "Евгения Мазовская" #=> "Кузьма Ваиренко" ``` ```ruby Faker::NameRU.last_name #=> "Манишева" #=> "Тюлева" #=> "Понченко" ``` ```ruby Faker::NameRU.first_name #=> "Артур" #=> "Руслана" #=> "Зинаида" ``` ```ruby Faker::NameRU.patronymic #=> "Мечеславович" #=> "Ионович" #=> "Исаевич" ``` ```ruby Faker::NameRU.name(:male) #=> "Слежиков Роман Всеволодович" #=> "Осип Мугрузин" #=> "Джиджаев Гавриил Леванович" ``` ```ruby Faker::NameRU.name(:female) #=> "Зиядтдинова Полина Людвиговна" #=> "Андреева Тереза Арсеновна" #=> "Дарина Минхазова" ``` ## Faker::NameSN {: .-one-column} ```ruby Faker::NameSN.name_sn #=> "mame Djaly Mbodj" #=> "Hatab Samy" #=> "Niouma Dramé" ``` ```ruby Faker::NameSN.name_male #=> "serigne Yakou Diagne" #=> "serigne Sécouba Diagne" #=> "Sihalébé Badji" ``` ```ruby Faker::NameSN.name_female #=> "Thiomba Niang" #=> "adjaratou Kiné Panduppy" #=> "Nini Gakou" ``` ```ruby Faker::NameSN.first_name_male #=> "Khoudia" #=> "Sanokho" #=> "Diomaye" ``` ```ruby Faker::NameSN.first_name_female #=> "Assa" #=> "Sahaba" #=> "Manthita" ``` ```ruby Faker::NameSN.prefix_male #=> "eladji" #=> "eladji" #=> "serigne" ``` ```ruby Faker::NameSN.prefix_female #=> "adjaratou" #=> "adja" #=> "adja" ``` ## Faker::PhoneNumberAU {: .-one-column} ```ruby Faker::PhoneNumberAU.phone_number #=> "0495 539 191" #=> "(05) 6838 2406" #=> "0496 013 652" ``` ## Faker::PhoneNumberSN {: .-one-column} ```ruby Faker::PhoneNumberSN.phone_number #=> "77-356-93-09" #=> "33-891-67-75" #=> "33-886-02-02" ``` ================================================ FILE: ffmpeg.md ================================================ --- title: ffmpeg category: CLI --- ### Common switches ```bash -codecs # list codecs -c:v # video codec (-vcodec) - 'copy' to copy stream -c:a # audio codec (-acodec) ``` ```bash -fs SIZE # limit file size (bytes) ``` ### Bitrate ```bash -b:v 1M # video bitrate (1M = 1Mbit/s) -b:a 1M # audio bitrate ``` ### Video ```bash -aspect RATIO # aspect ratio (4:3, 16:9, or 1.25) -r RATE # frame rate per sec -s WIDTHxHEIGHT # frame size -vn # no video ``` ### Audio ```bash -aq QUALITY # audio quality (codec-specific) -ar 44100 # audio sample rate (hz) -ac 1 # audio channels (1=mono, 2=stereo) -an # no audio -vol N # volume (256=normal) ``` ## Example ### Ringtone conversion using ffmpeg ```bash ffmpeg -i foo.mp3 -ac 1 -ab 128000 -f mp4 -acodec libfaac -y target.m4r ``` ### To web ```bash # no audio ffmpeg -i input.mov -vcodec h264 -an -strict -2 output.mp4 ffmpeg -i input.mov -vcodec libvpx -an output.webm ``` ```bash ffmpeg -i input.mov -vcodec h264 -acodec aac -strict -2 output.mp4 ffmpeg -i input.mov -vcodec libvpx -acodec libvorbis output.webm ``` ```html ``` ================================================ FILE: figlet.md ================================================ --- title: Figlet updated: 2018-06-14 introduction: | [Figlet] renders text as ASCII art. Here's a list of Figlet fonts for Figlet 2.2.5. [Figlet]: http://www.figlet.org/ # Generated using this script: # # #!/usr/bin/env bash # do_figlet() { # name=$1 # echo "### $name" # echo "" # echo "\`\`\`" # # echo Hamburger | figlet -f $name -w 2000 # # echo "\`\`\`" # echo "{: .-figlet}" # echo "" # } # # echo "## Figlet fonts" # echo "" # # for fn in /usr/local/share/figlet/fonts/*.flf; do # name=$(basename ${fn%.flf}) # do_figlet $name # done # # echo "" # echo "## Toilet fonts" # echo "" # # for fn in /usr/local/share/figlet/*.tlf; do # name=$(basename ${fn%.tlf}) # do_figlet $name # done --- ### Usage ```bash echo "Hamburger" | figlet -f cybermedium ``` ``` _ _ ____ _ _ ___ _ _ ____ ____ ____ ____ |__| |__| |\/| |__] | | |__/ | __ |___ |__/ | | | | | | |__] |__| | \ |__] |___ | \ ``` {: .-figlet} Run `figlet` with `-f ` to use a font. ### Toilet fonts ```bash echo "Hello" | \ figlet -f smmono12 -d /usr/local/share/figlet ``` Figlet comes with support for Toilet fonts, which are in `{share}/figlet`. This is not the default font dir, so you'll have to use `-d ` to access it. ## Rico's favorites ### wideterm ``` Hamburger ``` {: .-figlet} ### stampatello ``` ,-_/,. . ' |_|/ ,-. ,-,-. |-. . . ,-. ,-. ,-. ,-. /| | ,-| | | | | | | | | | | |-' | `' `' `-^ ' ' ' ^-' `-^ ' `-| `-' ' ,| `' ``` {: .-figlet} ### cybermedium ``` _ _ ____ _ _ ___ _ _ ____ ____ ____ ____ |__| |__| |\/| |__] | | |__/ | __ |___ |__/ | | | | | | |__] |__| | \ |__] |___ | \ ``` {: .-figlet} ### cyberlarge ``` _ _ _______ _______ ______ _ _ ______ ______ _______ ______ |_____| |_____| | | | |_____] | | |_____/ | ____ |______ |_____/ | | | | | | | |_____] |_____| | \_ |_____| |______ | \_ ``` {: .-figlet} ### thin ``` | | | |---|,---.,-.-.|---.. .,---.,---.,---.,---. | |,---|| | || || || | ||---'| ` '`---^` ' '`---'`---'` `---|`---'` `---' ``` {: .-figlet} ### smbraille ``` ⣇⣸ ⢀⣀ ⣀⣀ ⣇⡀ ⡀⢀ ⡀⣀ ⢀⡀ ⢀⡀ ⡀⣀ ⠇⠸ ⠣⠼ ⠇⠇⠇ ⠧⠜ ⠣⠼ ⠏ ⣑⡺ ⠣⠭ ⠏ ``` {: .-figlet} ### rectangles ``` _____ _ | | |___ _____| |_ _ _ ___ ___ ___ ___ | | .'| | . | | | _| . | -_| _| |__|__|__,|_|_|_|___|___|_| |_ |___|_| |___| ``` {: .-figlet} ### bell ``` __ __ _ | | ___ , _ , _ \ ___ , . .___ ___. ___ .___ |___| / ` |' `|' `. |/ \ | | / \ .' ` .' ` / \ | | | | | | | | ` | | | ' | | |----' | ' / / `.__/| / ' / `___,' `._/| / `---| `.___, / \___/ ``` {: .-figlet} ## Figlet fonts ### 3-d ``` ** ** ** /** /** /** ***** /** /** ****** ********** /** ** ** ****** **///** ***** ****** /********** //////** //**//**//**/****** /** /**//**//*/** /** **///**//**//* /**//////** ******* /** /** /**/**///**/** /** /** / //******/******* /** / /** /** **////** /** /** /**/** /**/** /** /** /////**/**//// /** /** /**//******** *** /** /**/****** //******/*** ***** //******/*** // // //////// /// // // ///// ////// /// ///// ////// /// ``` {: .-figlet} ### 3x5 ``` # # # # # ## ### ### # # ### ### ### ### ### # # ### # # # # # # # ## # # # ### # # ### ### # ## ### # # # ### ``` {: .-figlet} ### 5lineoblique ``` // / / //___ / / ___ _ __ / __ __ ___ ___ __ / ___ / // ) ) // ) ) ) ) // ) ) // / / // ) ) // ) ) //___) ) // ) ) // / / // / / // / / / / // / / // / / // ((___/ / // // // / / ((___( ( // / / / / ((___/ / ((___( ( // //__ ((____ // ``` {: .-figlet} ### acrobatic ``` o o o <|> <|> <|> < > < > / > | | o__ __o/ \o__ __o__ __o \o__ __o o o \o__ __o o__ __o/ o__ __o \o__ __o o__/_ _\__o /v | | | |> | v\ <|> <|> | |> /v | /v |> | |> | | /> / \ / \ / \ / \ / \ <\ < > < > / \ < > /> / \ /> // / \ < > \ \o/ \o/ \o/ \o/ \o/ / | | \o/ \ \o/ \o o/ \o/ | | o | | | | | o o o | o | v\ /v __o | / \ / \ <\__ / \ / \ / \ / \ / \ __/> <\__ __/> / \ <\__ < > <\/> __/> / \ | o__ o <\__ __/> ``` {: .-figlet} ### alligator ``` ::: ::: ::: ::: ::: ::::::::: ::: :::::::::::: :::::::: ::::::::::::::::::: :+: :+: :+: :+: :+:+: :+:+: :+: :+::+: :+::+: :+::+: :+::+: :+: :+: +:+ +:+ +:+ +:+ +:+ +:+:+ +:++:+ +:++:+ +:++:+ +:++:+ +:+ +:+ +:+ +#++:++#+++#++:++#++:+#+ +:+ +#++#++:++#+ +#+ +:++#++:++#: :#: +#++:++# +#++:++#: +#+ +#++#+ +#++#+ +#++#+ +#++#+ +#++#+ +#++#+ +#+#+#+ +#+ +#+ #+# #+##+# #+##+# #+##+# #+##+# #+##+# #+##+# #+##+# #+# #+# ### ###### ###### ############ ######## ### ### ######## ############# ### ``` {: .-figlet} ### alligator2 ``` ::: ::: ::: :::: :::: ::::::::: ::: :::::::::::: :::::::: ::::::::::::::::::: :+: :+: :+: :+: +:+:+: :+:+:+:+: :+::+: :+::+: :+::+: :+::+: :+: :+: +:+ +:+ +:+ +:+ +:+ +:+:+ +:++:+ +:++:+ +:++:+ +:++:+ +:+ +:+ +:+ +#++:++#+++#++:++#++:+#+ +:+ +#++#++:++#+ +#+ +:++#++:++#: :#: +#++:++# +#++:++#: +#+ +#++#+ +#++#+ +#++#+ +#++#+ +#++#+ +#++#+ +#+#+#+ +#+ +#+ #+# #+##+# #+##+# #+##+# #+##+# #+##+# #+##+# #+##+# #+# #+# ### ###### ###### ############ ######## ### ### ######## ############# ### ``` {: .-figlet} ### alphabet ``` H H b H H b HHHH aa mmmm bbb u u rrr ggg eee rrr H H a a m m m b b u u r g g e e r H H aaa m m m bbb uuu r ggg ee r g ggg ``` {: .-figlet} ### avatar ``` _ ____ _ ____ _ ____ _____ _____ ____ / \ /|/ _ \/ \__/|/ _ \/ \ /\/ __\/ __// __// __\ | |_||| / \|| |\/||| | //| | ||| \/|| | _| \ | \/| | | ||| |-||| | ||| |_\\| \_/|| /| |_//| /_ | / \_/ \|\_/ \|\_/ \|\____/\____/\_/\_\\____\\____\\_/\_\ ``` {: .-figlet} ### banner ``` # # # # ## # # ##### # # ##### #### ###### ##### # # # # ## ## # # # # # # # # # # # ####### # # # ## # ##### # # # # # ##### # # # # ###### # # # # # # ##### # ### # ##### # # # # # # # # # # # # # # # # # # # # # # # ##### #### # # #### ###### # # ``` {: .-figlet} ### banner3-D ``` '##::::'##::::'###::::'##::::'##:'########::'##::::'##:'########:::'######:::'########:'########:: ##:::: ##:::'## ##::: ###::'###: ##.... ##: ##:::: ##: ##.... ##:'##... ##:: ##.....:: ##.... ##: ##:::: ##::'##:. ##:: ####'####: ##:::: ##: ##:::: ##: ##:::: ##: ##:::..::: ##::::::: ##:::: ##: #########:'##:::. ##: ## ### ##: ########:: ##:::: ##: ########:: ##::'####: ######::: ########:: ##.... ##: #########: ##. #: ##: ##.... ##: ##:::: ##: ##.. ##::: ##::: ##:: ##...:::: ##.. ##::: ##:::: ##: ##.... ##: ##:.:: ##: ##:::: ##: ##:::: ##: ##::. ##:: ##::: ##:: ##::::::: ##::. ##:: ##:::: ##: ##:::: ##: ##:::: ##: ########::. #######:: ##:::. ##:. ######::: ########: ##:::. ##: ..:::::..::..:::::..::..:::::..::........::::.......:::..:::::..:::......::::........::..:::::..:: ``` {: .-figlet} ### banner3 ``` ## ## ### ## ## ######## ## ## ######## ###### ######## ######## ## ## ## ## ### ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #### #### ## ## ## ## ## ## ## ## ## ## ######### ## ## ## ### ## ######## ## ## ######## ## #### ###### ######## ## ## ######### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ######## ####### ## ## ###### ######## ## ## ``` {: .-figlet} ### banner4 ``` .##.....##....###....##.....##.########..##.....##.########...######...########.########. .##.....##...##.##...###...###.##.....##.##.....##.##.....##.##....##..##.......##.....## .##.....##..##...##..####.####.##.....##.##.....##.##.....##.##........##.......##.....## .#########.##.....##.##.###.##.########..##.....##.########..##...####.######...########. .##.....##.#########.##.....##.##.....##.##.....##.##...##...##....##..##.......##...##.. .##.....##.##.....##.##.....##.##.....##.##.....##.##....##..##....##..##.......##....##. .##.....##.##.....##.##.....##.########...#######..##.....##..######...########.##.....## ``` {: .-figlet} ### barbwire ``` ><< ><< ><< ><< ><< ><< ><< ><< ><< ><<< ><< ><< ><< ><< ><<>< ><<< ><< ><< >< ><<< ><<<<<< ><< ><< ><< ><< >< ><<><< ><< ><< ><< ><< ><< ><< >< ><< ><< ><< ><<><< ><< ><< >< ><<><< ><<><< ><< ><< ><< ><<><<<<< ><< ><< ><< ><<><< ><< ><< >< ><<><< ><<><< ><< ><< ><< ><<>< ><< ><< ><< ><< ><<<><<< >< ><<><< ><< ><<><<><<< ><< ><<<< ><<< ><< ``` {: .-figlet} ### basic ``` db db .d8b. .88b d88. d8888b. db db d8888b. d888b d88888b d8888b. 88 88 d8' `8b 88'YbdP`88 88 `8D 88 88 88 `8D 88' Y8b 88' 88 `8D 88ooo88 88ooo88 88 88 88 88oooY' 88 88 88oobY' 88 88ooooo 88oobY' 88~~~88 88~~~88 88 88 88 88~~~b. 88 88 88`8b 88 ooo 88~~~~~ 88`8b 88 88 88 88 88 88 88 88 8D 88b d88 88 `88. 88. ~8~ 88. 88 `88. YP YP YP YP YP YP YP Y8888P' ~Y8888P' 88 YD Y888P Y88888P 88 YD ``` {: .-figlet} ### bell ``` __ __ _ | | ___ , _ , _ \ ___ , . .___ ___. ___ .___ |___| / ` |' `|' `. |/ \ | | / \ .' ` .' ` / \ | | | | | | | | ` | | | ' | | |----' | ' / / `.__/| / ' / `___,' `._/| / `---| `.___, / \___/ ``` {: .-figlet} ### big ``` _ _ _ | | | | | | | |__| | __ _ _ __ ___ | |__ _ _ _ __ __ _ ___ _ __ | __ |/ _` | '_ ` _ \| '_ \| | | | '__/ _` |/ _ \ '__| | | | | (_| | | | | | | |_) | |_| | | | (_| | __/ | |_| |_|\__,_|_| |_| |_|_.__/ \__,_|_| \__, |\___|_| __/ | |___/ ``` {: .-figlet} ### bigchief ``` _____________________________________________________________ _ _ / / / ---/___ /-----__---_--_---/__----------)__----__----__---)__- / / / ) / / ) / ) / / / ) / ) /___) / ) _/____/____(___(_/_/__/_(___/_(___(__/_____(___/_(___ _/_____ / (_ / ``` {: .-figlet} ### binary ``` 01001000 01100001 01101101 01100010 01110101 01110010 01100111 01100101 01110010 ``` {: .-figlet} ### block ``` _| _| _| _| _| _|_|_| _|_|_| _|_| _|_|_| _| _| _| _|_| _|_|_| _|_| _| _|_| _|_|_|_| _| _| _| _| _| _| _| _| _| _|_| _| _| _|_|_|_| _|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _|_|_| _| _| _| _|_|_| _|_|_| _| _|_|_| _|_|_| _| _| _|_| ``` {: .-figlet} ### broadway ``` . . 8 8888 8 .8. ,8. ,8. 8 888888888o 8 8888 88 8 888888888o. ,o888888o. 8 8888888888 8 888888888o. 8 8888 8 .888. ,888. ,888. 8 8888 `88. 8 8888 88 8 8888 `88. 8888 `88. 8 8888 8 8888 `88. 8 8888 8 :88888. .`8888. .`8888. 8 8888 `88 8 8888 88 8 8888 `88 ,8 8888 `8. 8 8888 8 8888 `88 8 8888 8 . `88888. ,8.`8888. ,8.`8888. 8 8888 ,88 8 8888 88 8 8888 ,88 88 8888 8 8888 8 8888 ,88 8 8888 8 .8. `88888. ,8'8.`8888,8^8.`8888. 8 8888. ,88' 8 8888 88 8 8888. ,88' 88 8888 8 888888888888 8 8888. ,88' 8 8888 8 .8`8. `88888. ,8' `8.`8888' `8.`8888. 8 8888888888 8 8888 88 8 888888888P' 88 8888 8 8888 8 888888888P' 8 8888888888888 .8' `8. `88888. ,8' `8.`88' `8.`8888. 8 8888 `88. 8 8888 88 8 8888`8b 88 8888 8888888 8 8888 8 8888`8b 8 8888 8 .8' `8. `88888. ,8' `8.`' `8.`8888. 8 8888 88 ` 8888 ,8P 8 8888 `8b. `8 8888 .8' 8 8888 8 8888 `8b. 8 8888 8 .888888888. `88888. ,8' `8 `8.`8888. 8 8888 ,88' 8888 ,d8P 8 8888 `8b. 8888 ,88' 8 8888 8 8888 `8b. 8 8888 8 .8' `8. `88888. ,8' ` `8.`8888. 8 888888888P `Y88888P' 8 8888 `88. `8888888P' 8 888888888888 8 8888 `88. ``` {: .-figlet} ### bubble ``` _ _ _ _ _ _ _ _ _ / \ / \ / \ / \ / \ / \ / \ / \ / \ ( H | a | m | b | u | r | g | e | r ) \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ ``` {: .-figlet} ### bulbhead ``` _ _ __ __ __ ____ __ __ ____ ___ ____ ____ ( )_( ) /__\ ( \/ )( _ \( )( )( _ \ / __)( ___)( _ \ ) _ ( /(__)\ ) ( ) _ < )(__)( ) /( (_-. )__) ) / (_) (_)(__)(__)(_/\/\_)(____/(______)(_)\_) \___/(____)(_)\_) ``` {: .-figlet} ### calgphy2 ``` ##### ## / ###### / #### / #/ /# / / ####/ ## / / / # # ## / / # ## ## ## # /### ### /### /### ## /### ## #### ### /### /### /## ### /### ## ## # / ### / ##/ ###/ /## / ##/ ### / ## ### / ###/ #### / / ### / / ### ###/ #### / ## ######## / ###/ ## ###/ ###/ ## ###/ ## ###/ ## ###/ / ###/ / ### ## ###/ ## ## # ## ## ## ## ## ## ## ## ## ## ## ## ## ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ######## ## # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ####### ## / ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## /##/ ## ## /# ## ## ## ## /# ## /# ## ## ## #### / ## / ##### ## ####/ ## ### ### ### ####/ ######/ ## ### ######## ######/ ### / ## ### ## ### ### ### ### ##### ## ### ### ### ##### ### # ### ## #### ### /###### /# / ###/ ``` {: .-figlet} ### calligraphy ``` ***** ** * ****** * **** * ** ** * * ***** ** * * * * * ** * * * ** ** **** *** **** *** **** ** ** * **** *** **** **** ** **** ** *** * **** **** * **** *** **** **** * ** ** * * *** * *** **** *** * *** *** * ** **** ** **** * *** * * *** ** **** ** ******** * **** ** **** **** ** **** ** ** ** * **** * *** ** ** ** * ** ** ** ** ** ** ** ** ** ** ** ** ** *** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ******** ** * ** ** ** ** ** ** ** ** ** ** ** ** ** ** ******* ** * ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **** ** ** ** ** ** ** ** ** ******* ** *** ** ** **** * *** * ***** ** ***** ** *** *** *** ***** ***** ** *** ******** ******* *** * ** *** ** *** *** *** *** *** *** ***** * *** ** **** *** ******* ** * **** ``` {: .-figlet} ### catwalk ``` _// _// _// _// _// _// _// _// _// _/// _// _// _// _// _//_/ _/// _// _// _/ _/// _////// _// _// _// _// _/ _//_// _// _// _// _// _// _// _/ _// _// _// _//_// _// _// _/ _//_// _//_// _// _// _// _//_///// _// _// _// _//_// _// _// _/ _//_// _//_// _// _// _// _//_/ _// _// _// _// _///_/// _/ _//_// _// _//_//_/// _// _//// _/// _// ``` {: .-figlet} ### chunky ``` _______ __ | | |.---.-.--------.| |--.--.--.----.-----.-----.----. | || _ | || _ | | | _| _ | -__| _| |___|___||___._|__|__|__||_____|_____|__| |___ |_____|__| |_____| ``` {: .-figlet} ### coinstak ``` O)) O)) O)) O)) O)) O)) O)) O)) O)) O))) O)) O)) O)) O)) O))O) O))) O)) O)) O) O))) O)))))) O)) O)) O)) O)) O) O))O)) O)) O)) O)) O)) O)) O)) O) O)) O)) O)) O))O)) O)) O)) O) O))O)) O))O)) O)) O)) O)) O))O))))) O)) O)) O)) O))O)) O)) O)) O) O))O)) O))O)) O)) O)) O)) O))O) O)) O)) O)) O)) O)))O))) O) O))O)) O)) O))O))O))) O)) O)))) O))) O)) ``` {: .-figlet} ### colossal ``` 888 888 888 888 888 888 888 888 888 8888888888 8888b. 88888b.d88b. 88888b. 888 888888d888 .d88b. .d88b. 888d888 888 888 "88b888 "888 "88b888 "88b888 888888P" d88P"88bd8P Y8b888P" 888 888.d888888888 888 888888 888888 888888 888 88888888888888 888 888888 888888 888 888888 d88PY88b 888888 Y88b 888Y8b. 888 888 888"Y888888888 888 88888888P" "Y88888888 "Y88888 "Y8888 888 888 Y8b d88P "Y88P" ``` {: .-figlet} ### computer ``` 8 8 8 8 eeeee eeeeeee eeeee e e eeeee eeeee eeee eeeee 8eee8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 88 8 8eee8 8e 8 8 8eee8e 8e 8 8eee8e 8e 8eee 8eee8e 88 8 88 8 88 8 8 88 8 88 8 88 8 88 "8 88 88 8 88 8 88 8 88 8 8 88eee8 88ee8 88 8 88ee8 88ee 88 8 ``` {: .-figlet} ### contessa ``` . . . |__| _.._ _ |_ . .._. _ _ ._. | |(_][ | )[_)(_|[ (_](/,[ ._| ``` {: .-figlet} ### contrast ``` .%%..%%...%%%%...%%...%%..%%%%%...%%..%%..%%%%%....%%%%...%%%%%%..%%%%%.. .%%..%%..%%..%%..%%%.%%%..%%..%%..%%..%%..%%..%%..%%......%%......%%..%%. .%%%%%%..%%%%%%..%%.%.%%..%%%%%...%%..%%..%%%%%...%%.%%%..%%%%....%%%%%.. .%%..%%..%%..%%..%%...%%..%%..%%..%%..%%..%%..%%..%%..%%..%%......%%..%%. .%%..%%..%%..%%..%%...%%..%%%%%....%%%%...%%..%%...%%%%...%%%%%%..%%..%%. ......................................................................... ``` {: .-figlet} ### cosmic ``` :: .: :::. . : :::::::. ... ::::::::::.. .,-:::::/ .,:::::: :::::::.. ,;; ;;, ;;`;; ;;,. ;;; ;;;'';;' ;; ;;;;;;;``;;;; ,;;-'````' ;;;;'''' ;;;;``;;;; ,[[[,,,[[[ ,[[ '[[, [[[[, ,[[[[, [[[__[[\.[[' [[[ [[[,/[[[' [[[ [[[[[[/[[cccc [[[,/[[[' "$$$"""$$$c$$$cc$$$c $$$$$$$$"$$$ $$""""Y$$$$ $$$ $$$$$$c "$$c. "$$ $$"""" $$$$$$c 888 "88o888 888,888 Y88" 888o_88o,,od8P88 .d888 888b "88bo,`Y8bo,,,o88o888oo,__ 888b "88bo, MMM YMMYMM ""` MMM M' "MMM""YUMMMP" "YmmMMMM"" MMMM "W" `'YMUP"YMM""""YUMMMMMMM "W" ``` {: .-figlet} ### cosmike ``` :: .: :::. . : :::::::. ... ::::::::::.. .,-:::::/ .,:::::: :::::::.. ,;; ;;, ;;`;; ;;,. ;;; ;;;'';;' ;; ;;;;;;;``;;;; ,;;-'````' ;;;;'''' ;;;;``;;;; ,[[[,,,[[[ ,[[ '[[, [[[[, ,[[[[, [[[__[[\.[[' [[[ [[[,/[[[' [[[ [[[[[[/[[cccc [[[,/[[[' "$$$"""$$$c$$$cc$$$c $$$$$$$$"$$$ $$""""Y$$$$ $$$ $$$$$$c "$$c. "$$ $$"""" $$$$$$c 888 "88o888 888,888 Y88" 888o_88o,,od8P88 .d888 888b "88bo,`Y8bo,,,o88o888oo,__ 888b "88bo, MMM YMMYMM ""` MMM M' "MMM""YUMMMP" "YmmMMMM"" MMMM "W" `'YMUP"YMM""""YUMMMMMMM "W" ``` {: .-figlet} ### crawford ``` __ __ ____ ___ ___ ____ __ __ ____ ____ ___ ____ | T T / T| T T| \ | T T| \ / T / _]| \ | l |Y o || _ _ || o )| | || D )Y __j / [_ | D ) | _ || || \_/ || T| | || / | T |Y _]| / | | || _ || | || O || : || \ | l_ || [_ | \ | | || | || | || |l || . Y| || T| . Y l__j__jl__j__jl___j___jl_____j \__,_jl__j\_jl___,_jl_____jl__j\_j ``` {: .-figlet} ### cricket ``` ___ ___ __ | Y .---.-.--------| |--.--.--.----.-----.-----.----. |. 1 | _ | | _ | | | _| _ | -__| _| |. _ |___._|__|__|__|_____|_____|__| |___ |_____|__| |: | | |_____| |::.|:. | `--- ---' ``` {: .-figlet} ### cursive ``` _ , ' ) / / /--/ __. ______ /__. . __ _, _ __ / (_(_/|_/ / / <_/_)(_/_/ (_(_)_ || ' ' || . \| | || '_>/ . |/ ._>| '_> |_|_|<___||_|_|_||___/`___||_| \_. |\___.|_| <___' ``` {: .-figlet} ### dwhistled ``` H m ur r X X XX X . XX . . XX . . .X . . .X . . .. Hamburger ``` {: .-figlet} ### eftichess ``` ######### ######### ######### #################################### [`'`'] ##\`.'/## ':v:` ##/\:/\## |:+:| ##':v:`## \`.'/ ##[`'`']###'\v/`####[`'`']###[`'`']# |::| ##(o:o)## (o:0) #/(o:o)\# (o:o) ##(o:0)## (o:o) ###|::|####(o 0)#####| |#####| |## |::| ###\:/:\# (:) ###(:)### (:) ###(:)### \:/:\ ###|::|#####(_)######|__|#####|__|## ####"#### ######### ######### " #################################### ``` {: .-figlet} ### eftifont ``` _ _ | U |_ _ _ || _ _ _ _ | /o\ |/ \ \|o\U|/_|/oYoY_| |_n_\_,]L_n_n||_|_/L| \_|(L| _) ``` {: .-figlet} ### eftipiti ``` []-|amburger ``` {: .-figlet} ### eftirobot ``` _ _ _ ( )( ) ( ) | L| | ___ __ __ | |_ _ _ __ __ ___ __ ( __ )( o )( _`'_ )( o \( U )( _)/o )( o_)( _) /_\/_\/_^_\/_\`'/_\/___//___\/_\ \__\ \( /_\ _|/ ``` {: .-figlet} ### eftitalic ``` _ __ /// / _ _ /7 _ _ __ _ / ` /,'o| / \'\ /o\ /7/7//7,'o|,'o///7 /_n_/ |_,7/_nn_//_,'/__/// |_,'|_(// _// ``` {: .-figlet} ### eftiwall ``` | ___ ( ( ( o !!! |"| !!! *** |.===. /_\ `* '. ___ .' ` /_\ ' ` _ _ ' __MMM__ _|_|_ ` _ _ ' (o o) {}o o{} (o o) ' (> <) ' - (o o) - - (OXO) - (o o) (o o) - (OXO) - ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo- ``` {: .-figlet} ### eftiwater ``` _ _ _ )L`) ___ _ _ )) _ __ ___ __ __ (( ( ((_( ((`1( ((_)((_( (| ((_( (('(| _)) ``` {: .-figlet} ### epic ``` _______ _______ ______ _______ _______ _______ _______ |\ /|( ___ )( )( ___ \ |\ /|( ____ )( ____ \( ____ \( ____ ) | ) ( || ( ) || () () || ( ) )| ) ( || ( )|| ( \/| ( \/| ( )| | (___) || (___) || || || || (__/ / | | | || (____)|| | | (__ | (____)| | ___ || ___ || |(_)| || __ ( | | | || __)| | ____ | __) | __) | ( ) || ( ) || | | || ( \ \ | | | || (\ ( | | \_ )| ( | (\ ( | ) ( || ) ( || ) ( || )___) )| (___) || ) \ \__| (___) || (____/\| ) \ \__ |/ \||/ \||/ \||/ \___/ (_______)|/ \__/(_______)(_______/|/ \__/ ``` {: .-figlet} ### fender ``` '|| ||` '|| || || || ||''|| '''|. '||),,(|, ||''|, '|| ||` '||''| .|''|, .|''|, '||''| || || .|''|| || || || || || || || || || || ||..|| || .|| ||. `|..||. .|| ||. .||..|' `|..'|. .||. `|..|| `|... .||. || `..|' ``` {: .-figlet} ### fourtops ``` | | | |--|/~~||/~\ /~\ |~~\| ||/~\/~~|/~/|/~\ | |\__|| | ||__/ \_/|| \__|\/_| \__| ``` {: .-figlet} ### fraktur ``` .. .xHL . uW8" .-`8888hxxx~ .. . : `t888 x. . .u . .u . .H8X `%888*" u .888: x888 x888. 8888 . .@88k z88u .d88B :@8c uL .u .d88B :@8c 888X ..x.. us888u. ~`8888~'888X`?888f` 9888.z88N ~"8888 ^8888 ="8888f8888r .ue888Nc.. ud8888. ="8888f8888r '8888k .x8888888x .@88 "8888" X888 888X '888> 9888 888E 8888 888R 4888>'88" d88E`"888E` :888'8888. 4888>'88" ?8888X "88888X 9888 9888 X888 888X '888> 9888 888E 8888 888R 4888> ' 888E 888E d888 '88%" 4888> ' ?8888X '88888> 9888 9888 X888 888X '888> 9888 888E 8888 888R 4888> 888E 888E 8888.+" 4888> H8H %8888 `8888> 9888 9888 X888 888X '888> 9888 888E 8888 ,888B . .d888L .+ 888E 888E 8888L .d888L .+ '888> 888" 8888 9888 9888 "*88%""*88" '888!` .8888 888" "8888Y 8888" ^"8888*" 888& .888E '8888c. .+ ^"8888*" "8` .8" .. 88* "888*""888" `~ " `"` `%888*%" `Y" 'YP "Y" *888" 888& "88888% "Y" ` x8888h. d*" ^Y" ^Y' "` `" "888E "YP' !""*888%~ .dWi `88E ! `" . 4888~ J8% '-....:~ ^"===*"` ``` {: .-figlet} ### fuzzy ``` .-..-. .-. : :; : : : : : .--. ,-.,-.,-.: `-. .-..-..--. .--. .--. .--. : :: :' .; ; : ,. ,. :' .; :: :; :: ..'' .; :' '_.': ..' :_;:_;`.__,_;:_;:_;:_;`.__.'`.__.':_; `._. ;`.__.':_; .-. : `._.' ``` {: .-figlet} ### goofy ``` ___ _____ _____ _ ___ ___ _ _____ ___ __ ___ \ | | / / \ | | \ \ | | | | | \ ) ____) \ ___) | \ | \_/ | / \ | |\/| | | ) | | | | | ) / / __ | (__ | ) | _ | / () \ | | | | | < | | | | | / ( ( ( \ | __) | / | / \ | | __ | | | | | | ) | \_/ | | |\ \ \ \__) ) | (___ | |\ \ / |___| \_| (__) |_| |__| |_/ /___\ /__| |_\ \___) (__/ )_| |_\ \_ ``` {: .-figlet} ### gothic ``` _-_- ,, /, _ || _ || __ < \, \\/\\/\\ ||/|, \\ \\ ,._-_ / \\ _-_ ,._-_ ~||- - /-|| || || || || || || || || || || || \\ || ||===|| (( || || || || || |' || || || || || ||/ || ( \_, | \/\\ \\ \\ \\ \\/ \\/\\ \\, \\_-| \\,/ \\, ` / \ '----` ``` {: .-figlet} ### graceful ``` _ _ __ _ _ ____ _ _ ____ ___ ____ ____ / )( \ / _\ ( \/ )( _ \/ )( \( _ \ / __)( __)( _ \ ) __ (/ \/ \/ \ ) _ () \/ ( ) /( (_ \ ) _) ) / \_)(_/\_/\_/\_)(_/(____/\____/(__\_) \___/(____)(__\_) ``` {: .-figlet} ### gradient ``` eee..eee..eeeeee..eee......eee.eeeeeee..eee..eee.eeeeeee...eeeeee..eeeeee.eeeeeee.. @@@::@@@:@@@@@@@@:@@@@::::@@@@:@@@@@@@@:@@@::@@@:@@@@@@@@:@@@@@@@@:@@@@@@:@@@@@@@@: %%%--%%%-%%%--%%%-%%%%%--%%%%%-%%%--%%%-%%%--%%%-%%%--%%%-%%%------%%%----%%%--%%%- &&&&&&&&+&&&&&&&&+&&&&&&&&&&&&+&&&&&&&++&&&++&&&+&&&&&&&++&&&++++++&&&&&++&&&&&&&++ ||||||||*||||||||*|||*||||*|||*||||||||*|||**|||*||||||***|||*||||*|||||**||||||*** !!!==!!!=!!!==!!!=!!!==!!==!!!=!!!==!!!=!!!==!!!=!!!=!!!==!!!==!!!=!!!====!!!=!!!== :::##:::#:::##:::#:::######:::#::::::::#::::::::#:::##:::#::::::::#::::::#:::##:::# ...@@...@...@@...@...@@@@@@...@.......@@@......@@...@@...@@......@@......@...@@...@ ``` {: .-figlet} ### graffiti ``` ___ ___ ___. / | \_____ _____\_ |__ __ _________ ____ ___________ / ~ \__ \ / \| __ \| | \_ __ \/ ___\_/ __ \_ __ \ \ Y // __ \| Y Y \ \_\ \ | /| | \/ /_/ > ___/| | \/ \___|_ /(____ /__|_| /___ /____/ |__| \___ / \___ >__| \/ \/ \/ \/ /_____/ \/ ``` {: .-figlet} ### hex ``` 48 61 6D 62 75 72 67 65 72 ``` {: .-figlet} ### hollywood ``` _ ' ) ) /' /' /' /' ,/' /' ____ ,__________ /'__ ____ ____ ____ ____ /`---,/' /' ) /' ) ) /' ) /' / )' )--/' ) /' ) )' )-- /' /' /' /' /' /' /' /' /' /' /' /' /' /' /(___,/' /' (,/' (_,(___,/(__/' /' /(__(___,/(__(___,/(__/' (___,/(__(________/' /' / /' (___,/' ``` {: .-figlet} ### invita ``` ____ ___) (, / / /) /---/ _ ___ (/_ __ _ _ __ ) / (__(_(_// (_/_) (_(_/ (_(_/__(/_/ (_ (_/ .-/ (_/ ``` {: .-figlet} ### isometric1 ``` ___ ___ ___ ___ ___ ___ ___ ___ ___ /\__\ /\ \ /\__\ /\ \ /\__\ /\ \ /\ \ /\ \ /\ \ /:/ / /::\ \ /::| | /::\ \ /:/ / /::\ \ /::\ \ /::\ \ /::\ \ /:/__/ /:/\:\ \ /:|:| | /:/\:\ \ /:/ / /:/\:\ \ /:/\:\ \ /:/\:\ \ /:/\:\ \ /::\ \ ___ /::\~\:\ \ /:/|:|__|__ /::\~\:\__\ /:/ / ___ /::\~\:\ \ /:/ \:\ \ /::\~\:\ \ /::\~\:\ \ /:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/\:\ \:|__| /:/__/ /\__\ /:/\:\ \:\__\ /:/__/_\:\__\ /:/\:\ \:\__\ /:/\:\ \:\__\ \/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\~\:\/:/ / \:\ \ /:/ / \/_|::\/:/ / \:\ /\ \/__/ \:\~\:\ \/__/ \/_|::\/:/ / \::/ / \::/ / /:/ / \:\ \::/ / \:\ /:/ / |:|::/ / \:\ \:\__\ \:\ \:\__\ |:|::/ / /:/ / /:/ / /:/ / \:\/:/ / \:\/:/ / |:|\/__/ \:\/:/ / \:\ \/__/ |:|\/__/ /:/ / /:/ / /:/ / \::/__/ \::/ / |:| | \::/ / \:\__\ |:| | \/__/ \/__/ \/__/ ~~ \/__/ \|__| \/__/ \/__/ \|__| ``` {: .-figlet} ### isometric2 ``` ___ ___ ___ ___ ___ ___ ___ ___ /\ \ /\ \ /\ \ _____ /\ \ /\ \ /\__\ /\__\ /\ \ \:\ \ /::\ \ |::\ \ /::\ \ \:\ \ /::\ \ /:/ _/_ /:/ _/_ /::\ \ \:\ \ /:/\:\ \ |:|:\ \ /:/\:\ \ \:\ \ /:/\:\__\ /:/ /\ \ /:/ /\__\ /:/\:\__\ ___ /::\ \ /:/ /::\ \ __|:|\:\ \ /:/ /::\__\ ___ \:\ \ /:/ /:/ / /:/ /::\ \ /:/ /:/ _/_ /:/ /:/ / /\ /:/\:\__\ /:/_/:/\:\__\ /::::|_\:\__\ /:/_/:/\:|__| /\ \ \:\__\ /:/_/:/__/___ /:/__\/\:\__\ /:/_/:/ /\__\ /:/_/:/__/___ \:\/:/ \/__/ \:\/:/ \/__/ \:\~~\ \/__/ \:\/:/ /:/ / \:\ \ /:/ / \:\/:::::/ / \:\ \ /:/ / \:\/:/ /:/ / \:\/:::::/ / \::/__/ \::/__/ \:\ \ \::/_/:/ / \:\ /:/ / \::/~~/~~~~ \:\ /:/ / \::/_/:/ / \::/~~/~~~~ \:\ \ \:\ \ \:\ \ \:\/:/ / \:\/:/ / \:\~~\ \:\/:/ / \:\/:/ / \:\~~\ \:\__\ \:\__\ \:\__\ \::/ / \::/ / \:\__\ \::/ / \::/ / \:\__\ \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ ``` {: .-figlet} ### isometric3 ``` ___ ___ ___ ___ ___ ___ ___ ___ /__/\ / /\ /__/\ _____ /__/\ / /\ / /\ / /\ / /\ \ \:\ / /::\ | |::\ / /::\ \ \:\ / /::\ / /:/_ / /:/_ / /::\ \__\:\ / /:/\:\ | |:|:\ / /:/\:\ \ \:\ / /:/\:\ / /:/ /\ / /:/ /\ / /:/\:\ ___ / /::\ / /:/~/::\ __|__|:|\:\ / /:/~/::\ ___ \ \:\ / /:/~/:/ / /:/_/::\ / /:/ /:/_ / /:/~/:/ /__/\ /:/\:\ /__/:/ /:/\:\ /__/::::| \:\ /__/:/ /:/\:| /__/\ \__\:\ /__/:/ /:/___ /__/:/__\/\:\ /__/:/ /:/ /\ /__/:/ /:/___ \ \:\/:/__\/ \ \:\/:/__\/ \ \:\~~\__\/ \ \:\/:/~/:/ \ \:\ / /:/ \ \:\/:::::/ \ \:\ /~~/:/ \ \:\/:/ /:/ \ \:\/:::::/ \ \::/ \ \::/ \ \:\ \ \::/ /:/ \ \:\ /:/ \ \::/~~~~ \ \:\ /:/ \ \::/ /:/ \ \::/~~~~ \ \:\ \ \:\ \ \:\ \ \:\/:/ \ \:\/:/ \ \:\ \ \:\/:/ \ \:\/:/ \ \:\ \ \:\ \ \:\ \ \:\ \ \::/ \ \::/ \ \:\ \ \::/ \ \::/ \ \:\ \__\/ \__\/ \__\/ \__\/ \__\/ \__\/ \__\/ \__\/ \__\/ ``` {: .-figlet} ### isometric4 ``` ___ ___ ___ ___ ___ ___ ___ ___ ___ / /\ / /\ / /\ / /\ / /\ / /\ / /\ / /\ / /\ / /:/ / /::\ / /::| / /::\ / /:/ / /::\ / /::\ / /::\ / /::\ / /:/ / /:/\:\ / /:|:| / /:/\:\ / /:/ / /:/\:\ / /:/\:\ / /:/\:\ / /:/\:\ / /::\ ___ / /::\ \:\ / /:/|:|__ / /::\ \:\ / /:/ / /::\ \:\ / /:/ \:\ / /::\ \:\ / /::\ \:\ /__/:/\:\ /\ /__/:/\:\_\:\ /__/:/_|::::\ /__/:/\:\_\:| /__/:/ /\ /__/:/\:\_\:\ /__/:/_\_ \:\ /__/:/\:\ \:\ /__/:/\:\_\:\ \__\/ \:\/:/ \__\/ \:\/:/ \__\/ /~~/:/ \ \:\ \:\/:/ \ \:\ /:/ \__\/~|::\/:/ \ \:\__/\_\/ \ \:\ \:\_\/ \__\/~|::\/:/ \__\::/ \__\::/ / /:/ \ \:\_\::/ \ \:\ /:/ | |:|::/ \ \:\ \:\ \ \:\ \:\ | |:|::/ / /:/ / /:/ / /:/ \ \:\/:/ \ \:\/:/ | |:|\/ \ \:\/:/ \ \:\_\/ | |:|\/ /__/:/ /__/:/ /__/:/ \__\::/ \ \::/ |__|:|~ \ \::/ \ \:\ |__|:|~ \__\/ \__\/ \__\/ ~~ \__\/ \__\| \__\/ \__\/ \__\| ``` {: .-figlet} ### italic ``` )__/_ _ / _ _ _ _ / /(///)()(// (/(-/ _/ ``` {: .-figlet} ### ivrit ``` _ _ _ _ __ ___ __ _ _ __ _ _| |__ _ __ ___ __ _| | | | | '__/ _ \/ _` | '__| | | | '_ \| '_ ` _ \ / _` | |_| | | | | __/ (_| | | | |_| | |_) | | | | | | (_| | _ | |_| \___|\__, |_| \__,_|_.__/|_| |_| |_|\__,_|_| |_| |___/ ``` {: .-figlet} ### jazmine ``` o o 8 8 8 8 o8oooo8 .oPYo. ooYoYo. 8oPYo. o o oPYo. .oPYo. .oPYo. oPYo. 8 8 .oooo8 8' 8 8 8 8 8 8 8 `' 8 8 8oooo8 8 `' 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8. 8 8 8 `YooP8 8 8 8 `YooP' `YooP' 8 `YooP8 `Yooo' 8 :..:::..:.....:..:..:..:.....::.....:..:::::....8 :.....:..:::: :::::::::::::::::::::::::::::::::::::::::::::ooP'.::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::...::::::::::::::: ``` {: .-figlet} ### jerusalem ``` ______ ________ _ ______ ___ ___ __ __._ _ _ _ _ |____ |____ \ \ | |____ |_ ||_ | \ \ / /| | | | | | | | | | | _ | |\ \| | | | | | | | \ V / | | | | | | |_| | | || | |_|_\ ` | | | | |__| |___\ \ | |/ /_/ /| _ | |_|| | |______| |_| |_|____|______| |_______/ |_| |_| |_| ``` {: .-figlet} ### katakana ``` # # ######### ######## ########## # ######## # ### # # # ######### # ########## ######### # # #### # # # # # # # # # # ## # ######## # ######## # # # # # # ## # # ## ## # # # # # # # # ## # # ## ## ######### ######### # ######### ## ####### ######## ## ## # # ``` {: .-figlet} ### kban ``` '||' '||' '|| || || .... .. .. .. || ... ... ... ... .. ... . .... ... .. ||''''|| '' .|| || || || ||' || || || ||' '' || || .|...|| ||' '' || || .|' || || || || || | || || || |'' || || .||. .||. '|..'|' .|| || ||. '|...' '|..'|. .||. '||||. '|...' .||. .|....' ``` {: .-figlet} ### l4me ``` |-|4mbvrg3r ``` {: .-figlet} ### larry3d ``` __ __ __ /\ \/\ \ /\ \ \ \ \_\ \ __ ___ ___\ \ \____ __ __ _ __ __ __ _ __ \ \ _ \ /'__`\ /' __` __`\ \ '__`\/\ \/\ \/\`'__\/'_ `\ /'__`\/\`'__\ \ \ \ \ \/\ \L\.\_/\ \/\ \/\ \ \ \L\ \ \ \_\ \ \ \//\ \L\ \/\ __/\ \ \/ \ \_\ \_\ \__/.\_\ \_\ \_\ \_\ \_,__/\ \____/\ \_\\ \____ \ \____\\ \_\ \/_/\/_/\/__/\/_/\/_/\/_/\/_/\/___/ \/___/ \/_/ \/___L\ \/____/ \/_/ /\____/ \_/__/ ``` {: .-figlet} ### lcd ``` _ | | | | | |-+-| - |- - |- |- -| - |- | | | | | | | | | | | | | |/ | -- - -- - -- ``` {: .-figlet} ### lean ``` _/ _/ _/ _/ _/ _/_/_/ _/_/_/ _/_/ _/_/_/ _/ _/ _/ _/_/ _/_/_/ _/_/ _/ _/_/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/_/_/_/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/ _/ _/ _/_/_/ _/_/_/ _/ _/_/_/ _/_/_/ _/ _/ _/_/ ``` {: .-figlet} ### letters ``` HH HH bb HH HH aa aa mm mm mmmm bb uu uu rr rr gggggg eee rr rr HHHHHHH aa aaa mmm mm mm bbbbbb uu uu rrr r gg gg ee e rrr r HH HH aa aaa mmm mm mm bb bb uu uu rr ggggggg eeeee rr HH HH aaa aa mmm mm mm bbbbbb uuuu u rr gg eeeee rr ggggg ``` {: .-figlet} ### linux ``` .-. .-..---..-.-.-..--..-..-..---. .---..---..---. | |=| || | || | | ||-< | || || |-< | |'_| |- | |-< `-' `-'`-^-'`-'-'-'`--'`----'`-'`-'`-'-/`---'`-'`-' ``` {: .-figlet} ### lockergnome ``` ::| ::| :| ::::::|.::\ :\/| ::'| :\:| :::| /::| :~~/ :::| ::| ::|`::| :::| :::| `::| :| \::| :::, :| ,.:/ ``` {: .-figlet} ### madrid ``` / \ | |=| /=| /=\=\ |=\ | | /= /=| /=\ /= \ / \=| | | | |=/ \=/ | \=| \= | \=| ``` {: .-figlet} ### marquee ``` .:: .:: .:: .:: .:: .:: .:: .:: .:: .::: .:: .:: .:: .:: .::.: .::: .:: .:: .: .::: .:::::: .:: .:: .:: .:: .: .::.:: .:: .:: .:: .:: .:: .:: .: .:: .:: .:: .::.:: .:: .:: .: .::.:: .::.:: .:: .:: .:: .::.::::: .:: .:: .:: .::.:: .:: .:: .: .::.:: .::.:: .:: .:: .:: .::.: .:: .:: .:: .:: .:::.::: .: .::.:: .:: .::.::.::: .:: .:::: .::: .:: ``` {: .-figlet} ### maxfour ``` | | | |--|/~~||/~\ /~\ |~~\| ||/~\/~~|/~/|/~\ | |\__|| | ||__/ \_/|| \__|\/_| \__| ``` {: .-figlet} ### mike ``` | | _ _ _ |\ //| ||\ |/ |/| | /| |/ | | ``` {: .-figlet} ### mini ``` |_| _.._ _ |_ .__ _ ._ | |(_|| | ||_)|_||(_|(/_| _| ``` {: .-figlet} ### mirror ``` _ _ _ __ _ ___ _ __ __ _ _ _ __| | ___ __ _ _ __ | | | | |__` / _ \| '_ \__` | | | |/ _` |/ _ ' _` | '_ \| |_| | | \__ | |_) | | | |_| | (_| | | | | | | |_) | _ | |_|___/| .__/ |_|_.__/ \__,_|_| |_| |_|_.__/|_| |_| \___| ``` {: .-figlet} ### mnemonic ``` Hamburger ``` {: .-figlet} ### morse ``` .... .- -- -... ..- .-. --. . .-. ``` {: .-figlet} ### moscow ``` # # # # # #### # # #### ##### ##### #### # # # # ## ## # # # # # # # # # # # ##### # # # #### # #### # #### #### # # # # # # # # # # # # # # # # # # # ##### # # # ##### # ``` {: .-figlet} ### mshebrew210 ``` ""|""|\ |""|| |\/|/ | || ' \/ ||_|_\|_/ | -' ``` {: .-figlet} ### nancyj-fancy ``` M""MMMMM""MM dP M MMMMM MM 88 M `M .d8888b. 88d8b.d8b. 88d888b. dP dP 88d888b. .d8888b. .d8888b. 88d888b. M MMMMM MM 88' `88 88'`88'`88 88' `88 88 88 88' `88 88' `88 88ooood8 88' `88 M MMMMM MM 88. .88 88 88 88 88. .88 88. .88 88 88. .88 88. ... 88 M MMMMM MM `88888P8 dP dP dP 88Y8888' `88888P' dP `8888P88 `88888P' dP MMMMMMMMMMMM .88 d8888P ``` {: .-figlet} ### nancyj-underlined ``` dP dP dP 88 88 88 88aaaaa88a .d8888b. 88d8b.d8b. 88d888b. dP dP 88d888b. .d8888b. .d8888b. 88d888b. 88 88 88' `88 88'`88'`88 88' `88 88 88 88' `88 88' `88 88ooood8 88' `88 88 88 88. .88 88 88 88 88. .88 88. .88 88 88. .88 88. ... 88 dP dP `88888P8 dP dP dP 88Y8888' `88888P' dP `8888P88 `88888P' dP ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo~~~~.88~oooooooooooooooooo d8888P ``` {: .-figlet} ### nancyj ``` dP dP dP 88 88 88 88aaaaa88a .d8888b. 88d8b.d8b. 88d888b. dP dP 88d888b. .d8888b. .d8888b. 88d888b. 88 88 88' `88 88'`88'`88 88' `88 88 88 88' `88 88' `88 88ooood8 88' `88 88 88 88. .88 88 88 88 88. .88 88. .88 88 88. .88 88. ... 88 dP dP `88888P8 dP dP dP 88Y8888' `88888P' dP `8888P88 `88888P' dP .88 d8888P ``` {: .-figlet} ### nipples ``` {__ {__ {__ {__ {__ {__ {__ {__ {__ {___ {__ {__ {__ {__ {__{_ {___ {__ {__ {_ {___ {______ {__ {__ {__ {__ {_ {__{__ {__ {__ {__ {__ {__ {__ {_ {__ {__ {__ {__{__ {__ {__ {_ {__{__ {__{__ {__ {__ {__ {__{_____ {__ {__ {__ {__{__ {__ {__ {_ {__{__ {__{__ {__ {__ {__ {__{_ {__ {__ {__ {__ {___{___ {_ {__{__ {__ {__{__{___ {__ {____ {___ {__ ``` {: .-figlet} ### ntgreek ``` _ _ ___ | | | | / _ \ | |_| | __ ___ _| |_) )_ _ ___ _ _ ___ ___ | _ |/ \/ / | | | _ <| | | |/ _ ( \ / ) __)/ _ \ | | | ( () <| |_| | |_) ) |_| | |_) ) v /> _)| |_) ) |_| |_|\__/\_\ ._,_| __/ \___/| __/ | | \___) __/ | | | | | | | | | | |_| |_| |_| |_| |_| ``` {: .-figlet} ### nvscript ``` ,ggg, gg dP""Y8b 88 ,dPYb, Yb, `88 88 IP'`Yb `" 88 88 I8 8I 88aaaaaaa88 I8 8' 88"""""""88 ,gggg,gg ,ggg,,ggg,,ggg, I8 dP gg gg ,gggggg, ,gggg,gg ,ggg, ,gggggg, 88 88 dP" "Y8I ,8" "8P" "8P" "8, I8dP 88ggI8 8I dP""""8I dP" "Y8I i8" "8i dP""""8I 88 88 i8' ,8I I8 8I 8I 8I I8P 8I I8, ,8I ,8' 8I i8' ,8I I8, ,8I ,8' 8I 88 Y8,,d8, ,d8b,,dP 8I 8I Yb,,d8b, ,8I ,d8b, ,d8b,,dP Y8,,d8, ,d8I `YbadP' ,dP Y8, 88 `Y8P"Y8888P"`Y88P' 8I 8I `Y88P'"Y88P"' 8P'"Y88P"`Y88P `Y8P"Y8888P"888888P"Y8888P `Y8 ,d8I' ,dP'8I ,8" 8I I8 8I `8, ,8I `Y8P" ``` {: .-figlet} ### o8 ``` ooooo ooooo oooo 888 888 ooooooo oo ooo oooo 888ooooo oooo oooo oo oooooo oooooooo8 ooooooooo8 oo oooooo 888ooo888 ooooo888 888 888 888 888 888 888 888 888 888 888 88o 888oooooo8 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888oo888o 888 888 o888o o888o 88ooo88 8o o888o888o888o o888ooo88 888o88 8o o888o 888 888 88oooo888 o888o 888ooo888 ``` {: .-figlet} ### octal ``` 110 141 155 142 165 162 147 145 162 ``` {: .-figlet} ### ogre ``` _ /\ /\__ _ _ __ ___ | |__ _ _ _ __ __ _ ___ _ __ / /_/ / _` | '_ ` _ \| '_ \| | | | '__/ _` |/ _ \ '__| / __ / (_| | | | | | | |_) | |_| | | | (_| | __/ | \/ /_/ \__,_|_| |_| |_|_.__/ \__,_|_| \__, |\___|_| |___/ ``` {: .-figlet} ### os2 ``` oo____oo___________________oo______________________________________________ oo____oo__ooooo__oo_oo_oo__oooooo__oo____o_oo_ooo___oooo____ooooo__oo_ooo__ oo____oo_oo___oo_ooo_oo__o_oo___oo_oo____o_ooo___o_oo__oo__oo____o_ooo___o_ oooooooo_oo___oo_oo__oo__o_oo___oo_oo____o_oo______oo___o__ooooooo_oo______ oo____oo_oo___oo_oo__oo__o_oo___oo_ooo___o_oo_______oooooo_oo______oo______ oo____oo__oooo_o_oo______o_oooooo__oo_ooo__oo______o____oo__ooooo__oo______ ____________________________________________________ooooo__________________ ``` {: .-figlet} ### pawp ``` _ _ _ (_) (_) (_) _ ____ _ (_)___(_) ____ __ __ (_)_ _ _ (_)__ ____ (____)(_)__ (_______) (____) (__)_(__) (___)_ (_) (_)(____)(____)(_)_(_)(____) (_) (_)( )_( )(_) (_) (_)(_)_(_)(_)_(_)(_) ( )_(_)(__)__ (_) (_) (_) (__)_)(_) (_) (_)(____) (___) (_) (____) (____)(_) (_)_(_) (___) ``` {: .-figlet} ### peaks ``` /^^ /^^ /^^ /^^ /^^ /^^ /^^ /^^ /^^ /^^^ /^^ /^^ /^^ /^^ /^^/^ /^^^ /^^ /^^ /^ /^^^ /^^^^^^ /^^ /^^ /^^ /^^ /^ /^^/^^ /^^ /^^ /^^ /^^ /^^ /^^ /^ /^^ /^^ /^^ /^^/^^ /^^ /^^ /^ /^^/^^ /^^/^^ /^^ /^^ /^^ /^^/^^^^^ /^^ /^^ /^^ /^^/^^ /^^ /^^ /^ /^^/^^ /^^/^^ /^^ /^^ /^^ /^^/^ /^^ /^^ /^^ /^^ /^^^/^^^ /^ /^^/^^ /^^ /^^/^^/^^^ /^^ /^^^^ /^^^ /^^ ``` {: .-figlet} ### pebbles ``` o O o O o O o O O OoOooOOo o o O .oOoO' `oOOoOO. OoOo. O o `OoOo. .oOoO .oOo. `OoOo. O o O o O o o O o o O o o O OooO' o o o o O o O O o O O o O O o O O o O `OoO'o O o o `OoO' `OoO'o o `OoOo `OoO' o O OoO' ``` {: .-figlet} ### pepper ``` /_/_ _ _ /_ __ _ _ / //_|/ / //_//_///_//_'/ _/ ``` {: .-figlet} ### poison ``` @@@ @@@ @@@@@@ @@@@@@@@@@ @@@@@@@ @@@ @@@ @@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@@@@@ @@@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@@@ @@@@@@@@ @@@@@@@@ @@! @@@ @@! @@@ @@! @@! @@! @@! @@@ @@! @@@ @@! @@@ !@@ @@! @@! @@@ !@! @!@ !@! @!@ !@! !@! !@! !@ @!@ !@! @!@ !@! @!@ !@! !@! !@! @!@ @!@!@!@! @!@!@!@! @!! !!@ @!@ @!@!@!@ @!@ !@! @!@!!@! !@! @!@!@ @!!!:! @!@!!@! !!!@!!!! !!!@!!!! !@! ! !@! !!!@!!!! !@! !!! !!@!@! !!! !!@!! !!!!!: !!@!@! !!: !!! !!: !!! !!: !!: !!: !!! !!: !!! !!: :!! :!! !!: !!: !!: :!! :!: !:! :!: !:! :!: :!: :!: !:! :!: !:! :!: !:! :!: !:: :!: :!: !:! :: ::: :: ::: ::: :: :: :::: ::::: :: :: ::: ::: :::: :: :::: :: ::: : : : : : : : : :: : :: : : : : : : :: :: : : :: :: : : : ``` {: .-figlet} ### puffy ``` _ _ _ ( ) ( ) ( ) | |_| | _ _ ___ ___ | |_ _ _ _ __ __ __ _ __ | _ | /'_` )/' _ ` _ `\| '_`\ ( ) ( )( '__)/'_ `\ /'__`\( '__) | | | |( (_| || ( ) ( ) || |_) )| (_) || | ( (_) |( ___/| | (_) (_)`\__,_)(_) (_) (_)(_,__/'`\___/'(_) `\__ |`\____)(_) ( )_) | \___/' ``` {: .-figlet} ### pyramid ``` ^ ^ ^ ^ ^ ^ ^ ^ ^ /H\ /a\ /m\ /b\ /u\ /r\ /g\ /e\ /r\ <___><___><___><___><___><___><___><___><___> ``` {: .-figlet} ### rectangles ``` _____ _ | | |___ _____| |_ _ _ ___ ___ ___ ___ | | .'| | . | | | _| . | -_| _| |__|__|__,|_|_|_|___|___|_| |_ |___|_| |___| ``` {: .-figlet} ### relief ``` ___________________________________________________________________________________________________ /~~\__/~~\__/~~~~~~\__/~~\__/~~\_/~~~~~~~\__/~~\__/~~\_/~~~~~~~\___/~~~~~~\__/~~~~~~~~\_/~~~~~~~\__ /~~\__/~~\_/~~\__/~~\_/~~~\/~~~\_/~~\__/~~\_/~~\__/~~\_/~~\__/~~\_/~~\__/~~\_/~~\_______/~~\__/~~\_ /~~~~~~~~\_/~~~~~~~~\_/~~~~~~~~\_/~~~~~~~\__/~~\__/~~\_/~~~~~~~\__/~~\_______/~~~~~~\___/~~~~~~~\__ /~~\__/~~\_/~~\__/~~\_/~~\__/~~\_/~~\__/~~\_/~~\__/~~\_/~~\__/~~\_/~~\__/~~\_/~~\_______/~~\__/~~\_ /~~\__/~~\_/~~\__/~~\_/~~\__/~~\_/~~~~~~~\___/~~~~~~\__/~~\__/~~\__/~~~~~~~\_/~~~~~~~~\_/~~\__/~~\_ ________________________________________________________________________/~~\_______________________ ``` {: .-figlet} ### relief2 ``` \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ /// \\/// \\/////// \\/// \\/// \//////// \\/// \\/// \//////// \\\/////// \\///////// \//////// \\ /// \\/// \/// \\/// \//// //// \/// \\/// \/// \\/// \/// \\/// \/// \\/// \/// \\\\\\\/// \\/// \ ///////// \///////// \/// / /// \//////// \\/// \\/// \//////// \\/// \\\\\\\/////// \\\//////// \\ /// \\/// \/// \\/// \/// \\/// \/// \\/// \/// \\/// \/// \\/// \/// \\/// \/// \\\\\\\/// \\/// \ /// \\/// \/// \\/// \/// \\/// \//////// \\\/////// \\/// \\/// \\//////// \///////// \/// \\/// \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/// \\\\\\\\\\\\\\\\\\\\\\\ ``` {: .-figlet} ### rev ``` ========================================================================= = ==== =================== =========================================== = ==== =================== =========================================== = ==== =================== =========================================== = ==== === === = = === ===== = == = ==== ==== === = == = == = == == === = == = == = == = == = = = ==== ===== == = = == = == = == ======== == == ====== = ==== === == = = == = == = == ========== == ===== ====== = ==== == = == = = == = == = == ======= = == = == ====== = ==== === == = = == ==== == ======== ==== === ====== ========================================================================= ``` {: .-figlet} ### roman ``` ooooo ooooo .o8 `888' `888' "888 888 888 .oooo. ooo. .oo. .oo. 888oooo. oooo oooo oooo d8b .oooooooo .ooooo. oooo d8b 888ooooo888 `P )88b `888P"Y88bP"Y88b d88' `88b `888 `888 `888""8P 888' `88b d88' `88b `888""8P 888 888 .oP"888 888 888 888 888 888 888 888 888 888 888 888ooo888 888 888 888 d8( 888 888 888 888 888 888 888 888 888 `88bod8P' 888 .o 888 o888o o888o `Y888""8o o888o o888o o888o `Y8bod8P' `V88V"V8P' d888b `8oooooo. `Y8bod8P' d888b d" YD "Y88888P' ``` {: .-figlet} ### rot13 ``` Unzohetre ``` {: .-figlet} ### rounded ``` _ _ _ (_) (_) | | _______ _____ ____ | |__ _ _ ____ ____ _____ ____ | ___ (____ | \| _ \| | | |/ ___) _ | ___ |/ ___) | | | / ___ | | | | |_) ) |_| | | ( (_| | ____| | |_| |_\_____|_|_|_|____/|____/|_| \___ |_____)_| (_____| ``` {: .-figlet} ### rowancap ``` dMP dMP .aMMMb dMMMMMMMMb dMMMMb dMP dMP dMMMMb .aMMMMP dMMMMMP dMMMMb dMP dMP dMP"dMP dMP"dMP"dMPdMP"dMP dMP dMP dMP.dMP dMP" dMP dMP.dMP dMMMMMP dMMMMMP dMP dMP dMPdMMMMK" dMP dMP dMMMMK" dMP MMP"dMMMP dMMMMK" dMP dMP dMP dMP dMP dMP dMPdMP.aMF dMP.aMP dMP"AMF dMP.dMP dMP dMP"AMF dMP dMP dMP dMP dMP dMP dMPdMMMMP" VMMMP" dMP dMP VMMMP" dMMMMMP dMP dMP ``` {: .-figlet} ### rozzo ``` 888 888 888 888 888 ,"Y88b 888 888 8e 888 88e 8888 8888 888,8, e88 888 ,e e, 888,8, 8888888 "8" 888 888 888 88b 888 888b 8888 8888 888 " d888 888 d88 88b 888 " 888 888 ,ee 888 888 888 888 888 888P Y888 888P 888 Y888 888 888 , 888 888 888 "88 888 888 888 888 888 88" "88 88" 888 "88 888 "YeeP" 888 , 88P "8",P" ``` {: .-figlet} ### runic ``` | | |\ | | \ | | \ | | \| | | ``` {: .-figlet} ### runyc ``` | | |\ | | \ | | \ | |\ |\/| |\ |\ |\ \ / |\/| |\ | \| |\ |/\| |< | | |/ X | | |/ | | | | | |/ | | |\ / \ | | |\ ``` {: .-figlet} ### sblood ``` @@@ @@@ @@@@@@ @@@@@@@@@@ @@@@@@@ @@@ @@@ @@@@@@@ @@@@@@@ @@@@@@@@ @@@@@@@ @@! @@@ @@! @@@ @@! @@! @@! @@! @@@ @@! @@@ @@! @@@ !@@ @@! @@! @@@ @!@!@!@! @!@!@!@! @!! !!@ @!@ @!@!@!@ @!@ !@! @!@!!@! !@! @!@!@ @!!!:! @!@!!@! !!: !!! !!: !!! !!: !!: !!: !!! !!: !!! !!: :!! :!! !!: !!: !!: :!! : : : : : : : : :: : :: :.:: : : : : :: :: : : :: ::: : : : ``` {: .-figlet} ### script ``` , _ /| | | | |___| __, _ _ _ | | ,_ __, _ ,_ | |\/ | / |/ |/ | |/ \_| | / | / | |/ / | | |/\_/|_/ | | |_/\_/ \_/|_/ |_/\_/|/|__/ |_/ /| \| ``` {: .-figlet} ### serifcap ``` _ _ __ __ __ ___ _ _ ___ __ ___ ___ ( )( ) ( ) ( \/ )( ,)( )( )( ,) / _)( _)( ,) )__( /__\ ) ( ) ,\ )()( ) \( (/\ ) _) ) \ (_)(_)(_)(_)(_/\/\_)(___/ \__/ (_)\_)\__/(___)(_)\_) ``` {: .-figlet} ### shadow ``` | | | | | _` | __ `__ \ __ \ | | __| _` | _ \ __| ___ | ( | | | | | | | | | ( | __/ | _| _|\__,_|_| _| _|_.__/ \__,_|_| \__, |\___|_| |___/ ``` {: .-figlet} ### short ``` |_| ,_ | _ | |(|||||)L||`(|(/_|` _| ``` {: .-figlet} ### slant ``` __ __ __ / / / /___ _____ ___ / /_ __ ___________ ____ _____ / /_/ / __ `/ __ `__ \/ __ \/ / / / ___/ __ `/ _ \/ ___/ / __ / /_/ / / / / / / /_/ / /_/ / / / /_/ / __/ / /_/ /_/\__,_/_/ /_/ /_/_.___/\__,_/_/ \__, /\___/_/ /____/ ``` {: .-figlet} ### slide ``` ## || ## ## ||##| ##H H| ## ## H|## H|#HH| #H| ## H| ##HH|| H| ### HH|##H| ## H|##H|## H|##HH|##H| ## ||##H| ## H H|## H|## H|## #HH|## ## ## ||##HH|## H|##H| #HH|## H| #HH|## ##H| ``` {: .-figlet} ### slscript ``` _ , ' ) / / /--/ __. ______ /__. . __ _, _ __ / (_(_/|_/ / / <_/_)(_/_/ (_(_)_ ``` ### Conditions ```bash -name "*.c" ``` ```bash -user jonathan -nouser ``` ```bash -type f # File -type d # Directory -type l # Symlink ``` ```bash -depth 2 # At least 3 levels deep -regex PATTERN ``` ```bash -size 8 # Exactly 8 512-bit blocks -size -128c # Smaller than 128 bytes -size 1440k # Exactly 1440KiB -size +10M # Larger than 10MiB -size +2G # Larger than 2GiB ``` ```bash -newer file.txt -newerm file.txt # modified newer than file.txt -newerX file.txt # [c]hange, [m]odified, [B]create -newerXt "1 hour ago" # [t]imestamp ``` ### Access time conditions ```bash -atime 0 # Last accessed between now and 24 hours ago -atime +0 # Accessed more than 24 hours ago -atime 1 # Accessed between 24 and 48 hours ago -atime +1 # Accessed more than 48 hours ago -atime -1 # Accessed less than 24 hours ago (same a 0) -ctime -6h30m # File status changed within the last 6 hours and 30 minutes -mtime +1w # Last modified more than 1 week ago ``` These conditions only work in MacOS and BSD-like systems (no GNU/Linux support). ### Condition flow ```bash \! -name "*.c" # NOT named "*.c" \( x -or y \) ``` ### Actions ```bash -exec rm {} \; -print -delete ``` ### Examples ```bash find . -name '*.jpg' find . -name '*.jpg' -exec rm {} \; ``` ```bash find . -newerBt "24 hours ago" ``` ```bash find . -type f -mtime +29 # find files modified more than 30 days ago find . -type f -newermt 2016-08-07 \! -newermt 2016-08-08 # find in date range ``` ================================================ FILE: firebase.md ================================================ --- title: Firebase prism_languages: [coffeescript] tags: [WIP] --- ### Authenticating ```js FB = new Firebase('https://xxx.firebase.io') FB.auth(TOKEN, (err, result) => { ···}) ``` ```js FB.authAnonymously(···) FB.authWithPassword(···) FB.authWithOAuthPopup(···) FB.authWithOAuthToken(···) ``` ### Using ```js Users = FB.child('users') ``` ```js // Create user = Users.push(first: "Frank", last: "Sinatra") ``` ```js // Retrieve user = Users.child('alan') // gets `users/alan` ``` ```js // Update user.set(first: "Miles", last: "Davis") user.update(first: "Miles") user.setWithPriority({ ··· }, priority) ``` ```js // Destroy user.remove() ``` ```js // Getting user.name() // primary id user.once('value', (snap) => { snap.name() // primary id snap.val() // value }, (err) => { ··· }) ``` ```js // traversal user.parent() ``` ### Querying ```coffeescript Users = FB.child('users') Users .startAt(1000) .limit(50) .equalTo(priority, [name]) .on 'child_added', (snap) -> ··· ``` ### Lists ```coffeescript Posts = FB.child('posts') post = Posts.push({ title: "How to do things", author: "alan" }) ``` ## References {: .-one-column} * * ================================================ FILE: firefox.md ================================================ --- title: Firefox tags: [Archived] archived: This sheet has not been updated with newer Firefox releases. --- ### [Firefox 31](https://www.mozilla.org/en-US/firefox/31.0/releasenotes/) (July 2014) * CSS: variables ### [Firefox 30](https://developer.mozilla.org/en-US/Firefox/Releases/30) (June 2014) * CSS: Allow `line-height` in `` * JS: `Console.count()` * JS: ES6 array and generator comprehensions ### Firefox 29 (April 2014) * New UI * CSS: Unprefixed `box-shadow` ### Firefox 18 (Jan 2013) * Faster JS compiler (IonMonkey) * Mac retina support * JS: `window.devicePixelRatio` * JS: unprefixed `ontouchstart` * HTML: `` * HTML: `` ### Firefox 17 (Nov 2012) * No more support for Mac OSX 10.5 and below * SVG `FillPaint` and `StrokePaint` * HTML ` ``` ### Aborting a reflex call `raise :abort` within a reflex method to cancel it. ```ruby # comment_reflex.rb class CommentReflex < ApplicationReflex def create raise :abort end end ``` ================================================ FILE: strftime.md ================================================ --- title: strftime format weight: -5 updated: 2017-11-27 tags: [Featurable] intro: | The strftime format is the standard date formatting for UNIX. It's used in C, Ruby, and more. --- {% include common/strftime_format.md title="strftime" %} ================================================ FILE: stylus.md ================================================ --- title: Stylus category: CSS prism_languages: [stylus] weight: -3 updated: 2017-10-30 tags: [Featurable] --- Getting started --------------- {: .-three-column} ### CSS syntax ```stylus .box { color: blue; .button { color: red; } } ``` Stylus is a CSS pre-processor. See: [stylus-lang.com](http://stylus-lang.com/) ### Indent syntax ```stylus .box color: blue .button color: red ``` Also works! The colon is optional, as well. This is typically the syntax used with Stylus documents. ### Mixins ```stylus caps-type() text-transform: uppercase letter-spacing: 0.05em ``` {: data-line="1"} ```stylus h5 caps-type() ``` {: data-line="2"} See [Mixins](#mixins-1) below. ### Variables ```stylus royal-blue = #36a ``` {: data-line="1"} ```stylus div color: royal-blue ``` Mixins ------ {: .-three-column} ### Without arguments ```stylus red-border() border: solid 2px red ``` {: data-line="1"} ```stylus div red-border() ``` {: data-line="2"} See: [Mixins](http://stylus-lang.com/docs/mixins.html) ### With arguments ```stylus border-radius(n) -webkit-border-radius: n border-radius: n ``` {: data-line="1"} ```stylus div border-radius: 2px border-radius(2px) ``` {: data-line="2,3"} Mixins can be applied in two different ways. ### Argument defaults ```stylus border-radius(n = 2px) -webkit-border-radius: n ``` {: data-line="1"} ### Block mixins ```stylus mobile() @media (max-width: 480px) {block} ``` {: data-line="3"} ```stylus +mobile() width: 10px ``` {: data-line="1"} See: [Block mixins](http://stylus-lang.com/docs/mixins.html#block-mixins) ### Rest params ```stylus shadow(offset-x, args...) box-shadow: offset-x args margin-top: offset-x ``` {: data-line="1"} ```stylus #login shadow: 1px 2px 5px #eee ``` See: [Rest params](http://stylus-lang.com/docs/vargs.html) Functions --------- {: .-three-column} ### Functions ```stylus add(a, b) a + b ``` {: data-line="1"} ```stylus body padding: add(10px, 5) ``` {: data-line="2"} See: [Functions](http://stylus-lang.com/docs/functions.html) ### Argument defaults ```stylus add(a, b = 2) a + b ``` {: data-line="1"} See: [Argument defaults](http://stylus-lang.com/docs/functions.html#argument-defaults) ### Named parameters ```stylus shadow(x, y) x y (y * 1.5) #000 ``` ```stylus .button box-shadow: shadow(x: 2, y: 4) ``` {: data-line="2"} See: [Named parameters](http://stylus-lang.com/docs/functions.html#named-parameters) ### Multiple return values ```stylus sizes() 8px 16px ``` {: data-line="2"} ```stylus sizes()[0] // → 8px sizes()[1] // → 16px ``` See: [Multiple return values](http://stylus-lang.com/docs/functions.html#multiple-return-values) Values ------ {: .-three-column} ### Conditional assignment ```stylus royal-blue = #36a royal-blue ?= #89f ``` {: data-line="2"} ```stylus div color: royal-blue // #36a ``` `?=` will only set a variable if it's previously unset. See: [Conditional assignment](https://stylus-lang.com/docs/operators.html#conditional-assignment--) ### Property lookup ```stylus .logo width: w = 150 margin-left: -(w / 2) // or height: 80px margin-top: -(@height / 2) ``` {: data-line="2,3"} See: [Property lookup](https://stylus-lang.com/docs/variables.html#property-lookup) ### Interpolation ```stylus -{prefix}-border-radius: 2px ``` See: [Interpolation](https://stylus-lang.com/docs/interpolation.html) ### Color operators ```stylus #888 + 50% // → #c3c3c3 (lighten) #888 - 50% // → #444 (darken) #f00 + 50deg // → #ffd500 (hue) ``` ### Casting ```stylus n = 5px ``` ```stylus foo: (n)em foo: (n * 5)% ``` {: data-line="1,2"} ### Lookup ```stylus light-blue = #3bd name = 'blue' lookup('light-' + name) ``` {: data-line="3"} See: [lookup](https://stylus-lang.com/docs/bifs.html#lookupname) Advanced features ----------------- {: .-three-column} ### Conditional ```stylus if color == blue display: block else if true and true display: inline else if 'hey' is not 'bye' display: flex else display: none ``` Aliases: | `==` | `is` | | `!=` | `is not` | | `!=` | `isnt` | See: [Conditionals](https://stylus-lang.com/docs/functions.html#conditionals) ### For loops ```stylus font-size-1 = 10px font-size-2 = 20px font-size-3 = 30px for i in 1..3 .text-{i} font-size: lookup('font-size-' + i) ``` {: data-line="5"} ### Definition check ```stylus if ohnoes is defined color: blue ``` {: data-line="1"} See: [is defined](https://stylus-lang.com/docs/operators.html#variable-definition-is-defined) ### False values ```stylus 0 null false '' ``` ### Type check ```stylus if val is a 'string' if val is a 'ident' if #fff is a 'rgba' // → true ``` See: [Instance check](https://stylus-lang.com/docs/operators.html#instance-check-is-a) Built-in functions ------------------ {: .-three-column} ### Color functions ```stylus alpha(#fff) //→ 1 alpha(rgba(0, 0, 0, 0.2)) //→ 0.2 ``` ```stylus dark(black) //→ true light(black) //→ false ``` ```stylus hue(#0a0) //→ 50deg saturation(#f00) //→ 100% lightness(#f00) //→ 50% luminosity(#f00) //→ 0.2126 ``` ```stylus hue(#0a0, 0deg) saturation(#f00, 50%) lightness(#f00) ``` ```stylus lighten(color, 10%) darken(color, 10%) saturate(color, 10%) desaturate(color, 10%) invert(color) ``` ```stylus tint(color, 50%) // mix with white shade(color, 50%) // mix with black ``` ```stylus unquote(string) ``` See: [Built-in functions](http://stylus-lang.com/docs/bifs.html) ### Image size ```stylus width: image-size('tux.png')[0] height: image-size('tux.png')[1] ``` Returns the width and height of a given image. See: [image-size](http://stylus-lang.com/docs/bifs.html#image-sizepath) ### Caching ```stylus size($width) +cache('w' + $width) width: $width .a { size: 10px } .b { size: 10px } ``` ```stylus // yields: .a, b { width: 10px } ``` Applies its contents to the given selector on the first call, but would @extend the first call’s selector at the second call with the same params. See: [cache](http://stylus-lang.com/docs/bifs.html#cachekeys) ### Add Property ```stylus gradient(color) add-property('background-image', linear-gradient(top, color, darken(color, 20%))) color ``` ```stylus body background: gradient(red) ``` See: [add-property](http://stylus-lang.com/docs/bifs.html#add-propertyname-expr) ### sprintf ```stylus '-webkit-gradient(%s, %s, %s)' % (linear (0 0) (0 100%)) // → -webkit-gradient(linear, 0 0, 0 100%) ``` ```stylus s("rgba(0, 0, 0, %s)", 0.3) ``` See: [s](http://stylus-lang.com/docs/bifs.html#sfmt-) ### Embed URL ``` background: embedurl('logo.png') // → background: url("data:image/png;base64,…") ``` See: [embedurl](http://stylus-lang.com/docs/bifs.html#embedurlpath-encoding) ================================================ FILE: sublime-text.md ================================================ --- title: Sublime Text category: Apps --- ### Select & Expand | `⌘ D` | select current word (repeat to include next instance of word) | | `⌘ L` | select current line (repeat to include next line) | | `⌘ ⇧ L` | split selection into multiple lines | | `⌘ ⇧ A` | select text inside tag (repeat to expand) | | `Ctrl ⇧ M` | select to curly or angle brackets (repeat to expand) | {: .-shortcuts} Replace ⌘ with Ctrl on Windows and Linux. ### Code Folding | `⌘ Alt [` | fold closest block | | `⌘ Alt ]` | unfold closest block | | `⌘ K` `⌘ 1` | fold all first level code blocks | | `⌘ K` `⌘ 2` | fold all second level code blocks | | `⌘ K` `⌘ 3 (etc)` | fold all third level code blocks (etc) | | `⌘ K` `⌘ T` | fold all HTML attributes | | `⌘ K` `⌘ 0` | unfold everything | {: .-shortcuts} ### Editing | `⌘ ⇧ D` | duplicate current line/selection | | `⌘ ⇧ K` | delete current line/selection | | `⇧ del` | delete current line/selection | | `⌘ ⇧ ↑` | move line up | | `⌘ ⇧ ↓` | move line down | {: .-shortcuts} ### Goto | `⌘ P` | goto anything | | `⌘ G` | goto line number | | `⌘ R` | goto symbol | | `⌘ P, :` | goto line number (enter number after `:`) | | `⌘ P, #` | goto and list fuzzy-matches of string (enter characters after `#`) | | `⌘ P, @` | goto and list symbol (begin typing symbol name after `@`) | {: .-shortcuts} ### Command line ```sh $ subl . $ subl README.md ``` Use `subl` to open files in Sublime from the terminal. ================================================ FILE: superagent.md ================================================ --- title: Superagent category: JavaScript libraries updated: 2018-04-21 tags: - WIP --- ### Response object ```javascript res: { // The HTTP Status Code (see: httpstatuses.com for definitions on HTTP status codes) status: 202, // True when res.status is 2xx ok: true, // True when res.status is 4xx or 5xx error: false, // True when res.status is 4xx clientError: false, // True when res.status is 5xx serverError: false, // True when res.status == 202 accepted: true, // True when res.status == 204 || res.status == 1223 noContent: false, // True when res.status == 400 badRequest: false, // True when res.status == 401 unauthorized: false, // True when res.status == 406 notAcceptable: false, // True when res.status == 404 notFound: false, // True when res.status == 403 forbidden: false, // Unparsed response text text: '{"user":{"username":"JohnDoe","role":"admin"}}' // Parsed response text (only if response is 'application/json' or 'application/x-www-form-urlencoded' body: { // Example of parsed object from res.text user: { username: 'JohnDoe', role: 'admin' } } // The content-type (parsed from headers) type: 'application/json' // The charset (parsed from headers) charset: 'UTF-8' // Header object with each header field as a property headers: { 'content-type': 'application/json; charset=UTF-8', ... } } ``` ================================================ FILE: tabular.md ================================================ --- title: Tabular category: Vim updated: 2017-10-11 weight: -1 intro: | [Tabular](https://github.com/godlygeek/tabular) is a Vim script for text alignment. --- ## Common usage {: .-three-column} ### Tables ``` :Tab /| ``` {: .-setup} ``` | Fruit | Color | | ----- | ----- | | Apple | Red | | Banana | Yellow | | Kiwi | Green | ``` ### Variables ``` :Tab /= ``` {: .-setup} ``` title = "Hello" src = "image.jpg" width = 640 ``` ### Colons ``` :Tab /:\zs/l0l1 ``` {: .-setup} ``` title: "Hello world" description: "This is a description" src: "image.jpg" height: 320 width: 640 ``` ## Tab command {: .-three-column} ### Basic example ``` :Tab /: ``` {: .-setup} ```bash title : My picture src : img.jpg ``` ### Right align ``` :Tab /:/r0 ``` {: .-setup} ```bash title:My picture src: img.jpg ``` ### The \zs atom ``` :Tab /:\zs ``` {: .-setup} ``` title: My picture src: img.jpg ``` The `\zs` atom will exclude the `:` from the search match. ### Specifier ``` :Tab /:/r1c1l0 ``` {: .-setup} ```bash title : My picture src : img.jpg ``` #### Explanation - `r1` -- Right align with 1 space - `c1` -- Center align the comma with 1 space - `l0` -- Left align with 0 spaces ### Regexp ``` :Tab /^[^,]*\zs,/r0 ``` {: .-setup} ```bash abc,hello c,hi there a,yo ``` ### Specifiers | Specifier | Description | | --- | --- | | `r1c1l0` | multiple specifiers, one per column
(the separator counts as a column) | | --- | --- | | `lN` | Left-align (with N spaces padding) | | `rN` | Right-align (with N spaces padding) | | `cN` | Center-align (with N spaces padding) | ## Also see - [godlygeek/tabular](https://github.com/godlygeek/tabular) _(github.com)_ - [Aligning text with Tabular.vim](http://vimcasts.org/episodes/aligning-text-with-tabular-vim/) _(vimcasts.org)_ ================================================ FILE: tailwind.config.mjs ================================================ import resolveConfig from 'tailwindcss/resolveConfig' const defaults = resolveConfig({}) /** @type {import('tailwindcss').Config} */ export default { content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'], theme: { extend: { spacing: { // max-widths content: '1232px', slim: '740px' }, colors: { mildindigo: { 50: '#F2F1F8', 100: '#E8E7F3', 200: '#D0CFE8', 300: '#B5B4DA', 400: '#9E9CCF', 500: '#8784C3', 600: '#6F6BB7', 700: '#4C4893', 800: '#312F60', 900: '#191730', 950: '#0C0C18' } }, fontFamily: { manrope: ['Manrope', ...defaults.theme.fontFamily.sans] }, boxShadow: { 'lg-cool': [ '0 1px 1px rgb(0 0 80 / 0.05)', '0 1.5px 3px -1px rgb(0 0 80 / 0.15)', '0 4px 6px -1px rgb(0 0 80 / 0.07)', '0 8px 12px -1px rgb(0 0 80 / 0.04)' ].join(', '), 'md-cool': [ '0 0 0 1px rgb(0 0 80 / 0.1)', '0 1px 1px rgb(0 0 80 / 0.1)', '0 1.5px 3px -2px rgb(0 0 80 / 0.3)', '0 4px 6px rgb(0 0 80 / 0.04)', '0 8px 12px -1px rgb(0 0 80 / 0.03)' ].join(', ') } } }, plugins: [] } ================================================ FILE: tape.md ================================================ --- title: Tape category: JavaScript libraries --- ### Example ```js test('things', (t) => { t.plan(1) t.equal('actual', 'expected') t.equal('actual', 'expected', 'should be equal') // messages are optional t.end(err) t.fail('msg') t.pass('msg') t.timeoutAfter(2000) t.skip('msg') t.ok(value, 'is truthy') t.notOk(value, 'is falsy') t.error(err, 'is falsy (print err.message)') t.equal(actual, expected, 'is equal') t.notEqual t.deepEqual(actual, expected, 'is equal (use node's deepEqual)') t.notDeepEqual t.looseEqual(actual, expected, 'is equal (use node's deepEqual with ==)') t.notLooseEqual t.throws(fn, /FooError/) t.throws(fn, FooError /* class */) t.doesNotThrow t.comment('message') }) ``` ```js test.only((t) => { ... }) ``` ================================================ FILE: tar.md ================================================ --- title: tar category: CLI updated: 2022-08-11 intro: Concatenate, Deflate, Inflate files --- ## Reference {:.-two-column} ### Deflate / Inflate / Concatenate ```shell # Deflate / Compress tar -czf archive.tar.gz /path/files ``` ```shell # Inflate / Uncompress tar -xzf archive.tar.gz ``` ```shell # Concatenate files into a single tar tar -cf archive.tar /path/files ``` ```shell # Extract file to a defined directory tar -xzf archive.tar.gz -C /target/directory ``` ```shell # Append a file to an existing archive tar -zu archive.tar.gz -C /target/file ``` ```shell # List files in archive # Add -v for additional details tar -tzf archive.tar.gz ``` ### Common options | Option | Description | |--------|-------------------------------------------------------------------------| | `z` | compress with gzip | | `c` | create an archive | | `u` | append files which are newer than the corresponding copy in the archive | | `f` | filename of the archive | | `v` | verbose, display what is inflated or deflated | | `a` | unlike of `z`, determine compression based on file extension | ================================================ FILE: test/basicPage.e2e.ts ================================================ import { expect, test } from '@playwright/test' import type { JsonLdBreadcrumbList, JsonLdNewsArticle } from '~/types/JsonLdDocument' import { expectMeta, getLdJsonPayloads } from './e2eUtils' test('/tests/basic', async ({ page }) => { await page.goto('/tests/basic') await expectMeta(page, { name: 'description', content: 'The one-page guide to Basic test: usage, examples, links, snippets, and more.' }) const ldJsonPayloads = await getLdJsonPayloads(page) expect(ldJsonPayloads.length).toEqual(2) const jsonData = ldJsonPayloads[0] as JsonLdNewsArticle expect(jsonData).toEqual({ '@context': 'http://schema.org', '@type': 'NewsArticle', mainEntityOfPage: { '@type': 'WebPage', '@id': 'https://google.com/article' }, headline: 'Basic test cheatsheet', image: ['https://assets.devhints.io/previews/tests/basic.jpg'], description: 'The one-page guide to Basic test: usage, examples, links, snippets, and more.' }) const jsonData2 = ldJsonPayloads[1] as JsonLdBreadcrumbList expect(jsonData2).toEqual({ '@context': 'http://schema.org', '@type': 'BreadcrumbList', itemListElement: [ { '@type': 'ListItem', position: 1, item: { '@id': 'https://devhints.io/#hidden', name: 'Hidden' } }, { '@type': 'ListItem', position: 2, item: { '@id': 'https://devhints.io/tests/basic', name: 'Basic test cheatsheet' } } ] }) }) ================================================ FILE: test/e2eUtils.ts ================================================ import { expect, type Page } from '@playwright/test' import type { JsonLdDocument } from '~/types/JsonLdDocument' /** * Helper: assert that a `` tag has a given `name` and `content` */ export async function expectMeta( page: Page, options: | { name: string; content: string } | { property: string; content: string } ) { const { content } = options const metaElement = page.locator( 'name' in options ? `meta[name="${options.name}"]` : `meta[property="${options.property}"]` ) await expect(metaElement).toHaveAttribute('content', content) } /** * Retrieves all JSON-LD payloads from the page. */ export async function getLdJsonPayloads( page: Page ): Promise> { const elements = await page .locator('script[type="application/ld+json"]') .all() return Promise.all( elements.map(async (element) => { const text = await element.textContent() return text ? JSON.parse(text) : null }) ) } ================================================ FILE: test/index.e2e.ts ================================================ import { expect, test } from '@playwright/test' import type { JsonLdBreadcrumbList } from '~/types/JsonLdDocument' import { expectMeta, getLdJsonPayloads } from './e2eUtils' test('homepage', async ({ page }) => { await page.goto('/') await expect(page).toHaveTitle('Devhints — TL;DR for developer documentation') const linksToAssert = [ { name: 'Xpath', href: '/xpath' }, { name: 'React', href: '/react' }, { name: 'Bash', href: '/bash' } ] for (const { name, href } of linksToAssert) { await expect(page.getByRole('link', { name }).first()).toHaveAttribute( 'href', href ) } // Share buttons const shareOnFacebook = page.getByLabel('Share on Facebook') const facebookHref = await shareOnFacebook.getAttribute('href') expect(facebookHref).toEqual( 'https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdevhints.io%2F' ) const shareOnTwitter = page.getByLabel('Share on Twitter') const twitterHref = await shareOnTwitter.getAttribute('href') expect(twitterHref).toEqual( 'https://twitter.com/intent/tweet?text=Ridiculous%20collection%20of%20web%20development%20cheatsheets%20https%3A%2F%2Fdevhints.io%2F' ) }) test('search', async ({ page }) => { await page.goto('/') await page.getByPlaceholder('Search...').click() await page.getByPlaceholder('Search...').fill('es6') // Pick the first await page.getByRole('option', { name: 'ES2015+' }).click() // Navigate to next page await expect(page).toHaveTitle('ES2015+ cheatsheet') await expect( page.getByRole('heading', { name: 'ES2015+ cheatsheet' }) ).toBeVisible() }) test('date pages', async ({ page }) => { await page.goto('/strftime') await page .getByRole('heading', { name: 'strftime format cheatsheet' }) .focus() await page.getByRole('heading', { name: 'Presets' }).focus() // This should make the `{% include %}` directive work await page.goto('/moment') await page.getByRole('heading', { name: 'Moment.js cheatsheet' }).focus() await page.getByRole('heading', { name: 'Parsing' }).focus() await page .getByRole('heading', { name: 'Internationalization', exact: true }) .focus() await page.getByRole('heading', { name: 'Add' }).focus() await page.goto('/datetime') await page.getByRole('heading', { name: 'strftime format' }).focus() await page.getByRole('heading', { name: 'Moment.js format' }).focus() }) test('/knex', async ({ page }) => { await page.goto('/knex') // Assert Markdown text await expectMeta(page, { name: 'description', content: 'One-page guide to Knex: usage, examples, and more. Knex is an SQL query builder for Node.js. This guide targets v0.13.0.' }) // Share buttons const shareOnFacebook = page.getByLabel('Share on Facebook') const facebookHref = await shareOnFacebook.getAttribute('href') expect(facebookHref).toEqual( 'https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdevhints.io%2Fknex' ) const shareOnTwitter = page.getByLabel('Share on Twitter') const twitterHref = await shareOnTwitter.getAttribute('href') expect(twitterHref).toEqual( 'https://twitter.com/intent/tweet?text=The%20ultimate%20cheatsheet%20for%20Knex%20https%3A%2F%2Fdevhints.io%2Fknex' ) }) test('/sinon', async ({ page }) => { await page.goto('/sinon') const ldJsonPayloads = await getLdJsonPayloads(page) const payload2 = ldJsonPayloads[1] as JsonLdBreadcrumbList expect(payload2.itemListElement[0].item['@id']).toEqual( 'https://devhints.io/#javascript-libraries' ) }) test('/tests/keywords_test', async ({ page }) => { await page.goto('/tests/keywords_test') await expectMeta(page, { name: 'description', content: 'Variables · Functions · Interpolation · Brace expansions · Loops · Conditional execution · Command substitution · One-page guide to Intro test' }) }) ================================================ FILE: tests/basic.md ================================================ --- title: "Basic test" category: Hidden --- ### Introduction This is a test cheatsheet. It's used as a reference for automated tests. ================================================ FILE: tests/keywords_test.md ================================================ --- title: Intro test category: Hidden updated: 2020-07-05 keywords: - Variables - Functions - Interpolation - Brace expansions - Loops - Conditional execution - Command substitution --- ### Example test This page has keywords. ================================================ FILE: textile.md ================================================ --- title: Textile category: Markup updated: 2017-09-20 weight: -1 --- ## Reference {: .-three-column} ### Inlines | Code | Description | | --- | --- | | `_em_` | | | `*strong*` | | | `__bold-italic__` | | | `@code@` | | | `??citation??` | | | --- | --- | | `-strikethrough-` | | | `+insertion+` | | | --- | --- | | `%span%` | HTML tag | | `%{color:red}formatting%` | CSS styles | | --- | --- | ### Blocks ```textile h1. Header 1 ``` ```textile h2. Header 2 ``` ```textile bq. Blockquote ``` ```textile p(classname). Class. ``` ```textile p(#id). ID. ``` ### Lists ```textile ## ordered list ``` ```textile * unordered list ``` ### Links | Code | Description | | --- | --- | | `"Hypertext":index.html` | Link | | --- | --- | | `"Text link":link`
`[link]http://link.com` | Link via reference | ### Images | Code | Description | | --- | --- | | `!image.jpg!` | Image | | `!image.jpg(title text)!` | | | `!image.jpg!:link.html` | | | `!>right.jpg!` | | ### Escaped HTML ```html
I am very serious. -- this
will get escaped.
``` ### Line breaks ```textile Line breaks. Just break the lines. ``` ### Entities ```textile one(TM), two(R), three(C). ``` ### Horizontal line ```textile -- ``` ### Footnotes ```textile Footnotes[1]. ``` ```textile fn1. Something. ``` ================================================ FILE: tig.md ================================================ --- title: Tig category: Git updated: 2022-12-08 weight: -3 --- ### Installing ```bash # MacOS + Homebrew $ brew install tig --HEAD ``` ```bash # Ubuntu $ sudo apt install tig ``` ### Invocation | Command | Description | | ------------------- | -------------------------------------------- | | `tig` | Logs | | --- | --- | | `tig status` | Status | | `tig blame FILE` | Blame | | --- | --- | | `tig master` | Show a branch | | `tig test..master` | Show difference between two branches | | `tig FILE` | Show history of file | | `tig v0.0.3:README` | Show contents of file in a specific revision | | `tig -C /repo/path` | Run in dir `/repo/path` (like `git -C`) | You can substitute `git log` → `tig`. ## Shortcut keys {: .-three-column} ### Switching views | Shortcut | Description | | -------- | ------------ | | `m` | Main view | | `d` | Diff | | `t` | Tree (files) | | `b` | Blame | | `s` | Status | | `c` | Stage | | `y` | Stash | | `g` | Grep | | `h` | Help | {: .-shortcuts} ### All views | Shortcut | Description | | --- | --- | | `` | Enter and open selected line | | `<` | Back to previous view state | | `` | Move focus to next view | | `R` | Refresh | | `q` | Close view | | `Q` | Close all (quit) | | `,` | Parent commit | {: .-shortcuts} ### Cursor navigation | Shortcut | Description | | --- | --- | | `/` | Search | | `?` | Search backwards | | `j` `k` | Up/down | | `J` `K` | Next/previous | | `` | Page down | | `-` | Page up | | `^D` | Half page down | | `^U` | Half page up | {: .-shortcuts} ### Option toggles | Shortcut | Description | | --- | --- | | `I` | Toggle sort order modes | | `i` | Change sort header | | `D` | Toggle date display modes | | `A` | Toggle author display modes | | `#` | Toggle line numbers | | `~` | Toggle line graphics | | `F` | Toggle file names | | `W` | Toggle ignore space | {: .-shortcuts} ### `m` - Main view | Shortcut | Description | | --- | --- | | `X` | Toggle commit sha | | `C` | Cherry pick a commit | {: .-shortcuts} ### `s` - Status view | Shortcut | Description | | --- | --- | | `u` | Stage/unstage file or chunk | | `!` | Revert file or chunk | | `C` | Commit | | `M` | Merge with external tool | {: .-shortcuts} ### `c` - Stage view | Shortcut | Description | | --- | --- | | `u` | Stage/unstage file or chunk | | `!` | Revert file or chunk | | `1` | Stage line | | `\` | Split current diff hunk | | `[` `]` | Increase/decrease the diff context | {: .-shortcuts} ### `d` - Diff view | Shortcut | Description | | --- | --- | | `[` `]` | Increase/decrease the diff context | {: .-shortcuts} ### `y` - Stash view | Shortcut | Description | | --- | --- | | `A` | Apply selected stash | | `P` | Pop selected stash | | `!` | Drop selected stash | {: .-shortcuts} ================================================ FILE: tmux.md ================================================ --- title: tmux category: CLI updated: 2024-04-08 --- ### Commands $ tmux -u # UTF8 mode -S ~/.tmux.socket #### Sessions $ tmux new $ tmux new -s session_name $ tmux attach # Default session $ tmux attach -t session_name $ tmux switch -t session_name $ tmux ls # List sessions $ tmux detach #### Windows $ tmux new-window ### Help C-b ? ### Scrolling C-b [ # Enter scroll mode then press up and down, you can also scroll with mouse support enabled (`set -g mouse on` in `~/.tmux.conf`) ### Copy/paste C-b [ # 1. Enter scroll mode first Space # 2. Start selecting and move around Enter # 3. Press enter to copy C-b ] # Paste ### Panes C-b % # vert C-b " # horiz C-b hkjl # navigation C-b HJKL # resize C-b o # next window C-b q # show pane numbers C-b x # close pane C-b { or } # move windows around ### Windows C-b c # New window C-b 1 # Go to window 1 C-b n # Go to next window C-b p # Go to previous window C-b w # List all window ### Detach/attach C-b d # Detach C-b ( ) # Switch through sessions $ tmux attach ### Search in buffer C-b [ # 1. Enter scroll mode first, you can also scroll with mouse support enabled C-s # 2. Enter search mode, type pattern then press Enter to start search n or N # 3. Go to the previous or next match C-c # 4. Exit search and scroll mode ### Niceties C-b t # Display a clock, press any key to quit ## Status formats ``` setw -g window-status-format `#[fg=8,bg=default]#I` ``` See `message-command-style` in the man page. ### Attribute/colors | Key | Description | | --- | --- | | `#[fg=1]` | standard color | | `#[fg=yellow]` | yellow | | `#[bold]` | bold | | `#[fg=colour240]` | 256 color | | `#[fg=default]` | default | | `#[fg=1,bg=2]` | combinations | | `#[default]` | reset | ### Colors * `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` * `brightred` (and so on) * `colour0` ... `colour255` * `#333` (rgb hex) ### Attributes * `bold` `underscore` `blink` `noreverse` `hidden` `dim` `italics` ### Variables | Key | Description | | --- | --- | | `#(date)` | shell command | | `#I` | window index | | `#S` | session name | | `#W` | window name | | `#F` | window flags | | `#H` | Hostname | | `#h` | Hostname, short | | `#D` | pane id | | `#P` | pane index | | `#T` | pane title | ## Options set -g status-justify [left|centre|right] set -g status-left '...' setw -g window-status-style setw -g window-status-activity-style setw -g window-status-bell-style setw -g window-status-content-style setw -g window-status-current-style setw -g window-status-last-style setw -g window-status-format setw -g window-status-current-format setw -g window-status-separator ================================================ FILE: tomdoc.md ================================================ --- title: Tomdoc category: Markup --- ### Tomdoc {: .-prime} ```ruby # Public: Duplicate some text an arbitrary number of times. # # text - The String to be duplicated. # count - The Integer number of times to duplicate the text. # # Examples # # multiplex('Tom', 4) # # => 'TomTomTomTom' # # Returns the duplicated String. def multiplex(text, count) text * count end ``` See [tomdoc.org](http://tomdoc.org/). ### Tags - `Deprecated` - `Internal` - `Public` ### Options ```ruby # options - The Hash options used to refine the selection (default: {}): # :color - The String color to restrict by (optional). # :weight - The Float weight to restrict by. The weight should # be specified in grams (optional). ``` ### Yields ```ruby # Yields the Integer index of the iteration. ``` ```ruby # Returns the duplicated String. ``` ```ruby # Returns nothing. ``` ```ruby # Raises Errno::ENOENT if the file can't be found. ``` ```ruby # Returns something else and this is a wrapped # multi-line comment. ``` ### Signatures ```ruby # Signature # # find_by_[_and_...](args) # ``` ================================================ FILE: top.md ================================================ --- title: top category: CLI updated: 2020-01-01 intro: See the processes in your Unix machine. --- ### Shortcuts | Shortcut | Description | | --------- | --------------------- | | `h` | shows help | | `q` | quits the program | | `m` | switches memory view | | `1` | switches cpu view | | `k` | kills process | | `Shift+p` | sorts by CPU usage | | `Shift+m` | sorts by memory usage | | `Shift+r` | reverses sorting | | `Shift+l` | searches for string | | `o` | adds a filter | | `u` | filter user | | `=` | clears filters | | `V` | Forest view | | `c` | show full path | {: .-shortcuts} ================================================ FILE: travis.md ================================================ --- title: Travis.yml category: Devops prism_languages: [yaml] intro: | Quick reference for [Travis CI](https://travis-ci.org) yaml configuration. See [official documentation](https://docs.travis-ci.com/user/customizing-the-build/). --- ## Reference {:.-three-column} ### Node.js ```yaml language: node_js node_js: - '4' ``` Defaults install to `npm install`, and defaults test to `npm test`. ### Ruby ```yaml language: ruby rvm: - 2.0.0 - 1.9.3 - 1.8.7 ``` Defaults install to `bundle install`, defaults test to `rake`. ### Build lifecycle | Lifecycle | | ---------------------------------- | | `before_install` | | `install` | | --- | | `before_script` | | `script` | | --- | | `after_success` or `after_failure` | | `after_script` | | --- | | `before_deploy` (optional) | | `deploy` (optional) | | `after_deploy` (optional) | ### Branches ```yaml branches: except: ['..'] only: ['master'] ``` ### Environment vars ```yaml env: - 'rack=master' - 'rack=1.3.4' ``` ### Custom test command ```yaml script: make test before_script: make pretest after_script: make clean before_script: - make pretest1 - make pretest2 ``` ### Branches ```yaml branches: except: - legacy only: - gh-pages - /^deploy/ ``` ### Apt packages ```yaml before_install: - sudo apt-get update -q - sudo apt-get install gcc-4.8 -y ``` ### Etc ```yaml gemfile: - gemfiles/Gemfile.rails-2.3.x - gemfiles/Gemfile.rails-3.0.x ``` ### References - https://about.travis-ci.org/docs/user/build-configuration/ - https://about.travis-ci.org/docs/user/languages/javascript-with-nodejs/ - https://about.travis-ci.org/docs/user/languages/ruby/ ================================================ FILE: tsconfig.json ================================================ { "extends": "astro/tsconfigs/strict", "compilerOptions": { "baseUrl": ".", "types": ["vitest/globals" /* https://vitest.dev/config/#globals */], "plugins": [{ "name": "@astrojs/ts-plugin" }], "paths": { "~/*": ["src/*"] } } } ================================================ FILE: typescript.md ================================================ --- title: TypeScript category: JavaScript libraries --- ### About TypeScript is just like ES2015 with type-checking. All ES2015 (classes, etc) should work. ### Basic types ```ts any void boolean number string null undefined bigint symbol string[] /* or Array */ [string, number] /* tuple */ string | null | undefined /* union */ never /* unreachable */ unknown ``` ```ts enum Color { Red, Green, Blue = 4 }; let c: Color = Color.Green ``` ### Declarations ```ts let isDone: boolean let isDone: boolean = false ``` ```ts function add (a: number, b: number): number { return a + b } // Return type is optional function add (a: number, b: number) { ... } ``` ## Type assertions #### Variables ```ts let len: number = (input as string).length let len: number = ( input).length /* not allowed in JSX */ ``` #### Functions ```ts function object(this: {a: number, b: number}, a: number, b: number) { this.a = a; this.b = b; return this; } // this is used only for type declaration let a = object(1,2); // a has type {a: number, b: number} ``` ## Interfaces ### Inline ```ts function printLabel (options: { label: string }) { console.log(options.label) } // Note the semicolon function getUser (): { name: string; age?: number } { } ``` ### Explicit ```ts interface LabelOptions { label: string } function printLabel(options: LabelOptions) { ... } ``` ### Optional properties ```ts interface User { name: string; age?: number; } ``` ### Read only ```ts interface User { readonly name: string } ``` ### Dynamic keys ```ts { [key: string]: Object[] } ``` ## Type aliases ### Type aliases ```ts type Name = string | string[] ``` ### Intersection ```ts interface Colorful { ... } interface Circle { ... } type ColorfulCircle = Colorful & Circle; ``` ## Function types ```ts interface User { ... } function getUser(callback: (user: User) => any) { callback({...}) } getUser(function (user: User) { ... }) ``` ## Classes ```ts class Point { x: number y: number static instances = 0 constructor(x: number, y: number) { this.x = x this.y = y } } ``` #### Inheritance ```ts class Point {...} class Point3D extends Point {...} interface Colored {...} class Pixel extends Point implements Colored {...} ``` #### Short fields initialisation ```ts class Point { static instances = 0; constructor( public x: number, public y: number, ){} } ``` #### Fields which do not require initialisation ```ts class Point { public someUselessValue!: number; ... } ``` ## Generics ```ts class Greeter { greeting: T constructor(message: T) { this.greeting = message } } let greeter = new Greeter('Hello, world') ``` ## Modules ```ts export interface User { ... } ``` ## Type extraction ```ts interface Building { room: { door: string; walls: string[]; }; } type Walls = Building['room']['walls']; // string[] ``` ## Keyof Type Operator ```ts type Point = { x: number; y: number }; type P = keyof Point; // x | y ``` ## Conditional Types ```ts // SomeType extends OtherType ? TrueType : FalseType; type ToArray = T extends any ? T[] : never; type StrArrOrNumArr = ToArray; // string[] | number[] ``` ### Inferring ```ts type GetReturnType = T extends (...args: unknown[]) => infer R ? R : never; type Num = GetReturnType<() => number>; // number ``` ```ts type First> = T extends [infer F, ...infer Rest] ? F : never; type Str = First<['hello', 1, false]>; // 'hello' ``` ## Literal Type ```ts const point = { x: 4, y: 2 }; // { x: number, y: number } const literalPoint = { x: 4, y: 2 } as const; // { readonly x: 4, readonly y: 2 }; ``` ## Template Literal Types ```ts type SpaceChar = ' ' | '\n' | '\t'; type TrimLeft = S extends `${SpaceChar}${infer Rest}` ? TrimLeft : S; type Str = TrimLeft<' hello'>; // 'hello' ``` ================================================ FILE: ubuntu.md ================================================ --- title: Ubuntu --- ### Aptitude stuff aptitude search mysql # Look for something dpkg -S `which tsclient` # What package does it belong to? dpkg -L aria2c # What does this package provide? dpkg -i *.deb # Install a deb file dpkg -s nodejs # Show info dpkg --get-selections # list installed packages ### Apt archives path /var/cache/apt/archives ### List services service --status-all ================================================ FILE: umdjs.md ================================================ --- title: Universal JS module loader category: JavaScript libraries --- ### Reference * ### [With dependency](https://github.com/umdjs/umd/blob/master/amdWebGlobal.js) ~~~ js ;(function (root, factory) { if (typeof define === 'function' && define.amd) { define(['jquery'], factory); } else if (typeof exports === 'object') { module.exports = factory(require('jquery')); } else { root.YourModule = factory(root.jQuery); } }(this, function (jquery) { return {}; })); ~~~ ### No dependencies ~~~ js ;(function (root, factory) { if (typeof define === 'function' && define.amd) { define(factory); } else if (typeof exports === 'object') { module.exports = factory(); } else { root.YourModule = factory(); } }(this, function () { return {}; })); ~~~ ### [Supports circular references](https://github.com/umdjs/umd/blob/master/commonjsStrict.js) ~~~ js (function (root, factory) { if (typeof define === 'function' && define.amd) { define(['exports', 'jquery'], factory); } else if (typeof exports === 'object') { factory(exports, require('jquery')); } else { factory((root.YourModule = {}), root.jQuery); } }(this, function (exports, jQuery) { exports.action = function () {}; })); ~~~ ================================================ FILE: underscore-string.md ================================================ --- title: Underscore-string category: JavaScript libraries --- ### Usage // Use it like so: _.str.trim("hey"); _s.trim("hey"); // Unless you do: _.mixin(_.string.exports()); // So you can: _.trim("hey"); _("hey").trim(); ### Trimming _.truncate("Hello world", 4) // => "Hell..." _.prune("Hello world", 5) // => "Hello..." _.trim(" foo ") // => "foo" _.trim("-foo-", '-') // => "foo" _.ltrim _.rtrim ### Numbers _.numberFormat(1000, 2) // => "1,000.00" ### Caps _.capitalize("foo bar") // => "Foo Bar" _.humanize("hey-there foo") // => "Hey there foo" _.titleize('My name is hi') // => "My Name Is Hi" _.dasherize('MozTransform') // => "-moz-transform" _.underscored('MozTransform') // => "moz_transform" _.classify('-moz-transform') // => "MozTransform" _.camelize('moz_transform') // => "MozTransform" _.slugify("hey there") // => "hey-there" _.swapCase("hELLO") // => "Hello" ### Checks _.startsWith('image.gif', 'image') // => true _.endsWith('image.gif', '.gif') // => true _.isBlank(" ") // => true (also for "\n", "") ### HTML _.escapeHTML("
") _.unescapeHTML("<div>") _.stripTags("
hi
") ### Quote _.quote("hi", '"') // => '"hi"' _.unquote('"hi"') // => "hi" ### Splits _.lines("hi\nthere") // => ["hi","there"] _.words("hi there you") // => ["hi","there","you"] ### Sprintf _.sprintf("%.1f", 1.17) ### Pad _.pad("1", 8) // => " 1" _.pad("1", 8, "0") // => "00000001" _.pad("1", 8, " ", "right") // => "1 " _.pad("1", 8, " ", "both") // => " 1 " _.lpad(..) // same as _.pad(.., 'left') _.rpad(..) // same as _.pad(.., 'right') _.lrpad(..) // same as _.pad(.., 'both') ### References * https://github.com/epeli/underscore.string ================================================ FILE: unicode.md ================================================ --- title: Unicode symbols --- ### Symbols ✈ \u2708 airplane ❄ \u2744 snowflake ⚑ \u2691 flag ☯ \u262f yinyang ♞ \u265e horse ☀ \u2600 rays ⚠ \u26a0 warning ★ star ☆ star2 ⚐ \u2690 flag ⚑ \u2691 flag ### Bullets • \u2022 · \u00b7 ┄ \u2504 — \u2014 (mdash) – \u2013 (ndash) ◦ \u25e6 circle ### Checks ✓ \u2713 check ✕ \u2715 ✗ \u2717 x mark ✘ \u2718 x mark bold ❏ \u274f checkbox × times ### Spinners ◜◠◝◞◡◟ ❘❙❚ ### Triangles and arrows ▲ ▼ ▶ ⬅ \u2b05 ⬆ \u2b06 ⬇ \u2b07 ◢ ◣ ◤ ◥ « « » » ‹ ‹ › › • · ⌘ – ⌘ – ⌘ – Command Key ⌥ – ⌥ – ⌥ – Option Key ⇧ – ⇧ – ⇧ – Shift Key ⎋ – ⎋ – ⎋ – ESC Key ⇪ – ⇪ – ⇪ – Capslock ⏎ – ⏎ – ⏎ – Return ⌫ – ⌫ – ⌫ – Delete / Backspace ▸ \u25b8 right arrow ▹ ◇ \u25c7 ◆ ◐ ◑ ◒ ◓ ♠ \u2660 ♣ \u2663 ♥ \u2665 ♦ \u2666 ✂ scissors ℹ information ℹ ♡ heart ♡ ⚙ cog or gear ⚙ ✉ envelope ✉ ✎ pencil ✎ ### JavaScript "x".charCodeAt(0) "x".charCodeAt(0).toString(16) http://www.danshort.com/HTMLentities/index.php?w=dingb ================================================ FILE: vagrant.md ================================================ --- title: Vagrant category: Devops intro: | [Vagrant](http://vagrantup.com) lets you build isolated virtual environments for your apps. --- ### Get started Add some base boxes: {: .-setup} ```bash vagrant box add precise64 http://files.vagrantup.com/precise64.box ``` Work it: ```bash mkdir test_box cd test_box vagrant init precise64 ``` Run it: ```bash vagrant up vagrant ssh ``` To stop, use one of the following: ```bash vagrant ssh # then: sudo shutdown -h now vagrant suspend vagrant destroy # !! ``` ### Also see * [Vagrant website](http://vagrantup.com) _(vagrantup.com)_ * [Vagrantfile cheatsheet](./vagrantfile) ================================================ FILE: vagrantfile.md ================================================ --- title: Vagrantfile category: Devops --- ## Vagrantfile {: .-one-column} ```rb Vagrant.configure("2") do |config| # All Vagrant configuration is done here. The most common configuration # options are documented and commented below. For a complete reference, # please see the online documentation at vagrantup.com. # Every Vagrant virtual environment requires a box to build off of. config.vm.box = "precise64" # The url from where the 'config.vm.box' box will be fetched if it # doesn't already exist on the user's system. # config.vm.box_url = "http://domain.com/path/to/above.box" # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. In the example below, # accessing "localhost:8080" will access port 80 on the guest machine. # config.vm.network :forwarded_port, guest: 80, host: 8080 # Create a private network, which allows host-only access to the machine # using a specific IP. # config.vm.network :private_network, ip: "192.168.33.10" # Create a public network, which generally matched to bridged network. # Bridged networks make the machine appear as another physical device on # your network. # config.vm.network :public_network # If true, then any SSH connections made will enable agent forwarding. # Default value: false # config.ssh.forward_agent = true # Share an additional folder to the guest VM. The first argument is # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. # config.vm.synced_folder "../data", "/vagrant_data" # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. # Example for VirtualBox: # # config.vm.provider :virtualbox do |vb| # # Don't boot with headless mode # vb.gui = true # # # Use VBoxManage to customize the VM. For example to change memory: # vb.customize ["modifyvm", :id, "--memory", "1024"] # end # # View the documentation for the provider you're using for more # information on available options. # Enable provisioning with Puppet stand alone. Puppet manifests # are contained in a directory path relative to this Vagrantfile. # You will need to create the manifests directory and a manifest in # the file precise64.pp in the manifests_path directory. # # An example Puppet manifest to provision the message of the day: # # # group { "puppet": # # ensure => "present", # # } # # # # File { owner => 0, group => 0, mode => 0644 } # # # # file { '/etc/motd': # # content => "Welcome to your Vagrant-built virtual machine! # # Managed by Puppet.\n" # # } # # config.vm.provision :puppet do |puppet| # puppet.manifests_path = "manifests" # puppet.manifest_file = "init.pp" # end # Enable provisioning with chef solo, specifying a cookbooks path, roles # path, and data_bags path (all relative to this Vagrantfile), and adding # some recipes and/or roles. # # config.vm.provision :chef_solo do |chef| # chef.cookbooks_path = "../my-recipes/cookbooks" # chef.roles_path = "../my-recipes/roles" # chef.data_bags_path = "../my-recipes/data_bags" # chef.add_recipe "mysql" # chef.add_role "web" # # # You may also specify custom JSON attributes: # chef.json = { :mysql_password => "foo" } # end # Enable provisioning with chef server, specifying the chef server URL, # and the path to the validation key (relative to this Vagrantfile). # # The Opscode Platform uses HTTPS. Substitute your organization for # ORGNAME in the URL and validation key. # # If you have your own Chef Server, use the appropriate URL, which may be # HTTP instead of HTTPS depending on your configuration. Also change the # validation key to validation.pem. # # config.vm.provision :chef_client do |chef| # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME" # chef.validation_key_path = "ORGNAME-validator.pem" # end # # If you're using the Opscode platform, your validator client is # ORGNAME-validator, replacing ORGNAME with your organization name. # # If you have your own Chef Server, the default validation client name is # chef-validator, unless you changed the configuration. # # chef.validation_client_name = "ORGNAME-validator" end ``` ## Also see * [Vagrant cheatsheet](./vagrant) ================================================ FILE: vainglory.md ================================================ --- title: Vainglory --- ## T3 items by use {: .-one-column} ### Items by use | Use | CP | WP | Util | | --- | --- | --- | --- | | __Anti-armor/shield__ | [Myth][BM] | [Bonesaw][BS], [Tension][TB] | | | __Stacking damage__ | [Myth][BM] | [Break][BP] | | | __Lifesteal__ | [Eve][Eve] | [Serpent][SM], [Shiv][PS] | | | __Raw power__ | [Shatterglass][SG] | [Sorrowblade][SB] | | | __Burst damage__ | [Aftershock][AS] | [Tension][TB] | | | __Attack speed__ | [AC][AC] | [Tornado][TT], [Break][BP] | | | __Critical__ | | [Monocle][TM] | | | __Auto-attack damage__ | [AC][AC], [Aftershock][AS] | _everything_ | [Stormcrown][SC] | | __Cooldown__ | [Clockwork][CW], [Aftershock][AS] | Spellsword | [Stormcrown][SC], [Contraption][Con], [Nullwave][Null], [Halcyon Boots][HBoot] | | __Slow__ | [Frostburn][FB] | | [Shiversteel][SS] | | __Reflex block__ | | | [Aegis][Aegis] (self/shield)
[Crucible][Cru] (team/HP) | | __Ability repeat__ | [Echo][Echo] | | | {: .-left-align.-headers} ## Tier 3 items {: .-one-column} ### Crystal power | Item | Cost | CP | Use | | ---- | --- | --- | --- | | AS: [Aftershock][AS] | 2400 | +35 cp | __Basic dmg, atk speed__
*+basic dmg after ability*, +25% cooldown, +2.5 recharge | | EoH: [Eve of Harvest][Eve] | 2600 | +55 cp | __Lifesteal__
*+10% lifesteal*, +250 energy, +5 recharge | | AC: [Alternating Current][AC] | 2800 | +60 cp | __Basic dmg__
*+basic dmg based on CP*, +65% atk speed | | BM: [Broken Myth][BM] | 2150 | +70 cp | __Stack dmg__
+10% shield pierce, stacking dmg | | FB: [Frostburn][FB] | 2600 | +100 cp | __Slow__
*slow for 1.5s* at (10% + 1% per 10CP) | | SG: [Shatterglass][SG] | 3000 | +150 cp | __Raw power__
- | | CW: [Clockwork][CW] | 2500 | +30% cp | __Cooldown__
*+40% cooldown*, +250 energy, +7.5 recharge | | [Echo][Echo] | 2500? | | __Ability repeat__
+250 energy, +4 recharge | {: .-left-align.-headers} [AS]: http://www.vaingloryfire.com/vainglory/wiki/items/aftershock [AC]: http://www.vaingloryfire.com/vainglory/wiki/items/alternating-current [Eve]: http://www.vaingloryfire.com/vainglory/wiki/items/eve-of-harvest [SG]: http://www.vaingloryfire.com/vainglory/wiki/items/shatterglass [BM]: http://www.vaingloryfire.com/vainglory/wiki/items/broken-myth [CW]: http://www.vaingloryfire.com/vainglory/wiki/items/clockwork [FB]: http://www.vaingloryfire.com/vainglory/wiki/items/frostburn [Echo]: http://www.vaingloryfire.com/vainglory/wiki/items/echo ### Weapon power | Item | Cost | WP | Other | | ---- | --- | --- | --- | | TT: [Tornado Trigger][TT] | 2600 | | __Atk speed__
*+75% atk speed*, +20% crit change, +20% crit dmg | | BS: [Bonesaw][BS] | 2700 | +15 wp | __Armor shred__
*stacking armor shred* | | TB: [Tension Bow][TB] | 2300 | +45 wp | __Bonus dmg__
*bonus dmg every 6s*, +8% armor pierce | | TM: [Tyrant's Monocle][TM] | 2750 | +50 wp | __Crit__
*+40% crit chance*, +20% crit dmg | | BP: [Breaking Point][BP] | 2600 | +55 wp | __Stacking dmg__
*stacking weapon dmg*, +35% atk speed | | SM: [Serpent Mask][SM] | 2800 | +85 wp | __Lifesteal__
*stacking lifesteal*, +10% lifesteal | | SB: [Sorrowblade][SB] | 3100 | +150 wp | __Raw power__
- | | PS: [Poisoned Shiv][PS] | 2250 | +30 wp | __Mortal wounds__
*mortal wounds for 2s*, +10% lifesteal, +30% atk speed | | SS: Spellsword | ? | +90 wp | __Cooldown__
? | {: .-left-align.-headers} [BS]: http://www.vaingloryfire.com/vainglory/wiki/items/bonesaw [BP]: http://www.vaingloryfire.com/vainglory/wiki/items/breaking-point [SM]: http://www.vaingloryfire.com/vainglory/wiki/items/serpent-mask [SB]: http://www.vaingloryfire.com/vainglory/wiki/items/sorrowblade [TB]: http://www.vaingloryfire.com/vainglory/wiki/items/tension-bow [TT]: http://www.vaingloryfire.com/vainglory/wiki/items/tornado-trigger [TM]: http://www.vaingloryfire.com/vainglory/wiki/items/tyrants-monocle [PS]: http://www.vaingloryfire.com/vainglory/wiki/items/poisoned-shiv ### Utilities | Item | Cost | HP | Use | | --- | --- | --- | --- | | [Halcyon Chargers][HBoot] | 2300 | +200 hp | 👟 __Boots__
+15% cooldown, +250 energy, +4 recharge | | [Stormcrown][SC] | 2200 | +200 hp | 🔴 __Bonus dmg__
+30% cooldown, +4 recharge, bonus true damage | | [Journey Boots][JBoot] | 1900 | +250 hp | 👟 __Boots__
damaging heroes resets sprint cooldown | | [Nullwave Gauntlet][Null] (2.0) | 2250 | +300 hp | 😶 __Item silence__
+25% cooldown | | [Contraption][Con] | 2100 | +350 hp | 👀 __Vision__
traps/flares, +40% cooldown, +3 recharge | | [Shiversteel][SS] | 1450 | +500 hp | 🐌 __Slow__
active: slow targets | | [War Treads][WBoot] | 2500 | +600 hp | 👟 __Boots__
gives sprint to nearby teammates | {: .-left-align.-headers} ### Defense | Item | Cost | HP | Armor | Shield | Use | | --- | --- | --- | --- | --- | --- | | [Aegis][Aegis] | 2250 | | +30 ar | +125 sh | ✊__Reflex block__ (self) | | [Fountain of Renewal][Fountain] | 2300 | +200 hp | +30 ar | +75 sh | ❤ __Heal__ allies | | [Atlas Pauldron][Atlas] | 1900 | | +85 ar | +35 sh | 🐌 __Slow__ target attack speed | | [Metal Jacket][Metal] | 2100 | | +170 ar | +35 sh | | | [Crucible][Cru] | 1850 | +600 hp | | | ✊ __Reflex block__ (team) | | [Slumbering Husk][Husk] (2.0) | 1600 | +400 hp | | | __Fortification__ against burst damage | {: .-left-align.-headers} [Fountain]: http://www.vaingloryfire.com/vainglory/wiki/items/fountain-of-renewal [Cru]: http://www.vaingloryfire.com/vainglory/wiki/items/aegis [Aegis]: http://www.vaingloryfire.com/vainglory/wiki/items/aegis [Atlas]: http://www.vaingloryfire.com/vainglory/wiki/items/atlas-pauldron [Metal]: http://www.vaingloryfire.com/vainglory/wiki/items/metal-jacket [Husk]: http://www.vaingloryfire.com/vainglory/wiki/items/slumbering-husk [Null]: http://www.vaingloryfire.com/vainglory/wiki/items/nullwave-gauntlet ### Boots | Item | Movement speed | HP | Sprint | Use | | --- | --- | --- | --- | --- | | [War Treads][WBoot] | +0.4 | +600 hp | 2s (60s cooldown)
incl. nearby teammates | __HP, assist__ | | [Halcyon Chargers][HBoot] | +0.5 | | 3s (50s cooldown) | __Energy__ | | [Journey Boots][JBoot] | +0.6 | +250 hp | 2s (60s cooldown)
damaging resets cooldown | __Gap close__ | {: .-left-align.-headers} [Con]: http://www.vaingloryfire.com/vainglory/wiki/items/contraption [HBoot]: http://www.vaingloryfire.com/vainglory/wiki/items/halcyon-chargers [WBoot]: http://www.vaingloryfire.com/vainglory/wiki/items/war-treads [JBoot]: http://www.vaingloryfire.com/vainglory/wiki/items/journey-boots [SC]: http://www.vaingloryfire.com/vainglory/wiki/items/stormcrown [SS]: http://www.vaingloryfire.com/vainglory/wiki/items/shiversteel ## Skill tier names ### Skill tier names | Just Beginning | 1 | | Getting There | 2 | | Rock Solid | 3 | | Worthy Foe |4 | | Got Swagger | 5 | | Credible Threat | 6 | | The Hotness | 7 | | Simply Amazing | 8 | | Pinnacle of Awesome | 9 | | Vainglorious | 10 | See: [Skill tier names](http://www.vaingloryfire.com/vainglory/forum/general-discussion/bronze-silver-gold-rankings-5312) ## References - Last updated for Vainglory 1.22 with some 2.0 stuff. - [Vaingloryfire.com](http://www.vaingloryfire.com/) - [Version history](http://forums.vainglorygame.com/index.php?threads/41129/) (forums.vainglorygame.com) - [Skill tier points](http://brokenmyth.net/skill-tier-point-far-next-tier/#more-10043) (brokenmyth.net) ================================================ FILE: vim-diff.md ================================================ --- title: Vimdiff category: Vim updated: 2018-12-06 weight: -10 intro: | [Vim](https://www.vim.org/) is a very efficient text editor. This reference was made for Vim 8.0. --- Getting started --------------- {: .-three-column} ### Navigating {: .-prime} | Shortcut | Description | | --- | --- | | `]c` | Next difference | | `[c` | Previous difference | {: .-shortcuts} ### Editing | Shortcut | Description | | --- | --- | | `do` | Diff Obtain!
Pull the changes to the current file. | | `dp` | Diff Put!
Push the changes to the other file. | | --- | --- | | `:diffupdate` | Re-scan the files for differences. | | `ZQ` | Quit without checking changes | {: .-shortcuts} ### Folds | Shortcut | Description | | --- | --- | | `zo` _/_ `zO` | Open | | `zc` _/_ `zC` | Close | | `za` _/_ `zA` | Toggle | | --- | --- | | `zv` | Open folds for this line | | --- | --- | | `zM` | Close all | | `zR` | Open all | | --- | --- | | `zm` | Fold more _(foldlevel += 1)_ | | `zr` | Fold less _(foldlevel -= 1)_ | | --- | --- | | `zx` | Update folds | {: .-shortcuts} Also see -------- - [Vim cheatsheet](https://vim.rtorr.com/) _(vim.rotrr.com)_ - [Vim documentation](https://vimdoc.sourceforge.net/htmldoc/) _(vimdoc.sourceforge.net)_ - [Interactive Vim tutorial](https://openvim.com/) _(openvim.com)_ ================================================ FILE: vim-digraphs.md ================================================ --- title: Vim digraphs category: Vim --- ### Typing digraphs in insert mode ``` OK ``` {:.light} ### Listing digraphs ``` :dig :digraphs ``` {:.lights} ## Reference ### Symbols | ℠ | ™ | © | ® | ¶ | † | ‡ | – | ± | | SM | TM | Co | Rg | PI | /- | /= | -- | +- | | § | µ | £ | ¢ | ¥ | ¤ | | SE | My | $$ | Ct | Ye | Cu | | ★ | ☆ | ♡ | ◆ | ◇ | | *2 | *1 | cH | Db | Dw | | ✓ | ✗ | | OK | XX | ### Dots and bullets | ⋅ | · | ○ | ∙ | ∘ | ∴ | ∵ | ∶ | ∷ | | .P | .M | 0m | Sb | Ob | .: | :. | :R | :: | | ⊙ | ⊚ | ◎ | □ | ▪ | | 0. | 02 | 0o | OS | sB | ### Math | ø | ≃ | ≅ | ≥ | ≤ | ≡ | ≮ | ≯ | ≠ | | o/ | ?- | ?= | >= | =< | =3 | !< | !> | != | | √ | × | ÷ | | RT *root* | /\ *times* | -: *divide* | | ¼ | ½ | ¾ | ₃ | ₂ | ³ | ² | | 14 | 12 | 34 | 3s | 2s | 3S | 2S | ### Set Theory | ∀ | ∃ | ∈ | ∅ | ⊆ | ⊇ | | FA *forall* | TE *exists* | (- *element of* | /0 *empty set* | (_ *subset or equal* | )_ *superset or equal* | | ∩ | ∪ | ⊂ | ⊃ | | (U *intersection* | )U *union* | (C *subset* | )C *superset* | ### Greek | Α | α | Β | β | Γ | γ | Δ | δ | Ε | ε | Ζ | ζ | | A* | a* | B* | b* | G* | g* | D* | d* | E* | e* | Z* | z* | | Η | η | Θ | θ | Ι | ι | Κ | κ | Λ | λ | Μ | μ | | Y* | y* | H* | h* | I* | i* | K* | k* | L* | l* | M* | m* | | Ν | ν | Ξ | ξ | Ο | ο | Π | π | Ρ | ρ | Σ | σ | ς | | N* | n* | C* | c* | O* | o* | P* | p* | R* | r* | S* | s* | *s | | Τ | τ | Υ | υ | Φ | φ | Χ | χ | Ψ | ψ | Ω | ω | | T* | t* | U* | u* | F* | f* | X* | x* | Q* | q* | W* | w* | ### Triangles | ▲ | △ | ▼ | ▽ | | UT | uT | Dt | dT | | ▶ | ▷ | ◀ | ◁ | | PR | Tr | PL | Tl | | » | « | 〈 | 〉 | ‹ | › | | >> | << | | <1 | >1 | ### Arrows | ← | → | ↑ | ↓ | ↕ | ↔ | | <- | -> | -! | -v | UD | <> | | ⇐ | ⇒ | ⇔ | | <= | => | == | ================================================ FILE: vim-easyalign.md ================================================ --- title: Vim Easyalign html_class: key-codes hljs_languages: [vim] category: Vim --- ## Command mode ### Align by delimiters ```vim :EasyAlign : " preset characters (\=:.,&#|) :EasyAlign | :EasyAlign \ " \ means space ``` ### Align by regexp ```vim :EasyAlign /[:;]+/ ``` ### Specify which ```vim :EasyAlign | " align by 1st `|` :EasyAlign 3 | " align by 3rd `|` :EasyAlign * | " align by all `|`s ``` ### Add options ```vim :EasyAlign * | l4r1 l4 " lN - left_margin r1 " rN - right_margin " spaces to the left/right of `|` ar " a[lrc] - align " align left/right/center dr " d[lrc] - delimiter_align " alignment of the delimiter itself ``` ### Spaces are optional ```vim :EasyAlign * /[;:]+/ l3 :EasyAlign*/[;:]+/l3 ``` ## Examples ### `:EasyAlign = dr` (delimiter_align right) ``` apple = 1 banana += apple cake ||= banana ``` ### `:EasyAlign :` (for json or yaml) ``` url: jdbc:mysql://localhost/test database: test ``` ### `:EasyAlign *|` (markdown tables) ```nohighlight | `` | right align | | `1` | on 1st occurrence | | `2` | on 2nd occurrence (and so on) | ``` ## Interactive mode | `{Visual}` `⏎` | activate for selection | | `ga` `{motion}` | activate for motion/text object | {:.greycode} Then press options (if available), then a delimiter. ### Interactive mode options | `⏎` | Set `alignment` | | `` `4 ⏎` | Set `left_margin` (to the left of the delimiter) | | `` `4 ⏎` | Set `right_margin` | | `↓` | no margin | {:.greycode} ### Example - `gaip` `` `8⏎` `=` - puts 8 spaces before the equal sign ## Also see - [vim-easy-align](https://github.com/junegunn/vim-easy-align) - [Examples](https://github.com/junegunn/vim-easy-align#examples) - [Alignment options](https://github.com/junegunn/vim-easy-align#alignment-options) ================================================ FILE: vim-help.md ================================================ --- title: Vim helpfiles category: Vim updated: 2017-09-09 --- ## Writing help files {: .-left-reference} ### Creating a document ```nohighlight :e doc/potion.txt :set ft=help :set ft=text ``` Use `ft=help` to preview it, and `ft=text` to edit it. ### Example ```nohighlight *ack.txt* Plugin that integrates ack with Vim ============================================================================== USAGE INSTRUCTIONS *ack-usage* :Ack[!] {pattern} *:Ack* Search recursively for {pattern}. See |:AckAdd|. Also see http://beyondgrep.com for more information. vim:tw=78:ts=8:ft=help:norl: ``` This is a cheatsheet for writing Vim help files. See: `:help help-writing` ## Syntax ### Reference | Code | Description | Example | | ----- | ----- | ----- | | *Inline items* | | ----- | ----- | ----- | | `*tags*` | Tags | | | `|link-to-tags|` | Links to tags | `|:command|` | | `'vimoption'` | Vim option | `'textwidth'` | | ----- | ----- | ----- | | `{code-text}` | Code text | `{Visual}gf` | | `` | Code text | `` | | `` `code-text` `` | Code text | `` `set fo=want` `` | | `CTRL-X` | Code text | | | ----- | ----- | ----- | | *Block items* | | ----- | ----- | ----- | | `INTRODUCTION *tag*` | Section header | | | `Column heading~` | Highlighting | | | `www.url.com` | Web URL | | | ----- | ----- | ----- | | `=====` | Separator | | | `-----` | Separator | | ### Tags * Tags are created with asterisks, eg, `*potion-usage*` * Links to tags are `|potion-usage|` * Press `^]` to jump to a tag ### Code blocks ``` Example: > xyz < ``` Surround with `>` and `<` characters ### File header ``` *potion.txt* functionality for the potion programming language ``` It's customary to start a file with a tag of the filename, plus a description. ### Heading ``` ============================================================================== CONTENTS *potion-contents* ``` Starts with `ALL CAPS`, ends with `*a-tag*` ### Notes Using `*Todo` and `*Error` will highlight your notes. ``` *Todo something to do *Error something wrong ``` ### Final modeline ```nohighlight vim:tw=78:ts=8:ft=help:norl: ``` ## Conventions ### Table of contents ```nohighlight |rails-introduction| Introduction and Feature Summary |rails-commands| General Commands |rails-navigation| Navigation ``` ```nohighlight 1.Intro...................................|ergonomic| 2.Note to use..............................|CAPSLOCK| 3.Insert Mode Remappings............|ergonomicInsert| ``` ### Author lines ```nohighlight Author: Jack Hackness *xyz-author* License: Same terms as Vim itself (see |license|) ``` ================================================ FILE: vim-rails.md ================================================ --- title: Vim-rails category: Vim html_class: key-codes --- Alternate files --------------- ### Alternate files | Command | Description | | --- | --- | | `:A` | alternate file (test) | | `:R` | related file (controller/view) | ### What it does | . | :A | :R | | ---- | --- | --- | | **Model** | test/models/ | db/schema.rb | | **Controller method** | test/controllers/ | app/views/ | | **View template** | test/views/ | app/controllers | Abbreviations ------------- Type `:Rabbrev` for a full list. | Abbrev | Expansion | | --- | --- | | `AC::` | ActionController | | `AR::` | ActiveRecord | | `AV::` | ActionView | | `...` | ... | | --- | --- | | `logd(` | logger.debug | | `logi(` | logger.info | | `...` | ... | {:.no-head.greycode} ### Model | Abbrev | Expansion | | --- | --- | | `bt(` | `belongs_to` | | `hm(` | `has_many` | | `ho(` | `has_one` | | `habtm(` | `has_and_belongs_to_many` | {:.no-head.greycode} ### Controllers | Abbrev | Expansion | | --- | --- | | `pa[` | params | | `re(` | redirect_to | | `rp(` | render partial: | | `rst(` | respond_to | {:.no-head.greycode} ### Views | Abbrev | Expansion | | --- | --- | | `dotiw` | `distance_of_time_in_words` | | `taiw` | `time_ago_in_words` | {:.no-head.greycode} Extracting partials ------------------- ```rb # from view => app/views/home/_foo_partial.haml :Rextract home/foo_partial # from model => app/models/concerns/foo_concern.rb :Rextract FooConcern ``` Loading files ------------- ### App :Econtroller # app/controllers/*_controller.rb :Ehelper # app/helpers/*_helper.rb :Emodel # app/models/*.rb :Ejob # app/jobs/*_job.rb :Emailer # app/mailers/*.rb ### DB :Emigration # db/migrations/*.rb :Eschema # db/schema.rb ### Lib :Elib # lib/*.rb :Elib # Gemfile :Etask # lib/tasks/*.rake ### Assets :Estylesheet :Ejavascript ### Views :Eview :Elayout ### Test :Espec :Eunittest # test/{unit,models,helpers}/*_test.rb # spec/{unit,models,helpers}/*_spec.rb :Efunctionaltest # test/{functional,controllers,mailers}/*_test.rb # spec/{functional,controllers,mailers}/*_spec.rb :Eintegrationtest # test/integration/*_test.rb # spec/{features,requests,integration}/*_spec.rb # features/*.feature :Efixtures :Efunctionaltest ### Config :Einitializer # config/initializers/*.rb :Elocale # config/locales/*.yml :Eenvironment # application.rb :Eenvironment development # config/environments/*.rb ## Reference * [vim-rails](https://github.com/tpope/vim-rails) ================================================ FILE: vim-unite.md ================================================ --- title: Vim-Unite category: Vim --- ### Usage ``` vim :Unite file :Unite file_rec/async:! :Unite tag :Unite buffer ``` ### Sources * `file/new` * `file/async` * `file_rec/async` * `file_rec/git` * `buffer` * `buffer_tab` (current tab only) * `tab` * `register` * `bookmark` * `source` ### Options | Option | Description | | -------------------------- | ----------------------------------------------------------- | | `-start-insert` | | | `-no-quit` | | | `-winheight=10` | | | `-quick-match` | select by pressing asdf keys | | `-winwidth=40` | use with vertical | | `-no-split` | open in current buffer | | `-auto-preview` | great for outline | | `-vertical` | open as sidebar | | `-buffer-name=xxx -resume` | resume the next time it's called (faster) | | `-input=` | reset input (use with -resume) | | `-unique` | remove duplicates (eg, if using `file_rec` with `file_mru`) | ================================================ FILE: vim.md ================================================ --- title: Vim category: Vim tags: [Featured] updated: 2020-07-05 weight: -10 --- ## Getting started {: .-three-column} ### Introduction [Vim](http://www.vim.org/) is a very efficient text editor. This reference was made for Vim 8.0. For shortcut notation, see `:help key-notation`. ### Exiting {: .-prime} | Shortcut | Description | | -------------- | -------------------------------- | | `:q` | Close file | | `:qa` | Close all files | | --- | --- | | `:w` | Save | | `:wq` _/_ `:x` | Save and close file | | --- | --- | | `ZZ` | Save and quit | | `:q!` _/_ `ZQ` | Quit without checking changes | {: .-shortcuts} ### Exiting insert mode | Shortcut | Description | | --- | --- | | `Esc` _/_ `` | Exit insert mode | | `` | Exit insert mode, and abort current command | {: .-shortcuts} ## Editing {: .-three-column} ### Editing | Shortcut | Description | | --- | --- | | `a` | Append | | `A` | Append from end of line | | `i` | Insert | | `o` | Next line | | `O` | Previous line | | --- | --- | | `s` | Delete char and insert | | `S` | Delete line and insert | | `C` | Delete until end of line and insert | | --- | --- | | `r` | Replace one character | | `R` | Enter Replace mode | | --- | --- | | `u` | Undo changes | | `` | Redo changes | {: .-shortcuts} ### Clipboard | Shortcut | Description | | --- | --- | | `x` | Delete character | | --- | --- | | `dd` | Delete line _(Cut)_ | | `yy` | Yank line _(Copy)_ | | --- | --- | | `p` | Paste | | `P` | Paste before | | --- | --- | | `"*p` _/_ `"+p` | Paste from system clipboard | | `"*y` _/_ `"+y` | Paste to system clipboard | {: .-shortcuts} ### Visual mode | Shortcut | Description | | --- | --- | | `v` | Enter visual mode | | `V` | Enter visual line mode | | `` | Enter visual block mode | {: .-shortcuts} #### In visual mode | Shortcut | Description | | --- | --- | | `d` _/_ `x` | Delete selection | | `s` | Replace selection | | `y` | Yank selection _(Copy)_ | {: .-shortcuts} See [Operators](#operators) for other things you can do. ### Find & Replace | Shortcut | Description | | --- | --- | | :%s/foo/bar/g | Replace foo with bar in whole document | ## Navigating {: .-three-column} ### Directions | Shortcut | Description | | --- | --- | | `h` `j` `k` `l` | Arrow keys | | `` _/_ `` | Half-page up/down | | `` _/_ `` | Page up/down | {: .-shortcuts} ### Words | Shortcut | Description | | --- | --- | | `b` _/_ `w` | Previous/next word | | `ge` _/_ `e` | Previous/next end of word | {: .-shortcuts} ### Line | Shortcut | Description | | --- | --- | | `0` _(zero)_ | Start of line | | `^` | Start of line _(after whitespace)_ | | `$` | End of line | {: .-shortcuts} ### Character | `fc` | Go forward to character `c` | | `Fc` | Go backward to character `c` | {: .-shortcuts} ### Document | Shortcut | Description | | --- | --- | | `gg` | First line | | `G` | Last line | | `:{number}` | Go to line `{number}` | | `{number}G` | Go to line `{number}` | | `{number}j` | Go down `{number}` lines | | `{number}k` | Go up `{number}` lines | {: .-shortcuts} ### Window | Shortcut | Description | | --- | --- | | `zz` | Center this line | | `zt` | Top this line | | `zb` | Bottom this line | | `H` | Move to top of screen | | `M` | Move to middle of screen | | `L` | Move to bottom of screen | {: .-shortcuts} ### Search | Shortcut | Description | | --- | --- | | `n` | Next matching search pattern | | `N` | Previous match | | `*` | Next whole word under cursor | | `#` | Previous whole word under cursor | {: .-shortcuts} Operators --------- {: .-three-column} ### Usage {: .-prime} Operators let you operate in a range of text (defined by *motion*). These are performed in normal mode. {: .-setup} | `d` | `w` | | Operator | Motion | {: .-css-breakdown} ### Operators list | Shortcut | Description | | --- | --- | | `d` | Delete | | `y` | Yank _(copy)_ | | `c` | Change _(delete then insert)_ | | --- | --- | | `>` | Indent right | | `<` | Indent left | | `=` | Autoindent | | --- | --- | | `g~` | Swap case | | `gU` | Uppercase | | `gu` | Lowercase | | --- | --- | | `!` | Filter through external program | {: .-shortcuts} See `:help operator` ### Examples Combine operators with *motions* to use them. {: .-setup} | Shortcut | Description | | --- | --- | | `d`_d_ | _(repeat the letter)_ Delete current line | | `d`_w_ | Delete to next word | | `d`_b_ | Delete to beginning of word | | _2_`dd` | Delete 2 lines | | `d`_ip_ | Delete a text object _(inside paragraph)_ | | _(in visual mode)_ `d` | Delete selection | See: `:help motion.txt` Text objects ------------ {: .-three-column} ### Usage {: .-prime} Text objects let you operate (with an *operator*) in or around text blocks (*objects*). {: .-setup} | `v` | `i` | `p` | | Operator | [i]nside or [a]round | Text object | {: .-css-breakdown} ### Text objects | Shortcut | Description | | --- | --- | | `p` | Paragraph | | `w` | Word | | `s` | Sentence | | --- | --- | | `[` `(` `{` `<` | A [], (), or {} block | | `'` `"` ` | A quoted string | | --- | --- | | `b` | A block [( | | `B` | A block in [{ | | `t` | A XML tag block | {: .-shortcuts} ### Examples | Shortcut | Description | | --- | --- | | `vip` | Select paragraph | | `vipipipip` | Select more | | --- | --- | | `yip` | Yank inner paragraph | | `yap` | Yank paragraph (including newline) | | --- | --- | | `dip` | Delete inner paragraph | | `cip` | Change inner paragraph | {: .-shortcuts} See [Operators](#operators) for other things you can do. ### Diff | Shortcut | Description | | --- | --- | | `gvimdiff file1 file2 [file3]` | See differences between files, in HMI | Misc ---- ### Tab pages | Shortcut | Description | | --- | --- | | `:tabedit [file]` | Edit file in a new tab | | `:tabfind [file]` | Open file if exists in new tab | | `:tabclose` | Close current tab | | `:tabs` | List all tabs | | `:tabfirst` | Go to first tab | | `:tablast` | Go to last tab | | `:tabn ` | Go to next tab | | `:tabp ` | Go to previous tab | ### Folds | Shortcut | Description | | --- | --- | | `zo` _/_ `zO` | Open | | `zc` _/_ `zC` | Close | | `za` _/_ `zA` | Toggle | | --- | --- | | `zv` | Open folds for this line | | --- | --- | | `zM` | Close all | | `zR` | Open all | | --- | --- | | `zm` | Fold more _(foldlevel += 1)_ | | `zr` | Fold less _(foldlevel -= 1)_ | | --- | --- | | `zx` | Update folds | {: .-shortcuts} Uppercase ones are recursive (eg, `zO` is open recursively). ### Navigation | Shortcut | Description | | --- | --- | | `%` | Nearest/matching `{[()]}` | | `[(` `[{` `[<` | Previous `(` or `{` or `<` | | `])` | Next | | --- | --- | | `[m` | Previous method start | | `[M` | Previous method end | {: .-shortcuts} ### Jumping | Shortcut | Description | | --- | --- | | `` | Go back to previous location | | `` | Go forward | | --- | --- | | `gf` | Go to file in cursor | {: .-shortcuts} ### Counters | Shortcut | Description | | --- | --- | | `` | Increment number | | `` | Decrement | {: .-shortcuts} ### Windows | `z{height}` | Resize pane to `{height}` lines tall | ### Tags | Shortcut | Description | | --- | --- | | `:tag Classname` | Jump to first definition of Classname | | --- | --- | | `` | Jump to definition | | `g]` | See all definitions | | `` | Go back to last tag | | ` ` | Back/forward | | --- | --- | | `:tselect Classname` | Find definitions of Classname | | `:tjump Classname` | Find definitions of Classname (auto-select 1st) | {: .-shortcuts} ### Case | Shortcut | Description | | --- | --- | | `~` | Toggle case (Case => cASE) | | `gU` | Uppercase | | `gu` | Lowercase | | --- | --- | | `gUU` | Uppercase current line (also `gUgU`) | | `guu` | Lowercase current line (also `gugu`) | {: .-shortcuts} Do these in visual or normal mode. ### Marks | Shortcut | Description | | --- | --- | | `^ | Last position of cursor in insert mode | | `. | Last change in current buffer | | `" | Last exited current buffer | | `0 | In last file edited | | '' | Back to line in current buffer where jumped from | | `` | Back to position in current buffer where jumped from | | `[ | To beginning of previously changed or yanked text | | `] | To end of previously changed or yanked text | | `< | To beginning of last visual selection | | `> | To end of last visual selection | | --- | --- | | `ma` | Mark this cursor position as `a` | | `a | Jump to the cursor position `a` | | `'a` | Jump to the beginning of the line with position `a` | | d'a | Delete from current line to line of mark `a` | | d`a | Delete from current position to position of mark `a` | | c'a | Change text from current line to line of `a` | | y`a | Yank text from current position to position of `a` | | --- | --- | | `:marks` | List all current marks | | `:delm a` | Delete mark `a` | | `:delm a-d` | Delete marks `a`, `b`, `c`, `d` | | `:delm abc` | Delete marks `a`, `b`, `c` | {: .-shortcuts} ### Misc | Shortcut | Description | | --- | --- | | `.` | Repeat last command | | `]p` | Paste under the current indentation level | | --- | --- | | `:set ff=unix` | Convert Windows line endings to Unix line endings | {: .-shortcuts} ### Command line | Shortcut | Description | | --- | --- | | `` | Insert current word into the command line | | `"` | Paste from " register | | `` | Auto-completion of path in insert mode | {: .-shortcuts} ### Text alignment :center [width] :right [width] :left See `:help formatting` ### Calculator | Shortcut | Description | | --- | --- | | `=128/2` | Shows the result of the division : '64' | Do this in insert mode. ### Exiting with an error :cq :cquit Works like `:qa`, but throws an error. Great for aborting Git commands. ### Spell checking | Shortcut | Description | | --- | --- | | `:set spell spelllang=en_us` | Turn on US English spell checking | | `]s` | Move to next misspelled word after the cursor | | `[s` | Move to previous misspelled word before the cursor | | `z=` | Suggest spellings for the word under/after the cursor | | `zg` | Add word to spell list | | `zw` | Mark word as bad/misspelling | | `zu` / `C-X (Insert Mode)` | Suggest words for bad word under cursor from spellfile | {: .-shortcuts} See `:help spell` Also see -------- - [Vim cheatsheet](https://vim.rtorr.com/) _(vim.rotrr.com)_ - [Vim documentation](http://vimdoc.sourceforge.net/htmldoc/) _(vimdoc.sourceforge.net)_ - [Interactive Vim tutorial](http://openvim.com/) _(openvim.com)_ ================================================ FILE: vimscript-functions.md ================================================ --- title: Vimscript functions category: Vim --- ## Dictionaries and lists ### Dictionaries ```vim let colors = { \ "apple": "red", \ "banana": "yellow" } echo colors["a"] echo get(colors, "apple") " suppress error remove(colors, "apple") " :help E715 if has_key(dict, 'foo') if empty(dict) keys(dict) len(dict) max(dict) min(dict) count(dict, 'x') string(dict) map(dict, '<>> " . v:val') extend(s:fruits, { ... }) ``` ```vim for key in keys(mydict) echo key . ': ' . mydict(key) endfor ``` ### Lists ```vim let mylist = [1, two, 3, "four"] let first = mylist[0] let last = mylist[-1] " Suppresses errors let second = get(mylist, 1) let second = get(mylist, 1, "NONE") ``` Functions --------- ### Buffer line('.') " current line number col('.') col('$') getline('.') " current line as a string getline(1) " get line 1 getline(1, 5) " get lines 1-5 search('^$') " next blank line, returns line number search('^$','n') " but don't move cursor getcurpos() " [bufnum, lnum, col, off, curswant] getpos('.') " [bufnum, lnum, col, off] nextnonblank(1) " next non-blank line after line1 prevnonblank() ### Marks getpos("'a") " position of a mark setpos("'a",...) getpos("'<") " position of selection start ### Cursor cursor(line,col) " moves cursor cursor(line,col,off,curswant) getcurpos() " returns [bufnum,line,col,off,curswant] ### Expand expand('') " word under cursor expand('%') " current file " current word on cursor " :p full path " :h head " :p:h dirname (/Users/rsc/project) " :t tail (file.txt) " :r root (file) " :e extension (.txt) " see :h cmdline-special ### Files fnameescape('string') fnamemodify('main.c', ':p:h') fnamemodify(fname, ':e') " current file extension - see expand() filereadable(fname) getfsize('file.txt') getcwd() globpath(&rtp, "plugin/commentary.vim") ### Math fmod(9, 2) " modulus abs(-0.5) sqrt(9) trunc(1.84) floor(1.84) ceil(1.84) float2nr(3.14) ### Casting str2float('0.2') str2nr('240') str2nr('ff', '16') string(0.3) ### Type checking type(var) == type(0) type(var) == type("") type(var) == type(function("tr")) type(var) == type([]) type(var) == type({}) type(var) == type(0.0) ### Date/time strftime('%c') strftime('%c',getftime('file.c')) ### Strings if a =~ '\s*' substitute(str, '.', 'x', 'g') strpart("abcdef", 3, 2) " == "de" (substring) strpart("abcdef", 3) " == "def" stridx("abcdef", "e") " == 4 strridx() " reverse matchstr('testing','test') " == 'test' (or '') match('testing','test') " == 0 matchend('testing','test') " == 4 match('testing','\ctest') " ignore case split(str, '\zs') " split into characters strlen(str) strchars() " accounts for composing chars strwidth() " accounts for ambig characters strdisplaywidth() " accounts for tab stops toupper(str) tolower(str) tr('foo', '_-', ' ') ### Syntax synstack(line('.'),col('.')) " returns many synID(line('.'),col('.'),1) " only one synIDattr(id,"bg") synIDattr(id,"name") synIDtrans() " syntax stack map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') ### Shell system('ls '.shellescape(expand('%:h'))) ### Registers getreg('*') getregtype('*') " v(char), V(line) (block) Comparisons ----------- if name ==# 'John' " case-sensitive if name ==? 'John' " case-insensitive if name == 'John' " depends on :set ignorecase " also: is#, is?, >=#, >=?, and so on if "hello" =~ '.*' if "hello" !~ '.*' Executing --------- ### Running commands normal 'ddahello' exe 'normal ^C' " with expansions wincmd J ================================================ FILE: vimscript-snippets.md ================================================ --- title: Vimscript snippets category: Vim --- ### Bind function to key and command command! YoFunctionHere call s:YoFunctionHere() nnoremap x :call FunctionHere() function! s:FunctionHere() endfunction ### Call a function in insert mode inoremap X =script#myfunction() inoremap =MyVimFunc()?'':'' ### Checking plugins if globpath(&rtp, "plugin/commentary.vim") != "" ## Autoload " autoload/hello.vim if exists("g:hello_loaded") | finish | endif let g:hello_loaded=1 function hello#method() endfunction " calling hello#method() will load only if autoload() ## Misc ### Version check if version < 704 echom "requires vim >= 7.4" endif ================================================ FILE: vimscript.md ================================================ --- title: Vim scripting category: Vim prism_languages: [vim] updated: 2020-07-05 weight: -10 tags: [Featurable] --- ### Start hacking ```vim let name = "John" echo "Hello, " . name ``` You can either put this in a script (`script.vim`) and run it (`:source script.vim`), or you can type the commands individually in normal mode as `:let` and `:echo`. ### Learn by example ```vim function! SuperTab() let l:part = strpart(getline('.'),col('.')-2,1) if (l:part =~ '^\W\?$') return "\" else return "\" endif endfunction imap =SuperTab() ``` [Here](http://www.vimbits.com/bits/46)'s another example with [functions](#functions), [variables](#variables) and [mapping](#mapping). Variables --------- ### Defining {: .-prime} ```vim let var = "hello" ``` ### Variable prefixes ```vim let g:ack_options = '-s -H' " g: global let s:ack_program = 'ack' " s: local (to script) let l:foo = 'bar' " l: local (to function) ``` The `s:` prefix is also available in function names. See `:help local-variables` ### Other prefixes ```vim let w:foo = 'bar' " w: window let b:state = 'on' " b: buffer let t:state = 'off' " t: tab echo v:var " v: vim special ``` ```vim let @/ = '' " @ register (this clears last search pattern) echo $PATH " $ env ``` ### Vim options ```vim echo 'tabstop is ' . &tabstop if &insertmode echo &g:option echo &l:option ``` Prefix Vim options with `&` ### Operators ```vim a + b " numbers only! 'hello ' . name " concat ``` ```vim let var -= 2 let var += 5 let var .= 'string' " concat ``` ## Strings ### Strings ```vim let str = "String" let str = "String with \n newline" let literal = 'literal, no \ escaping' let literal = 'that''s enough' " double '' => ' echo "result = " . re " concatenation ``` Also see `:help literal-string` and `:help expr-quote`. See: [Strings](http://learnvimscriptthehardway.stevelosh.com/chapters/26.html) ### String functions ```vim strlen(str) " length len(str) " same strchars(str) " character length split("one two three") "=> ['one', 'two', 'three'] split("one.two.three", '.') "=> ['one', 'two', 'three'] join(['a', 'b'], ',') "=> 'a,b' tolower('Hello') toupper('Hello') ``` Also see `:help functions` See: [String functions](http://learnvimscriptthehardway.stevelosh.com/chapters/27.html) Functions --------- ### Functions {: .-prime} ```vim " prefix with s: for local script-only functions function! s:Initialize(cmd, args) " a: prefix for arguments echo "Command: " . a:cmd return 1 endfunction ``` See: [Functions](http://learnvimscriptthehardway.stevelosh.com/chapters/23.html) ### Overwriting ```vim function f1() echo "f1" endfunction function! f1() echo "f1 overridden" endfunction ``` If you define two functions with the same name, Vim will throw an error complaining that the function `f1` already exists. To overwrite the previous function with the same name, add a `!` after the function keyword. ### Namespacing ```vim function! myplugin#hello() ``` ### Calling functions ```vim call s:Initialize() call s:Initialize("hello") ``` ### Consuming return values ```vim echo "Result: " . s:Initialize() ``` ### Abortable ```vim function! myfunction() abort endfunction ``` Aborts when an error occurs. ### Var arguments ```vim function! infect(...) echo a:0 "=> 2 echo a:1 "=> jake echo a:2 "=> bella for s in a:000 " a list echon ' ' . s endfor endfunction infect('jake', 'bella') ``` See `:help function-argument`. See: [Var arguments](http://learnvimscriptthehardway.stevelosh.com/chapters/24.html) Loops ----- ```vim for s in list echo s continue " jump to start of loop break " breaks out of a loop endfor ``` ```vim while x < 5 endwhile ``` Custom commands --------------- ### Custom commands {: .-prime} ```vim command! Save :set fo=want tw=80 nowrap ``` Custom commands start with uppercase letters. The `!` redefines a command if it already exists. ### Commands calling functions ```vim command! Save call foo() ``` {: .-setup} ```vim function! s:foo() ... endfunction ``` ### Commands with arguments ```vim command! -nargs=? Save call script#foo() ``` {: .-setup} | What | What | | ---- | ---- | | `-nargs=0` | 0 arguments, default | | `-nargs=1` | 1 argument, includes spaces | | `-nargs=?` | 0 or 1 argument | | `-nargs=*` | 0+ arguments, space separated | | `-nargs=+` | 1+ arguments, space reparated | Flow ---- ### Conditionals ```vim let char = getchar() if char == "\" " ... elseif char == "\" " ... else " ... endif ``` ### Truthiness ```vim if 1 | echo "true" | endif if 0 | echo "false" | endif ``` ```vim if 1 "=> 1 (true) if 0 "=> 0 (false) if "1" "=> 1 (true) if "456" "=> 1 (true) if "xfz" "=> 0 (false) ``` No booleans. `0` is false, `1` is true. See: [Truthiness](http://learnvimscriptthehardway.stevelosh.com/chapters/21.html) ### Operators ```vim if 3 > 2 if a && b if (a && b) || (c && d) if !c ``` See `:help expression-syntax`. See: [Operators](http://learnvimscriptthehardway.stevelosh.com/chapters/22.html) ### Strings ```vim if name ==# 'John' " case-sensitive if name ==? 'John' " case-insensitive if name == 'John' " depends on :set ignorecase " also: is#, is?, >=#, >=?, and so on ``` ### Identity operators ```vim a is b a isnot b ``` Checks if it's the same instance object. ### Regexp matches ```vim "hello" =~ 'xx*' "hello" !~ 'xx*' "hello" =~ '\v<\d+>' ``` `\v` enables "extended" regex mode which allows word boundary (`<>`), `+`, and more. ### Single line ```vim if empty(a:path) | return [] | endif a ? b : c ``` Use `|` to join lines together. ### Boolean logic ```vim if g:use_dispatch && s:has_dispatch ··· endif ``` Lists ----- ### Lists ```vim let mylist = [1, two, 3, "four"] let first = mylist[0] let last = mylist[-1] " Suppresses errors let second = get(mylist, 1) let second = get(mylist, 1, "NONE") ``` ### Functions ```vim len(mylist) empty(mylist) sort(list) let sortedlist = sort(copy(list)) split('hello there world', ' ') ``` ### Concatenation ```vim let longlist = mylist + [5, 6] let mylist += [7, 8] ``` ### Sublists ```vim let shortlist = mylist[2:-1] let shortlist = mylist[2:] " same let shortlist = mylist[2:2] " one item ``` ### Push ```vim let alist = [1, 2, 3] let alist = add(alist, 4) ``` ### Map ```vim call map(files, "bufname(v:val)") " use v:val for value call filter(files, 'v:val != ""') ``` Dictionaries ------------ ### Dictionaries ```vim let colors = { \ "apple": "red", \ "banana": "yellow" } echo colors["a"] echo get(colors, "apple") " suppress error ``` See `:help dict` ### Using dictionaries ```vim remove(colors, "apple") ``` ```vim " :help E715 if has_key(dict, 'foo') if empty(dict) keys(dict) len(dict) ``` ```vim max(dict) min(dict) ``` ```vim count(dict, 'x') string(dict) ``` ```vim map(dict, '<>> " . v:val') ``` ### Iteration ```vim for key in keys(mydict) echo key . ': ' . mydict[key] endfor ``` ### Prefixes ```vim keys(s:) ``` Prefixes (`s:`, `g:`, `l:`, etc) are actually dictionaries. ### Extending ```vim " Extending with more let extend(s:fruits, { ... }) ``` Casting ------- ```vim str2float("2.3") str2nr("3") float2nr("3.14") ``` Numbers ------- ### Numbers {: .-prime} ```vim let int = 1000 let int = 0xff let int = 0755 " octal ``` See `:help Number`. See: [Numbers](http://learnvimscriptthehardway.stevelosh.com/chapters/25.html) ### Floats ```vim let fl = 100.1 let fl = 5.4e4 ``` See `:help Float` ### Arithmetic ```vim 3 / 2 "=> 1, integer division 3 / 2.0 "=> 1.5 3 * 2.0 "=> 6.0 ``` ### Math functions ```vim sqrt(100) floor(3.5) ceil(3.3) abs(-3.4) sin() cos() tan() sinh() cosh() tanh() asin() acos() atan() ``` Vim-isms -------- ### Execute a command ```vim execute "vsplit" execute "e " . fnameescape(filename) ``` Runs an ex command you typically run with `:`. Also see `:help execute`. See: [Execute a command](http://learnvimscriptthehardway.stevelosh.com/chapters/28.html) ### Running keystrokes ```vim normal G normal! G " skips key mappings execute "normal! gg/foo\dd" ``` Use `:normal` to execute keystrokes as if you're typing them in normal mode. Combine with `:execute` for special keystrokes. See: [Running keystrokes](http://learnvimscriptthehardway.stevelosh.com/chapters/29.html) ### Getting filenames ```vim echo expand("%") " path/file.txt echo expand("%:t") " file.txt echo expand("%:p:h") " /home/you/path/file.txt echo expand("%:r") " path/file echo expand("%:e") " txt ``` See `:help expand` ### Silencing ```vim silent g/Aap/p ``` Suppresses output. See `:help silent` ### Echo ```vim echoerr 'oh it failed' echomsg 'hello there' echo 'hello' echohl WarningMsg | echomsg "=> " . a:msg | echohl None ``` ### Settings ```vim set number set nonumber set number! " toggle set numberwidth=5 set guioptions+=e ``` ### Prompts ```vim let result = confirm("Sure?") execute "confirm q" ``` ### Built-ins ```vim has("feature") " :h feature-list executable("python") globpath(&rtp, "syntax/c.vim") exists("$ENV") exists(":command") exists("variable") exists("+option") exists("g:...") ``` Mapping ------- {: .-three-column} ### Mapping commands ```vim nmap vmap imap xmap nnoremap vnoremap inoremap xnoremap ... ``` ### Explanation ```vim [nvixso](nore)map ``` ``` │ └ don't recurse │ └ normal, visual, insert, eX mode, select, operator-pending ``` {: .-setup} ### Arguments | `` | only in current buffer | | `` | no echo | | `` | | Syntax ------ ### Highlights ```vim hi Comment term=bold,underline gui=bold ctermfg=4 guifg=#80a0ff ``` ### Filetype detection ```vim augroup filetypedetect au! BufNewFile,BufRead *.json setf javascript augroup END au Filetype markdown setlocal spell ``` ### Conceal ```vim set conceallevel=2 syn match newLine "
" conceal cchar=} hi newLine guifg=green ``` ### Region conceal ```vim syn region inBold concealends matchgroup=bTag start="" end="" hi inBold gui=bold hi bTag guifg=blue ``` ### Syntax ```vim syn match :name ":regex" :flags syn region Comment start="/\*" end="\*/" syn region String start=+"+ end=+"+ skip=+\\"+ syn cluster :name contains=:n1,:n2,:n3... flags: keepend oneline nextgroup= contains= contained hi def link markdownH1 htmlH1 ``` ### Include guards ```vim if exists('g:loaded_myplugin') finish endif " ... let g:loaded_myplugin = 1 ``` ================================================ FILE: virtual-dom.md ================================================ --- title: Virtual-dom category: JavaScript libraries --- ### About See ### Example ```js var h = require('virtual-dom/h') var diff = require('virtual-dom/diff') var patch = require('virtual-dom/patch') var createElement = require('virtual-dom/create-element') ``` ### Rendering ```js tree = h('div', { style: { color: 'blue' } }, [ 'hello' ]) el = createElement(tree) document.body.appendChild(root) ``` ### Updating ```js tree2 = h('div', { style: { color: 'blue' } }, [ 'hello world' ]) delta = diff(tree, tree2) el = patch(el, delta) // patch() modifies el ``` ================================================ FILE: vite.config.js ================================================ import { fileURLToPath, URL } from 'url' import { defineConfig } from 'vitest/config' export default defineConfig({ test: { globals: true, environment: 'jsdom' }, resolve: { alias: { '~': fileURLToPath(new URL('./src', import.meta.url)) } } }) ================================================ FILE: vows.md ================================================ --- title: Vows category: JavaScript libraries --- ### About vows * [Vowsjs.org](http://vowsjs.org/) ### CoffeeScript usage vows = require "vows" assert = require "assert" vows .describe('My tests') .addBatch 'context': topic: -> 100 'should work': (number) -> assert.equal number, 100 .export(module) ### Running vows test/*-test.* --spec ### Assertions assert.equal a, b assert.notEqual a, b assert.strictEqual a, b assert.isNaN(number) assert.instanceOf(object, klass) assert.isUndefined(object) assert.isFunction(func) assert.isNull(object) assert.isNotZero(object) assert.isObject(object) assert.isString(object) ### Async .addBatch topic: -> doStuff() @callback 2 'check things': (n) -> assert.equal 2, n ================================================ FILE: vscode.md ================================================ --- title: Visual Studio Code category: Apps updated: 2018-02-01 weight: -5 keywords: - "⌘P: Show files" - "⌘B: Toggle sidebar" - "⌘J: Toggle panel" - "F5: Debug" intro: | [Visual Studio Code](https://code.visualstudio.com/), or VSCode, is an open-source code editor. This guide targets VSCode v1.19. --- ## Shortcuts {: .-three-column} ### Command palette | Key | Description | | ----- | ----------------- | | `⇧⌘P` | Show all commands | | `⌘P` | Show files | {: .-shortcuts} ### Sidebars | Key | Description | | ----- | -------------- | | `⌘B` | Toggle sidebar | | ---- | ---- | | `⇧⌘E` | Explorer | | `⇧⌘F` | Search | | `⇧⌘D` | Debug | | `⇧⌘X` | Extensions | | `⇧^G` | Git (SCM) | {: .-shortcuts} ### Search | Key | Description | | ----- | ---------------- | | `⌘F` | Find | | `⌥⌘F` | Replace | | ---- | ---- | | `⇧⌘F` | Find in files | | `⇧⌘H` | Replace in files | {: .-shortcuts} ### Panel | Key | Description | | -------------------------- | ------------- | | `⌘J` | Toggle panel | | ---- | ---- | | `⇧⌘M` | Problems | | `⇧⌘U` | Output | | `⇧⌘Y` | Debug console | | ^` | Terminal | {: .-shortcuts} ### View | Key | Description | | -------- | ---------------- | | `⌘k` `z` | Zen mode | | ---- | ---- | | `⌘k` `u` | Close unmodified | | `⌘k` `w` | Close all | {: .-shortcuts} ### Debug | Key | Description | | ------ | ----------------------- | | `F5` | Start | | `⇧F5` | Stop | | `⇧⌘F5` | Restart | | ---- | ---- | | `^F5` | Start without debugging | | ---- | ---- | | `F9` | Toggle breakpoint | | ---- | ---- | | `F10` | Step over | | `F11` | Step into | | `⇧F11` | Step out | | ---- | ---- | | `⇧⌘D` | Debug sidebar | | `⇧⌘Y` | Debug panel | {: .-shortcuts} ## References * [Keyboard shortcuts (MacOS)](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf) _(code.visualstudio.com)_ * [Keyboard shortcuts (Windows)](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf) _(code.visualstudio.com)_ * [Keyboard shortcuts (Linux)](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf) _(code.visualstudio.com)_ ================================================ FILE: vue.md ================================================ --- title: Vue.js category: JavaScript updated: 2019-12-26 weight: -10 intro: | [Vue.js](https://vuejs.org/) is an open-source Model–view–viewmodel JavaScript framework for building user interfaces and single-page applications. --- {%raw%} Expressions ---------- {: .-three-column} ### Expressions ```html

I have a {{ product }}

{{ product + 's' }}

{{ isWorking ? 'YES' : 'NO' }}

{{ product.getSalePrice() }}

``` See: [Delimiters](https://vuejs.org/v2/api/#delimiters) ### Binding ```html ... ``` #### Shorthand syntax ```html ... ``` {: data-line="1"} #### True or false will add or remove attribute ```html ``` ### Components ```js new Vue({ components: { app: App } }) ``` ## API ```js Vue.extend({ ... }) // creating components Vue.nextTick(() => {...}) Vue.set(object, key, val) // reactive Vue.delete(object, key) Vue.directive('my-dir', { bind, update, unbind }) //
Vue.elementDirective('my-dir', { bind, update, unbind }) // ... Vue.component('my-component', Vue.extend({ .. })) Vue.partial('my-partial', '
hi {{msg}}
') // ``` ```js new Vue({ data: { ... } props: ['size'], props: { size: Number }, computed: { fullname() { return this.name + ' ' + this.lastName } }, methods: { go() { ... } }, watch: { a (val, oldVal) { ... } }, el: '#foo', template: '...', replace: true, // replace element (default true) // lifecycle created () {}, beforeCompile () {}, compiled () {}, ready () {}, // $el is inserted for the first time attached () {}, detached () {}, beforeDestroy () {}, destroyed () {}, // options directives: {}, elementDirectives: {}, filters: {}, components: {}, transitions: {}, partials: {} }) ``` ## Vue templates Via [vueify](https://www.npmjs.com/package/vueify) ```js // app.vue ``` Also ```html ``` {% endraw %} ================================================ FILE: watchexec.md ================================================ --- title: Watchexec updated: 2017-10-18 category: CLI weight: -1 keywords: - "watchexec --excts js,jsx -- npm test" - "watchexec --help" intro: | [mattgreen/watchexec](https://github.com/mattgreen/watchexec) runs commands whenever certain files change. --- ### Installation #### OSX ```bash brew install watchexec ``` #### Rust ```bash cargo install watchexec ``` For Linux and Windows, get it from [GitHub releases](https://github.com/mattgreen/watchexec). ### Getting started ```bash watchexec --exts js,jsx -- npm test ``` Runs `npm test` when `js,jsx` files change. ```bash watchman -w lib -w test -- npm test ``` Runs `npm test` when `lib/` and `test/` files change. ### Other options #### Flags | `-c` `--clear` | Clear screen | | `-r` `--restart` | Restart process if its still running | #### Options | `-s` `--signal SIGKILL` | Kill signal to use | | `-d` `--debounce MS` | Debounce by `MS` milliseconds | | `-e` `--exts EXTS` | Extensions | | `-i` `--ignore PATTERN` | Ignore these files | | `-w` `--watch PATH` | Watch these directories | ## Also see * [mattgreen/watchexec](https://github.com/mattgreen/watchexec) _(github.com)_ ================================================ FILE: watchman.md ================================================ --- title: Watchman updated: 2017-10-18 weight: -1 keywords: - "watchman watch ~/src" - "watchman watch-list" - "watchman -- trigger ~/rsc remake '*.js' -- make " --- ### Getting started ```bash watchman watch ./src ``` Adds `./src` to the watch list. ```bash watchman -- trigger ./src retest '*.js' -- npm test ``` Adds a trigger called `retest` to run `npm test` every time `*.js` changes in `./src`. ### Watching ``` watchman watch ~/src watchman watch-list watchman watch-del ~/src ``` ## Also see * [Documentation](https://facebook.github.io/watchman/docs/install.html) _(facebook.github.io)_ ================================================ FILE: web-workers.md ================================================ --- title: Web workers category: JavaScript updated: 2017-10-30 weight: -1 --- ## Web workers #### Client ```js var worker = new Worker('worker.js') worker.onmessage = function (message) { alert(JSON.stringify(message.data)) }) worker.postMessage('hello!') ``` Messages can be anything that can be serialized into JSON (objects, arrays, strings, numbers, booleans). See: [structured clone](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) #### Worker ```js self.onmessage = function (message) { ··· } self.postMessage({ msg: 'hello' }) ``` ### Message data #### [MessageEvent] ```js bubbles: false cancelBubble: false cancelable: false clipboardData: undefined currentTarget: Worker data: "Hello" ← the data defaultPrevented: false eventPhase: 0 lastEventId: "" origin: "" ports: Array[0] returnValue: true source: null srcElement: Worker target: Worker timeStamp: 1344821022383 type: "message" ``` These are the contents of `message` on onmessage. ================================================ FILE: webpack.md ================================================ --- title: Webpack category: JavaScript libraries updated: 2017-09-26 intro: | This is a very basic "getting started with Webpack" guide for use with [Webpack](https://webpack.js.org) v3. This doesn't cover all features, but it should get you started in understanding the config file format. --- ### Basic config #### webpack.config.js ```js module.exports = { context: __dirname, entry: 'src/app.js', output: { path: __dirname + '/public', filename: 'app.js' } } ``` #### Terminal ```bash npm install --save-dev webpack ``` | `webpack` | build | `webpack -- -p` | build production | `webpack -- --watch` | compile continuously This compiles `src/app.js` into `public/app.js`. (Note: you may need to use `./node_modules/.bin/webpack` as a command if you're not invoking Webpack via npm scripts.) ### Multiple files #### webpack.config.js ```js module.exports = { entry: { app: 'src/app.js', vendor: 'src/vendor.js' }, output: { path: __dirname + '/public', filename: '[name].js' } } ``` {: data-line="2,3,4,8"} This creates `app.js` and `vendor.js`. ## Loaders ### Babel #### Terminal ```bash npm install --save-dev \ babel-loader \ babel-preset-env \ babel-preset-react ``` #### webpack.config.js ```js module.exports = { ··· module: { rules: [ { test: /\.js$/, exclude: /node_modules/, use: [ { loader: 'babel-loader' } ] } ] } } ``` {: data-line="3,4,5,6,7,8"} #### .babelrc ```js { "presets": [ "env", "react" ] } ``` Adds support for [Babel](http://babeljs.io). ### CSS #### Terminal ```bash npm install --save-dev \ css-loader \ style-loader ``` #### webpack.config.js ```js module.exports = { ··· module: { rules: [ { test: /\.css$/, exclude: /node_modules/, use: [ { loader: 'style-loader' }, { loader: 'css-loader' } ] } ] } } ``` {: data-line="3,4,5,6,7,8,9"} #### Your JavaScript ```js import './styles.css' // or: require('./styles.css') ``` This allows you to use CSS inside your JavaScript. This packages your CSS inside your JavaScript bundle. ### PostCSS #### Terminal ``` npm install --save-dev \ postcss-loader \ postcss-cssnext ``` #### webpack.config.js ```js ··· // Inside module.rules[]: { test: /\.css$/, exclude: /node_modules/, use: [ { loader: 'style-loader' }, { loader: 'css-loader' }, { loader: 'postcss-loader' } ··· ``` {: data-line="8"} #### postcss.config.js ```js module.exports = { plugins: [ require('postcss-cssnext')() ] } ``` {: data-line="3"} This example adds [postcss-cssnext](https://www.npmjs.com/package/postcss-cssnext) support to your CSS files. ## Other features ### Dev server #### package.json ```json { ··· "scripts": { "dev": "webpack-dev-server" } } ``` {: data-line="3"} #### Terminal ```bash npm install --save-dev \ webpack-dev-server ``` ```bash npm run dev ``` This starts an HTTP server for development (port 8080 by default). ================================================ FILE: weechat.md ================================================ --- title: Weechat category: Apps --- ## Keys {: .-three-column} ### Buffers | Shortcut | Description | | --- | --- | | `^s` / `^u` | Set unread marker on all windows | | --- | --- | | `^p, A-left` | Switch buffer left | | `^n, A-right` | Switch buffer right | | `A-a` | Next buffer with activity | | `A-0...9` | Switch buffers | | --- | --- | | `F9` /` F10` | Scroll buffer title | | `F11` / `F12` | Scroll nick list | | --- | --- | | `A-w A-Left` | Switch windows | | `A-w A-b` | Balance windows | {: .-shortcuts} (`A-` is alt.) ### Window commands | Shortcut | Description | | --- | --- | | `/window splith` | Split horizontal | | `/window splitv` | Split vertical | | `/window zoom` | Zoom | ### Search | `^r` | Search | | `Enter` `^j` `^m` | Stop search | {: .-shortcuts} ================================================ FILE: weinre.md ================================================ --- title: Weinre category: JavaScript libraries tags: [Archived] intro: | [weinre](https://www.npmjs.com/package/weinre) is a remote Web inspector. Note that it has been deprecated since 2016. archived: Weinre has been deprecated since 2016. --- ### Usage #### Install: ``` $ npm install -g weinre ``` #### Start the server: ``` $ weinre --boundHost 0.0.0.0 $ open http://localhost:8080 ``` ### HTML to inject ```html ``` ### References - [Weinre](http://people.apache.org/~pmuellr/weinre/) ================================================ FILE: wip/intl-datetime.md ================================================ --- title: Intl.DateTimeFormat category: Hidden tags: [WIP] intro: | `Intl.DateTimeFormat` is used to format date strings in JavaScript. --- ### Parsing #### As local time ```js const date = new Date(2012, 11, 20, 3, 0, 0) ``` #### As UTC time ```js const date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)) ``` #### From ISO strings ```js const date = new Date('2018-04-20T12:00:00Z') ``` Note that JavaScript doesn't "store" timezones in a date object. All these date objects, when expressed via `.toString()` or similar, will show the local timezone of the browser, regardless if you parsed UTC dates. ### Formatting dates #### Default formatting ```js console.log(new Intl.DateTimeFormat().format(date)) // → '12/19/2012' (assuming America/Los_Angeles) ``` #### Custom locale ```js console.log(new Intl.DateTimeFormat('en-GB').format(date)) // → '19/12/2012' (date-first) ``` #### Custom timezone ```js console.log(new Intl.DateTimeFormat('en-AU', { timeZone: 'Australia/Sydney' }).format(date)) // → '19/12/2012' ``` ### Custom formats #### Time ```js console.log(new Intl.DateTimeFormat('default', { hour: 'numeric', minute: 'numeric', second: 'numeric' }).format(date)) // → '2:00:00 pm' ``` #### Date ```js console.log(new Intl.DateTimeFormat('en-US', { year: 'numeric', month: 'numeric', day: 'numeric' }).format(date)) // → '12/19/2012' ``` To specify options without a locale, use `'default'` as a locale. ### All options ```js { weekday: 'narrow' | 'short' | 'long', era: 'narrow' | 'short' | 'long', year: 'numeric' | '2-digit', month: 'numeric' | '2-digit' | 'narrow' | 'short' | 'long', day: 'numeric' | '2-digit', hour: 'numeric' | '2-digit', minute: 'numeric' | '2-digit', second: 'numeric' | '2-digit', timeZoneName: 'short' | 'long', // Time zone to express it in timeZone: 'Asia/Shanghai', // Force 12-hour or 24-hour hour12: true | false, // Rarely-used options hourCycle: 'h11' | 'h12' | 'h23' | 'h24', formatMatcher: 'basic' | 'best fit' } ``` ## References - ================================================ FILE: wip/php.md ================================================ --- title: PHP category: PHP prism_languages: [php] --- ### Hello world #### hello.php ```php 20, "banana" => 30 ); echo $fruitsArray['banana']; ``` Or cast as object ```php banana; ``` ### Inspecting objects ```php name = 'bob'; echo $person->name; ``` ### Getters and setters ```php class Person { private $name = ''; public function getName(): string { return $this->name; } public function setName(string $name) { $this->name = $name; return $this; } } $person = new Person(); $person->setName('bob'); echo $person->getName(); ``` ### isset vs empty ```php $options = [ 'key' => 'value', 'blank' => '', 'nothing' => null, ]; var_dump(isset($options['key']), empty($options['key'])); // true, false var_dump(isset($options['blank']), empty($options['blank'])); // true, true var_dump(isset($options['nothing']), empty($options['nothing'])); // false, true ``` ================================================ FILE: xpath.md ================================================ --- title: Xpath category: HTML tags: [Featured] weight: -5 description: | $x('//div//p//*') == $('div p *'), $x('//[@id="item"]') == $('#item'), and many other Xpath examples. --- ## Testing ### Xpath test bed {: .-intro} Test queries in the Xpath test bed: - [Xpath test bed](http://www.whitebeam.org/library/guide/TechNotes/xpathtestbed.rhtm) _(whitebeam.org)_ ### Browser console ```js $x("//div") ``` Works in Firefox and Chromium browsers. ## Selectors ### Descendant selectors | CSS | Xpath | ? | | ---- | ---- | -- | | `h1` | `//h1` | [?](#prefixes) | | `div p` | `//div//p` | [?](#axes) | | `ul > li` | `//ul/li` | [?](#axes) | | `ul > li > a` | `//ul/li/a` | | | `div > *` | `//div/*` | | | ---- | ---- | -- | | `:root` | `/` | [?](#prefixes) | | `:root > body` | `/body` | | {: .xp} ### Attribute selectors | CSS | Xpath | ? | | ---- | ---- | -- | | `#id` | `//*[@id="id"]` | [?](#predicates) | | `.class` | `//*[@class="class"]` *...[kinda](#class-check)* | | | `input[type="submit"]` | `//input[@type="submit"]` | | | `a#abc[for="xyz"]` | `//a[@id="abc"][@for="xyz"]` | [?](#chaining-order) | | `a[rel]` | `//a[@rel]` | | | ---- | ---- | -- | | `a[href^='/']` | `//a[starts-with(@href, '/')]` | [?](#string-functions) | | `a[href$='pdf']` | `//a[ends-with(@href, '.pdf')]` | | | `a[href*='://']` | `//a[contains(@href, '://')]` | | | `a[rel~='help']` | `//a[contains(@rel, 'help')]` *...[kinda](#class-check)* | | {: .xp} ### Order selectors | CSS | Xpath | ? | | ---- | ---- | -- | | `ul > li:first-of-type` | `//ul/li[1]` | [?](#indexing) | | `ul > li:nth-of-type(2)` | `//ul/li[2]` | | | `ul > li:last-of-type` | `//ul/li[last()]` | | | `li#id:first-of-type` | `//li[1][@id="id"]` | [?](#chaining-order) | | `a:first-child` | `//*[1][name()="a"]` | | | `a:last-child` | `//*[last()][name()="a"]` | | {: .xp} ### Siblings | CSS | Xpath | ? | | ---- | ---- | -- | | `h1 ~ ul` | `//h1/following-sibling::ul` | [?](#using-axes) | | `h1 + ul` | `//h1/following-sibling::ul[1]` | | | `h1 ~ #id` | `//h1/following-sibling::[@id="id"]` | | {: .xp} ### jQuery | CSS | Xpath | ? | | ---- | ---- | -- | | `$('ul > li').parent()` | `//ul/li/..` | [?](#other-axes) | | `$('li').closest('section')` | `//li/ancestor-or-self::section` | | | `$('a').attr('href')` | `//a/@href` | [?](#steps) | | `$('span').text()` | `//span/text()` | | {: .xp} ### Other things | CSS | Xpath | ? | | ---- | ---- | -- | | `h1:not([id])` | `//h1[not(@id)]` | [?](#boolean-functions) | | Text match | `//button[text()="Submit"]` | [?](#operators) | | Text match (substring) | `//button[contains(text(),"Go")]` | | | Arithmetic | `//product[@price > 2.50]` | | | Has children | `//ul[*]` | | | Has children (specific) | `//ul[li]` | | | Or logic | `//a[@name or @href]` | [?](#operators) | | Union (joins results) | `//a | //div` | [?](#unions) | {: .xp} ### Class check ```bash //div[contains(concat(' ',normalize-space(@class),' '),' foobar ')] ``` Xpath doesn't have the "check if part of space-separated list" operator, so this is the workaround ([source](http://pivotallabs.com/xpath-css-class-matching/)). Expressions ----------- ### Steps and axes | `//` | `ul` | `/` | `a[@id='link']` | | Axis | Step | Axis | Step | {: .-css-breakdown} ### Prefixes | Prefix | Example | What | | --- | --- | --- | | `//` | `//hr[@class='edge']` | Anywhere | | `./` | `./a` | Relative | | `/` | `/html/body/div` | Root | {: .-headers} Begin your expression with any of these. ### Axes | Axis | Example | What | | --- | --- | --- | | `/` | `//ul/li/a` | Child | | `//` | `//[@id="list"]//a` | Descendant | {: .-headers} Separate your steps with `/`. Use two (`//`) if you don't want to select direct children. ### Steps ```bash //div //div[@name='box'] //[@id='link'] ``` A step may have an element name (`div`) and [predicates](#predicate) (`[...]`). Both are optional. They can also be these other things: ```bash //a/text() #=> "Go home" //a/@href #=> "index.html" //a/* #=> All a's child elements ``` Predicates ---------- ### Predicates ```bash //div[true()] //div[@class="head"] //div[@class="head"][@id="top"] ``` Restricts a nodeset only if some condition is true. They can be chained. ### Operators ```bash # Comparison //a[@id = "xyz"] //a[@id != "xyz"] //a[@price > 25] ``` ```bash # Logic (and/or) //div[@id="head" and position()=2] //div[(x and y) or not(z)] ``` Use comparison and logic operators to make conditionals. ### Using nodes ```bash # Use them inside functions //ul[count(li) > 2] //ul[count(li[@class='hide']) > 0] ``` ```bash # This returns `
IsteEtSequiEt
Blanditiis