Compare commits
37 Commits
ce159a55bc
...
717149060c
Author | SHA1 | Date |
---|---|---|
pierretou | 717149060c | |
Rico Sta. Cruz | fffa95b86b | |
Mathis Chenuet | 1325a4c6e6 | |
Rico Sta. Cruz | 7f81a61d0d | |
Rico Sta. Cruz | 42dd9eff84 | |
Rico Sta. Cruz | 511de900ba | |
Rico Sta. Cruz | 641915c80c | |
Rob Barreca | d62bbeb024 | |
Artem | 758a48d9c5 | |
Sam Weaver | 8e03519c2b | |
slockhax | e067bd588d | |
luka598 | ba20f0bf67 | |
Rico Sta. Cruz | 9ef88ffade | |
Menno Spijker | 4b05ba3b0a | |
Rico Sta. Cruz | a7b5dbe1e7 | |
Rico Sta. Cruz | d138253d1e | |
Rico Sta. Cruz | 49f5585e62 | |
Rico Sta. Cruz | feb02eb551 | |
Rico Sta. Cruz | a7335649e2 | |
Rico Sta. Cruz | faa73e54b0 | |
Rico Sta. Cruz | 44bdd413fb | |
Rico Sta. Cruz | bf059536c6 | |
Rico Sta. Cruz | 021ec16bf1 | |
Rico Sta. Cruz | 1c9e012802 | |
Rico Sta. Cruz | 2ac6e0ed0c | |
Yudai Takada | dc91d7f64e | |
Yudai Takada | e8bfec363f | |
Jared Wenerd | bdf7fc2505 | |
Tamas Papp | dc066dc18f | |
BSD-Yassin | 46907176f9 | |
Daniel Metzler | 4f18d6a46b | |
Rico Sta. Cruz | d4cac4c37e | |
Rico Sta. Cruz | 3e4487a8ed | |
Pierre TOUVIER | 42cfd75bee | |
Pierre TOUVIER | 101fd905e6 | |
pierretou | 43fddd4459 | |
pierretou | 3a6243142c |
11
.babelrc
11
.babelrc
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"useBuiltIns": "entry",
|
||||
"targets": "> 2%"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
node_modules
|
|
@ -0,0 +1,37 @@
|
|||
/* 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"
|
||||
// },
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
yarn.lock binary
|
Before Width: | Height: | Size: 504 KiB After Width: | Height: | Size: 504 KiB |
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 148 KiB |
|
@ -1,22 +1,39 @@
|
|||
name: Build and test
|
||||
on: [push, pull_request]
|
||||
|
||||
name: Run tests
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
pull_request:
|
||||
branches: [main, master]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v3
|
||||
|
||||
- name: Use Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
- 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 }
|
||||
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn build
|
||||
- run: yarn test
|
||||
- run: yarn test:smoke
|
||||
# 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@v3
|
||||
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
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
name: Deploy
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 'Notes (read me) 📖'
|
||||
run: |
|
||||
# About this workflow:
|
||||
# This workflow generates GitHub pages, but IT IS NOT USED. It is
|
||||
# only generated as an emergency fallback in case Netlify goes down 😊
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v3
|
||||
|
||||
- name: Use Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
bundler-cache: true
|
||||
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn build
|
||||
|
||||
- name: 'Deploy to gh-pages 🚀'
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v3
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BRANCH: gh-pages
|
||||
FOLDER: _site
|
||||
|
||||
- name: 'Deploy to mirror 🚀'
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v3
|
||||
with:
|
||||
ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
||||
REPOSITORY_NAME: rstacruz/devhints-mirror
|
||||
BRANCH: gh-pages
|
||||
FOLDER: _site
|
||||
|
||||
- name: 'Notify Slack 📢'
|
||||
uses: rtCamp/action-slack-notify@v2.0.2
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_DEPLOY_WEBHOOK_URL }}
|
|
@ -1,11 +1,26 @@
|
|||
_output
|
||||
_site
|
||||
.jekyll-metadata
|
||||
/node_modules
|
||||
/vendor
|
||||
.idea/
|
||||
.cache/
|
||||
# build output
|
||||
dist/
|
||||
# generated types
|
||||
.astro/
|
||||
|
||||
# Generated by 'yarn dev'
|
||||
/_includes/2017/critical/*
|
||||
/assets/packed/*
|
||||
# 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
|
||||
|
|
15
.gitpod.yml
15
.gitpod.yml
|
@ -1,15 +0,0 @@
|
|||
image: gitpod/workspace-full
|
||||
|
||||
ports:
|
||||
- port: 4001
|
||||
onOpen: open-preview
|
||||
|
||||
tasks:
|
||||
- init: yarn install && bundle install
|
||||
command: env PORT=4001 yarn run dev
|
||||
|
||||
github:
|
||||
# Prebuild the docker image for gitpod - https://www.gitpod.io/docs/prebuilds/
|
||||
prebuilds:
|
||||
# enable for the master/default branch
|
||||
master: true
|
|
@ -1 +1 @@
|
|||
20.9.0
|
||||
20.11.1
|
|
@ -0,0 +1,6 @@
|
|||
src/sass/vendor
|
||||
vendor
|
||||
.cache
|
||||
dist
|
||||
*.md
|
||||
pnpm-lock.yaml
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"jsxSingleQuote": true,
|
||||
"trailingComma": "none"
|
||||
"trailingComma": "none",
|
||||
"plugins": ["prettier-plugin-astro"]
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"*.md": {
|
||||
"type": "cheat",
|
||||
"template": [
|
||||
"---",
|
||||
"title: {basename|capitalize}",
|
||||
"category: Ruby",
|
||||
"layout: 2017/sheet",
|
||||
"updated: DATE",
|
||||
"---"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
3.2.3
|
||||
3.2.2
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"recommendations": ["astro-build.astro-vscode"],
|
||||
"unwantedRecommendations": []
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"command": "./node_modules/.bin/astro dev",
|
||||
"name": "Development server",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"Test snip": {
|
||||
"prefix": ["about"],
|
||||
"body": "Copyright. Foo Corp 2028",
|
||||
"description": "Adds copyright...",
|
||||
"scope": "markdown"
|
||||
}
|
||||
}
|
1
101.md
1
101.md
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: 101
|
||||
category: JavaScript libraries
|
||||
layout: 2017/sheet
|
||||
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.
|
||||
|
|
|
@ -19,7 +19,7 @@ Or using a button:<br>
|
|||
|
||||
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.
|
||||
|
||||
<img src='_docs/images/gitpod_preview_tut.png' width=828 height=459/>
|
||||
<img src='.github/images/gitpod_preview_tut.png' width=828 height=459/>
|
||||
|
||||
## Starting a local instance
|
||||
|
||||
|
@ -84,8 +84,6 @@ Each sheet supports these metadata:
|
|||
```yml
|
||||
---
|
||||
title: React.js
|
||||
layout: 2017/sheet # 'default' | '2017/sheet'
|
||||
|
||||
# Optional:
|
||||
category: React
|
||||
updated: 2020-06-14
|
||||
|
|
11
Dockerfile
11
Dockerfile
|
@ -1,11 +0,0 @@
|
|||
FROM ruby:2.7.1
|
||||
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
|
||||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
||||
RUN apt-get update -qq && apt-get install -qq --no-install-recommends \
|
||||
nodejs \
|
||||
yarn \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN mkdir -p /app
|
||||
WORKDIR /app
|
9
Gemfile
9
Gemfile
|
@ -1,5 +1,4 @@
|
|||
source 'https://rubygems.org'
|
||||
gem 'webrick'
|
||||
gem 'github-pages', group: :jekyll_plugins
|
||||
gem 'json'
|
||||
gem 'csv'
|
||||
source "https://rubygems.org"
|
||||
gem "minitest"
|
||||
gem "kramdown"
|
||||
gem "kramdown-parser-gfm"
|
||||
|
|
288
Gemfile.lock
288
Gemfile.lock
|
@ -1,293 +1,21 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (7.1.3)
|
||||
base64
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
connection_pool (>= 2.2.5)
|
||||
drb
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
mutex_m
|
||||
tzinfo (~> 2.0)
|
||||
addressable (2.8.6)
|
||||
public_suffix (>= 2.0.2, < 6.0)
|
||||
base64 (0.2.0)
|
||||
bigdecimal (3.1.6)
|
||||
coffee-script (2.4.1)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.11.1)
|
||||
colorator (1.1.0)
|
||||
commonmarker (0.23.10)
|
||||
concurrent-ruby (1.2.3)
|
||||
connection_pool (2.4.1)
|
||||
csv (3.2.8)
|
||||
dnsruby (1.70.0)
|
||||
simpleidn (~> 0.2.1)
|
||||
drb (2.2.0)
|
||||
ruby2_keywords
|
||||
em-websocket (0.5.3)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0)
|
||||
ethon (0.16.0)
|
||||
ffi (>= 1.15.0)
|
||||
eventmachine (1.2.7)
|
||||
execjs (2.9.1)
|
||||
faraday (2.9.0)
|
||||
faraday-net_http (>= 2.0, < 3.2)
|
||||
faraday-net_http (3.1.0)
|
||||
net-http
|
||||
ffi (1.16.3)
|
||||
forwardable-extended (2.6.0)
|
||||
gemoji (3.0.1)
|
||||
github-pages (228)
|
||||
github-pages-health-check (= 1.17.9)
|
||||
jekyll (= 3.9.3)
|
||||
jekyll-avatar (= 0.7.0)
|
||||
jekyll-coffeescript (= 1.1.1)
|
||||
jekyll-commonmark-ghpages (= 0.4.0)
|
||||
jekyll-default-layout (= 0.1.4)
|
||||
jekyll-feed (= 0.15.1)
|
||||
jekyll-gist (= 1.5.0)
|
||||
jekyll-github-metadata (= 2.13.0)
|
||||
jekyll-include-cache (= 0.2.1)
|
||||
jekyll-mentions (= 1.6.0)
|
||||
jekyll-optional-front-matter (= 0.3.2)
|
||||
jekyll-paginate (= 1.1.0)
|
||||
jekyll-readme-index (= 0.3.0)
|
||||
jekyll-redirect-from (= 0.16.0)
|
||||
jekyll-relative-links (= 0.6.1)
|
||||
jekyll-remote-theme (= 0.4.3)
|
||||
jekyll-sass-converter (= 1.5.2)
|
||||
jekyll-seo-tag (= 2.8.0)
|
||||
jekyll-sitemap (= 1.4.0)
|
||||
jekyll-swiss (= 1.0.0)
|
||||
jekyll-theme-architect (= 0.2.0)
|
||||
jekyll-theme-cayman (= 0.2.0)
|
||||
jekyll-theme-dinky (= 0.2.0)
|
||||
jekyll-theme-hacker (= 0.2.0)
|
||||
jekyll-theme-leap-day (= 0.2.0)
|
||||
jekyll-theme-merlot (= 0.2.0)
|
||||
jekyll-theme-midnight (= 0.2.0)
|
||||
jekyll-theme-minimal (= 0.2.0)
|
||||
jekyll-theme-modernist (= 0.2.0)
|
||||
jekyll-theme-primer (= 0.6.0)
|
||||
jekyll-theme-slate (= 0.2.0)
|
||||
jekyll-theme-tactile (= 0.2.0)
|
||||
jekyll-theme-time-machine (= 0.2.0)
|
||||
jekyll-titles-from-headings (= 0.5.3)
|
||||
jemoji (= 0.12.0)
|
||||
kramdown (= 2.3.2)
|
||||
kramdown-parser-gfm (= 1.1.0)
|
||||
liquid (= 4.0.4)
|
||||
mercenary (~> 0.3)
|
||||
minima (= 2.5.1)
|
||||
nokogiri (>= 1.13.6, < 2.0)
|
||||
rouge (= 3.26.0)
|
||||
terminal-table (~> 1.4)
|
||||
github-pages-health-check (1.17.9)
|
||||
addressable (~> 2.3)
|
||||
dnsruby (~> 1.60)
|
||||
octokit (~> 4.0)
|
||||
public_suffix (>= 3.0, < 5.0)
|
||||
typhoeus (~> 1.3)
|
||||
html-pipeline (2.14.3)
|
||||
activesupport (>= 2)
|
||||
nokogiri (>= 1.4)
|
||||
http_parser.rb (0.8.0)
|
||||
i18n (1.14.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jekyll (3.9.3)
|
||||
addressable (~> 2.4)
|
||||
colorator (~> 1.0)
|
||||
em-websocket (~> 0.5)
|
||||
i18n (>= 0.7, < 2)
|
||||
jekyll-sass-converter (~> 1.0)
|
||||
jekyll-watch (~> 2.0)
|
||||
kramdown (>= 1.17, < 3)
|
||||
liquid (~> 4.0)
|
||||
mercenary (~> 0.3.3)
|
||||
pathutil (~> 0.9)
|
||||
rouge (>= 1.7, < 4)
|
||||
safe_yaml (~> 1.0)
|
||||
jekyll-avatar (0.7.0)
|
||||
jekyll (>= 3.0, < 5.0)
|
||||
jekyll-coffeescript (1.1.1)
|
||||
coffee-script (~> 2.2)
|
||||
coffee-script-source (~> 1.11.1)
|
||||
jekyll-commonmark (1.4.0)
|
||||
commonmarker (~> 0.22)
|
||||
jekyll-commonmark-ghpages (0.4.0)
|
||||
commonmarker (~> 0.23.7)
|
||||
jekyll (~> 3.9.0)
|
||||
jekyll-commonmark (~> 1.4.0)
|
||||
rouge (>= 2.0, < 5.0)
|
||||
jekyll-default-layout (0.1.4)
|
||||
jekyll (~> 3.0)
|
||||
jekyll-feed (0.15.1)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-gist (1.5.0)
|
||||
octokit (~> 4.2)
|
||||
jekyll-github-metadata (2.13.0)
|
||||
jekyll (>= 3.4, < 5.0)
|
||||
octokit (~> 4.0, != 4.4.0)
|
||||
jekyll-include-cache (0.2.1)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-mentions (1.6.0)
|
||||
html-pipeline (~> 2.3)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-optional-front-matter (0.3.2)
|
||||
jekyll (>= 3.0, < 5.0)
|
||||
jekyll-paginate (1.1.0)
|
||||
jekyll-readme-index (0.3.0)
|
||||
jekyll (>= 3.0, < 5.0)
|
||||
jekyll-redirect-from (0.16.0)
|
||||
jekyll (>= 3.3, < 5.0)
|
||||
jekyll-relative-links (0.6.1)
|
||||
jekyll (>= 3.3, < 5.0)
|
||||
jekyll-remote-theme (0.4.3)
|
||||
addressable (~> 2.0)
|
||||
jekyll (>= 3.5, < 5.0)
|
||||
jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0)
|
||||
rubyzip (>= 1.3.0, < 3.0)
|
||||
jekyll-sass-converter (1.5.2)
|
||||
sass (~> 3.4)
|
||||
jekyll-seo-tag (2.8.0)
|
||||
jekyll (>= 3.8, < 5.0)
|
||||
jekyll-sitemap (1.4.0)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-swiss (1.0.0)
|
||||
jekyll-theme-architect (0.2.0)
|
||||
jekyll (> 3.5, < 5.0)
|
||||
jekyll-seo-tag (~> 2.0)
|
||||
jekyll-theme-cayman (0.2.0)
|
||||
jekyll (> 3.5, < 5.0)
|
||||
jekyll-seo-tag (~> 2.0)
|
||||
jekyll-theme-dinky (0.2.0)
|
||||
jekyll (> 3.5, < 5.0)
|
||||
jekyll-seo-tag (~> 2.0)
|
||||
jekyll-theme-hacker (0.2.0)
|
||||
jekyll (> 3.5, < 5.0)
|
||||
jekyll-seo-tag (~> 2.0)
|
||||
jekyll-theme-leap-day (0.2.0)
|
||||
jekyll (> 3.5, < 5.0)
|
||||
jekyll-seo-tag (~> 2.0)
|
||||
jekyll-theme-merlot (0.2.0)
|
||||
jekyll (> 3.5, < 5.0)
|
||||
jekyll-seo-tag (~> 2.0)
|
||||
jekyll-theme-midnight (0.2.0)
|
||||
jekyll (> 3.5, < 5.0)
|
||||
jekyll-seo-tag (~> 2.0)
|
||||
jekyll-theme-minimal (0.2.0)
|
||||
jekyll (> 3.5, < 5.0)
|
||||
jekyll-seo-tag (~> 2.0)
|
||||
jekyll-theme-modernist (0.2.0)
|
||||
jekyll (> 3.5, < 5.0)
|
||||
jekyll-seo-tag (~> 2.0)
|
||||
jekyll-theme-primer (0.6.0)
|
||||
jekyll (> 3.5, < 5.0)
|
||||
jekyll-github-metadata (~> 2.9)
|
||||
jekyll-seo-tag (~> 2.0)
|
||||
jekyll-theme-slate (0.2.0)
|
||||
jekyll (> 3.5, < 5.0)
|
||||
jekyll-seo-tag (~> 2.0)
|
||||
jekyll-theme-tactile (0.2.0)
|
||||
jekyll (> 3.5, < 5.0)
|
||||
jekyll-seo-tag (~> 2.0)
|
||||
jekyll-theme-time-machine (0.2.0)
|
||||
jekyll (> 3.5, < 5.0)
|
||||
jekyll-seo-tag (~> 2.0)
|
||||
jekyll-titles-from-headings (0.5.3)
|
||||
jekyll (>= 3.3, < 5.0)
|
||||
jekyll-watch (2.2.1)
|
||||
listen (~> 3.0)
|
||||
jemoji (0.12.0)
|
||||
gemoji (~> 3.0)
|
||||
html-pipeline (~> 2.2)
|
||||
jekyll (>= 3.0, < 5.0)
|
||||
json (2.7.1)
|
||||
kramdown (2.3.2)
|
||||
kramdown (2.4.0)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
liquid (4.0.4)
|
||||
listen (3.8.0)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
mercenary (0.3.6)
|
||||
minima (2.5.1)
|
||||
jekyll (>= 3.5, < 5.0)
|
||||
jekyll-feed (~> 0.9)
|
||||
jekyll-seo-tag (~> 2.1)
|
||||
minitest (5.21.2)
|
||||
mutex_m (0.2.0)
|
||||
net-http (0.4.1)
|
||||
uri
|
||||
nokogiri (1.16.1-aarch64-linux)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.16.1-arm-linux)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.16.1-arm64-darwin)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.16.1-x86-linux)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.16.1-x86_64-darwin)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.16.1-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
octokit (4.25.1)
|
||||
faraday (>= 1, < 3)
|
||||
sawyer (~> 0.9)
|
||||
pathutil (0.16.2)
|
||||
forwardable-extended (~> 2.6)
|
||||
public_suffix (4.0.7)
|
||||
racc (1.7.3)
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rexml (3.2.6)
|
||||
rouge (3.26.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
rubyzip (2.3.2)
|
||||
safe_yaml (1.0.5)
|
||||
sass (3.7.4)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
sawyer (0.9.2)
|
||||
addressable (>= 2.3.5)
|
||||
faraday (>= 0.17.3, < 3)
|
||||
simpleidn (0.2.1)
|
||||
unf (~> 0.1.4)
|
||||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
typhoeus (1.4.1)
|
||||
ethon (>= 0.9.0)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.9.1)
|
||||
unicode-display_width (1.8.0)
|
||||
uri (0.13.0)
|
||||
webrick (1.8.1)
|
||||
minitest (5.18.0)
|
||||
rexml (3.2.5)
|
||||
|
||||
PLATFORMS
|
||||
aarch64-linux
|
||||
arm-linux
|
||||
arm64-darwin
|
||||
x86-linux
|
||||
x86_64-darwin
|
||||
aarch64-linux-android
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
csv
|
||||
github-pages
|
||||
json
|
||||
webrick
|
||||
kramdown
|
||||
kramdown-parser-gfm
|
||||
minitest
|
||||
|
||||
BUNDLED WITH
|
||||
2.5.3
|
||||
2.4.1
|
||||
|
|
21
LICENSE
21
LICENSE
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021 Rico Sta. Cruz and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
19
Makefile
19
Makefile
|
@ -1,19 +0,0 @@
|
|||
npmbin := ./node_modules/.bin
|
||||
PORT ?= 3000
|
||||
HOST ?= 127.0.0.1
|
||||
|
||||
help:
|
||||
@echo
|
||||
@echo Makefile targets
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
@echo
|
||||
|
||||
# Builds intermediate files. Needs a _site built first though
|
||||
update: _site
|
||||
|
||||
# Builds _site
|
||||
_site:
|
||||
yarn build
|
||||
|
||||
dev:
|
||||
yarn dev
|
|
@ -4,16 +4,10 @@
|
|||
TL;DR for developer documentation - a ridiculous collection of cheatsheets
|
||||
</blockquote>
|
||||
|
||||
<p align='center'>
|
||||
<a href='https://travis-ci.org/rstacruz/cheatsheets'><img src='https://travis-ci.org/rstacruz/cheatsheets.svg?branch=master' alt='See test builds'></a>
|
||||
<a href='https://github.com/rstacruz/cheatsheets/actions?query=workflow%3ADeploy'><img src='https://github.com/rstacruz/cheatsheets/workflows/Deploy/badge.svg' alt='GitHub pages deploy status'></a>
|
||||
<a href='https://app.netlify.com/sites/devhints-cheatsheets/deploys'><img src='https://api.netlify.com/api/v1/badges/c66b2a8b-5147-4243-9bf6-e2143126f6c8/deploy-status' alt='Netlify deploy status'></a>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
||||
<p align='center'>
|
||||
<a href='https://devhints.io/'><img src='_docs/images/screenshot.png' width=600></a>
|
||||
<a href='https://devhints.io/'><img src='.github/images/screenshot.png' width=600></a>
|
||||
<br>
|
||||
✨ <b><a href='https://devhints.io/'>devhints.io</a></b> ✨
|
||||
</p>
|
||||
|
|
65
_config.yml
65
_config.yml
|
@ -1,65 +0,0 @@
|
|||
# Jekyll configuration
|
||||
|
||||
whitelist:
|
||||
- jekyll-redirect-from
|
||||
- jekyll-github-metadata
|
||||
|
||||
plugins:
|
||||
- jekyll-redirect-from
|
||||
- jekyll-github-metadata
|
||||
|
||||
exclude:
|
||||
- .babelrc
|
||||
- .cache
|
||||
- CNAME
|
||||
- CONTRIBUTING.md
|
||||
- cssnano.config.js
|
||||
- docker_compose.yml
|
||||
- Dockerfile
|
||||
- Gemfile
|
||||
- Gemfile.lock
|
||||
- Makefile
|
||||
- node_modules
|
||||
- package.json
|
||||
- package-lock.json
|
||||
- postcss.config.js
|
||||
- README.md
|
||||
- vendor
|
||||
- webpack.config.js
|
||||
- yarn-error.log
|
||||
- yarn.lock
|
||||
|
||||
# Markdown
|
||||
|
||||
highlighter: false
|
||||
markdown: kramdown
|
||||
kramdown:
|
||||
input: GFM
|
||||
hard_wrap: false
|
||||
parse_block_html: true
|
||||
syntax_highlighter_opts:
|
||||
disable: true
|
||||
|
||||
# Defaults
|
||||
|
||||
defaults:
|
||||
- scope:
|
||||
path: ""
|
||||
type: pages
|
||||
values:
|
||||
layout: "default"
|
||||
og_type: article
|
||||
type: article
|
||||
category: "Others"
|
||||
excerpt_separator: "<!--more-->"
|
||||
prism_languages: []
|
||||
|
||||
# Site info
|
||||
|
||||
url: https://devhints.io
|
||||
title: Devhints.io cheatsheets
|
||||
|
||||
# GitHub metadata
|
||||
# https://help.github.com/articles/repository-metadata-on-github-pages/
|
||||
|
||||
repository: rstacruz/cheatsheets
|
|
@ -1,2 +0,0 @@
|
|||
# No trailing slash
|
||||
preview_host: https://assets.devhints.io/previews
|
|
@ -1,2 +0,0 @@
|
|||
enabled: true
|
||||
src: https://pubsrv.devhints.io/carbon.js?serve=CE7IK5QM&placement=devhintsio
|
|
@ -1,30 +0,0 @@
|
|||
enabled: true
|
||||
names:
|
||||
- Analytics
|
||||
- Ansible
|
||||
- Apps
|
||||
- C-like
|
||||
- CLI
|
||||
- CSS
|
||||
- Databases
|
||||
- Devops
|
||||
- Elixir
|
||||
- Git
|
||||
- HTML
|
||||
- Java & JVM
|
||||
- JavaScript
|
||||
- JavaScript libraries
|
||||
- Jekyll
|
||||
- Ledger
|
||||
- Markup
|
||||
- macOS
|
||||
- Node.js
|
||||
- PHP
|
||||
- Python
|
||||
- Rails
|
||||
- React
|
||||
- Ruby
|
||||
- Ruby libraries
|
||||
- Vim
|
||||
- Fitness
|
||||
- Others
|
|
@ -1,2 +0,0 @@
|
|||
enabled: true
|
||||
# token: "c2c8bc62-c275-4c7a-a304-74335c5a1cd0"
|
|
@ -1,51 +0,0 @@
|
|||
home:
|
||||
title: "Rico's cheatsheets"
|
||||
tagline: |
|
||||
Hey! I'm <a href='https://ricostacruz.com'>@rstacruz</a> and this is a modest collection of cheatsheets I've written.
|
||||
|
||||
top_nav:
|
||||
title: Devhints.io
|
||||
edit: Edit
|
||||
edit_on_github: Edit this page on GitHub
|
||||
|
||||
sheet:
|
||||
suffix: cheatsheet
|
||||
|
||||
social_list:
|
||||
default_description: 'Ridiculous collection of web development cheatsheets'
|
||||
description: 'The ultimate cheatsheet for TITLE.'
|
||||
facebook_share: Share on Facebook
|
||||
twitter_share: Share on Twitter
|
||||
|
||||
related_posts_callout:
|
||||
description: Over SIZE curated cheatsheets, by developers for developers.
|
||||
link: Devhints home
|
||||
|
||||
related_posts_group:
|
||||
top: Top cheatsheets
|
||||
other: Other cheatsheets
|
||||
category: Other CATEGORY cheatsheets
|
||||
|
||||
search_form:
|
||||
default_placeholder: Search SIZE+ cheatsheets
|
||||
home_placeholder: Search...
|
||||
prefix: devhints.io
|
||||
|
||||
comments_area:
|
||||
suffix: for this cheatsheet.
|
||||
link: 'Write yours!'
|
||||
|
||||
not_found:
|
||||
title: Not found
|
||||
description: Sorry, we don't have a cheatsheet for this yet. Try searching!
|
||||
home: Back to home
|
||||
|
||||
announcement:
|
||||
# id: 2017-10-26-twitter
|
||||
id: 2023-12-14
|
||||
title: |
|
||||
We're on Twitter ♥️
|
||||
body: |
|
||||
Follow [@devhints](https://twitter.com/devhints) on X/Twitter for daily "today I learned" snippets.
|
||||
|
||||
Also: I've started a new blog with some insights on web devlopment. Have a look! [**ricostacruz.com/posts**](https://ricostacruz.com/posts?utm_source=devhints)
|
|
@ -1,2 +0,0 @@
|
|||
enabled: true
|
||||
host: devhints.disqus.com
|
|
@ -1,4 +0,0 @@
|
|||
enabled: true
|
||||
hostname: devhints.io
|
||||
id: "G-N7TC6B227L"
|
||||
# id: "UA-106902774-1"
|
|
@ -1,81 +0,0 @@
|
|||
---
|
||||
title: Ansible
|
||||
category: Ruby
|
||||
---
|
||||
|
||||
## Looping
|
||||
|
||||
### Array (with_items)
|
||||
|
||||
```yaml
|
||||
vars:
|
||||
security_groups:
|
||||
- name: 'hello'
|
||||
desc: 'world'
|
||||
|
||||
- name: 'hola'
|
||||
desc: 'mundo'
|
||||
|
||||
tasks:
|
||||
- name: Create required security groups
|
||||
ec2_group:
|
||||
name: "{{ item.name }}"
|
||||
description: "{{ item.desc }}"
|
||||
with_items: "{{ security_groups }}"
|
||||
```
|
||||
|
||||
### Object (with_dict)
|
||||
|
||||
```yaml
|
||||
tasks:
|
||||
- name: Print phone records
|
||||
debug: msg="User {{ item.key }} is {{ item.value.name }} ({{ item.value.telephone }})"
|
||||
with_dict: "{{ users }}"
|
||||
```
|
||||
|
||||
## with_file
|
||||
|
||||
```yaml
|
||||
- name: "Send key"
|
||||
ec2_key:
|
||||
key_material: "{{ item }}"
|
||||
with_file: ./keys/sshkey.pub
|
||||
|
||||
# or
|
||||
with_fileglob: ./keys/*.pub
|
||||
```
|
||||
|
||||
### Conditionals
|
||||
|
||||
```yml
|
||||
- include: setup-debian.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
when: (ansible_distribution == "CentOS" and ansible_distribution_major_version == "6") or
|
||||
(ansible_distribution == "Debian" and ansible_distribution_major_version == "7")
|
||||
|
||||
|
||||
# Just like "and"
|
||||
when:
|
||||
- ansible_distribution == "CentOS"
|
||||
- ansible_distribution_major_version == "6"
|
||||
```
|
||||
|
||||
## Expressions
|
||||
|
||||
```
|
||||
{{ item }}
|
||||
{{ item.name }}
|
||||
{{ item[0].name }}
|
||||
|
||||
{{ item | default('latest') }}
|
||||
```
|
||||
|
||||
## Includes
|
||||
|
||||
```
|
||||
tasks:
|
||||
- include: wordpress.yml
|
||||
vars:
|
||||
wp_user: timmy
|
||||
```
|
|
@ -1,78 +0,0 @@
|
|||
# Installing
|
||||
wget "http://kohanaphp.com/download?modules%5Bauth%5D=Auth&languages%5Ben_US%5D=en_US&format=zip" -O k.zip &&\
|
||||
unzip -q k.zip && rm k.zip &&\
|
||||
mv Kohana_*/* . && rm -rf Kohana_* &&\
|
||||
rm -f "Kohana License.html" &&\
|
||||
# htaccess
|
||||
cat example.htaccess | sed 's/RewriteBase .*/RewriteBase \//g' > .htaccess && rm example.htaccess &&\
|
||||
echo Done! Go and edit application/config/config.php and change the site stuff.
|
||||
|
||||
# Public HTML
|
||||
mkdir -p public_html &&\
|
||||
mv index.html public_html &&\
|
||||
mv .htaccess public_html &&\
|
||||
echo Done. Now edit index.html's paths
|
||||
|
||||
Git ignore
|
||||
(echo \*.swo; echo \*.swp; echo .DS_Store; echo Thumbs.db; echo \*~; echo application/logs; echo application/cache ) > .gitignore &&\
|
||||
|
||||
# Database
|
||||
$config['default'] = array
|
||||
(
|
||||
'benchmark' => TRUE,
|
||||
'persistent' => FALSE,
|
||||
'connection' => array
|
||||
(
|
||||
'type' => 'mysql',
|
||||
'user' => 'leet', // set to db user name
|
||||
'pass' => 'l33t', // set to db user password
|
||||
'host' => 'localhost',
|
||||
'port' => FALSE,
|
||||
'socket' => FALSE,
|
||||
'database' => 'leetdb' // set to db name
|
||||
),
|
||||
'character_set' => 'utf8',
|
||||
'table_prefix' => '',
|
||||
'object' => TRUE,
|
||||
'cache' => FALSE,
|
||||
'escape' => TRUE
|
||||
);
|
||||
|
||||
|
||||
// ORM model
|
||||
class Post_Model extends ORM {
|
||||
protected $has_one = array('user'); // has_many, belong_to, has_one, has_and_belongs_to_many
|
||||
}
|
||||
|
||||
// ORM
|
||||
$post = ORM::factory('post', 1);
|
||||
$post->name = "Post name";
|
||||
$post->save();
|
||||
foreach ($post->categories as $category)
|
||||
{
|
||||
echo $category->name;
|
||||
}
|
||||
|
||||
// Find (returns even if no row is found)
|
||||
$o = ORM::factory('article')->find(1);
|
||||
$o = ORM::factory('article')->where('title', $title)->find();
|
||||
if (!$o->loaded) { die('Not found'); }
|
||||
echo $o->title;
|
||||
|
||||
// Find_all
|
||||
$o = ORM::factory('article')->find_all();
|
||||
foreach ($o as $article) { echo $article->title; }
|
||||
|
||||
// ->$saved
|
||||
// ->$changed[]
|
||||
// ->$object_name (Blog_Post_Model => "blog_post")
|
||||
// ->$primary_key ('id')
|
||||
// ->$primary_val ('username') - more userfriendly identifier
|
||||
// ->$table_name
|
||||
// ->$ignored_columns = array('whatever')
|
||||
// ->$table_columns = array('id', 'username')
|
||||
// ->$sorting = array('last_login' => 'desc') -- default sorting
|
||||
|
||||
//
|
||||
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
# Debug
|
||||
logger.debug "xx"
|
||||
|
||||
# Controller stuff
|
||||
class MyController < ApplicationController::Base
|
||||
controller.response.body
|
||||
|
||||
# Filters
|
||||
before_filter :require_login # Looks for require_login method
|
||||
before_filter MyFilter # Looks for MyFilter class
|
||||
before_filter { |ct| head(400) if ct.params["stop_action"] }
|
||||
around_filter :catch_exceptions
|
||||
after_filter :xx
|
||||
|
||||
layout "admin_area" # Looks for the view file
|
||||
layout "admin_area", :except => [ :rss, :whatever ]
|
||||
layout :foo # Looks for private function foo
|
||||
|
||||
private
|
||||
def whatever ...
|
||||
|
||||
class MyFilter
|
||||
def self.filter(controller, &block)
|
||||
|
||||
# Model
|
||||
|
||||
belongs_to :user
|
||||
validates_presence_of :user
|
||||
default_scope :order => 'id DESC'
|
||||
named_scope :today, :conditions = "created_at x"
|
||||
named_scope :today, lambda {{ :conditions = [ "created_at between ? and ?", 1.hour.ago.utc, 300.seconds.ago.utc ] }}
|
||||
# Then you can call feed.today
|
||||
|
||||
# Controller methods
|
||||
render :action => 'help', :layout => 'help'
|
||||
render :text => 'so and so'
|
||||
render :status => :created, :location => post_url(post) # With HTTP headers
|
||||
redirect_to :action => 'index'
|
||||
render :partial => 'product', :collection => @products, :as => :item, :spacer_template => "product_ruler"
|
||||
return head(:method_not_allowed)
|
||||
head :created, :location => '...'
|
||||
|
||||
url_for :controller => 'posts', :action => 'recent'
|
||||
|
||||
location = request.env["SERVER_ADDR"]
|
||||
|
||||
# For views
|
||||
auto_discovery_link_tag(:rss, {:action => "feed"}, {:title => "RSS Feed"})
|
||||
javascript_include_tag "foo"
|
||||
stylesheet_link_tag
|
||||
image_tag
|
||||
|
||||
# Ruby stuff!
|
||||
# Defining a class method (not a typo)
|
||||
Fixnum.instance_eval { def ten; 10; end }
|
||||
Fixnum.ten # => 10
|
||||
|
||||
# Defining an instance method
|
||||
Fixnum.class_eval { def number; self; end }
|
||||
7.number #=> 7
|
||||
|
||||
# Multiple arguments, send()
|
||||
class Klass
|
||||
def hello(*args); "Hello " + args.join(' '); end
|
||||
end
|
||||
Klass.new.send :hello, "gentle", "readers"
|
||||
|
||||
def can(*args)
|
||||
yield if can?(*args)
|
||||
end
|
||||
# can(x) {...} => if can?(x) {...}
|
||||
|
||||
|
||||
|
||||
# Struct
|
||||
class Foo < Struct.new(:name, :email)
|
||||
end
|
||||
|
||||
j = Foo.new("Jason", "jason@bateman.com")
|
||||
j.name = "Hi"
|
||||
print j.name
|
||||
|
||||
|
||||
# Struct
|
||||
class Foo < Struct.new(:name, :email)
|
||||
end
|
||||
|
||||
j = Foo.new("Jason", "jason@bateman.com")
|
||||
j.name = "Hi"
|
||||
print j.name
|
||||
|
||||
|
||||
# Method missing
|
||||
def method_missing(method_name, *arguments)
|
||||
if method_name.to_s[-1,1] == "?"
|
||||
self == method_name.to_s[0..-2]
|
||||
|
||||
|
||||
# Rails logger
|
||||
Rails.logger.info("...")
|
||||
|
||||
# To string
|
||||
:hello_there.to_s
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
---
|
||||
title: Cinema4d
|
||||
category: Apps
|
||||
---
|
||||
|
||||
E R T : Move/rotate/scale
|
||||
P : snapping
|
|
@ -1,56 +0,0 @@
|
|||
---
|
||||
title: Compass sprites
|
||||
---
|
||||
|
||||
### Compass: Sprites
|
||||
|
||||
@import compass/utilities/sprites
|
||||
|
||||
$sprites: sprite-map('sprites/*.png')
|
||||
$sprites: sprite-map('sprites/*.png', $spacing: 20px)
|
||||
|
||||
@mixin sprite($name)
|
||||
background-image: sprite-url($sprite)
|
||||
|
||||
+sprite-dimensions($sprite, $name)
|
||||
width: image-width(sprite-file($sprite, $name)
|
||||
height: image-height(sprite-file($sprite, $name)
|
||||
|
||||
+sprite-background-position($sprite, $name[, $offset-x, $offset-y])
|
||||
background-position: sprite-position($sprite, $name)
|
||||
nth(sprite-position($sprite, $name), 1) # X position
|
||||
nth(sprite-position($sprite, $name), 2) # Y position
|
||||
|
||||
### Compass: Sprites (the @import way)
|
||||
|
||||
// Sprite sets (applies to icon/*.png)
|
||||
$icon-spacing: 0
|
||||
$icon-dimensions: true
|
||||
$icon-repeat: no-repeat
|
||||
$icon-position: 0
|
||||
|
||||
// Individual (applies to icon/mail.png)
|
||||
$icon-mail-spacing: 0
|
||||
|
||||
@import 'icon/*.png'
|
||||
@include all-icon-sprites
|
||||
|
||||
// Usage
|
||||
.image1
|
||||
@extend .icon-mail
|
||||
|
||||
.image2
|
||||
@extend .icon-refresh;
|
||||
|
||||
// ### Advanced control
|
||||
// The sprite map is available as $icon-sprites. You can then use
|
||||
// `sprite()` on it.
|
||||
|
||||
.image3
|
||||
background: sprite($icon-sprites, refresh)
|
||||
//background: url(...) 0 -16px;
|
||||
|
||||
.image3-with-offset
|
||||
background: sprite($icon-sprites, refresh, -2px, -9px)
|
||||
//background: url(...) -2px -19px;
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
---
|
||||
title: Docker on OSX
|
||||
category: Devops
|
||||
---
|
||||
|
||||
You'll need these:
|
||||
|
||||
* [boot2docker] - bootstraps a Virtualbox VM to run a docker daemon
|
||||
* [docker] - docker client
|
||||
|
||||
### Install
|
||||
|
||||
$ brew install boot2docker
|
||||
$ brew install docker
|
||||
$ boot2docker init
|
||||
|
||||
### Turning on
|
||||
|
||||
$ boot2docker start
|
||||
|
||||
Waiting for VM to be started...... Started.
|
||||
To connect the Docker client to the Docker daemon, please set:
|
||||
|
||||
export DOCKER_HOST=tcp://192.168.59.103:2375
|
||||
|
||||
$ export DOCKER_HOST=tcp://192.168.59.103:2375
|
||||
|
||||
### Try it
|
||||
|
||||
$ docker search ubuntu
|
||||
|
||||
$ docker pull ubuntu
|
||||
$ docker start ubuntu
|
||||
|
||||
### Turning off
|
||||
|
||||
$ boot2docker save
|
||||
# save state to disk
|
||||
|
||||
### Vagrant
|
||||
|
||||
[boot2docker]: https://github.com/boot2docker/boot2docker
|
||||
[docker]: https://www.docker.com/
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
title: eslint
|
||||
category: JavaScript libraries
|
||||
---
|
||||
|
||||
```js
|
||||
// "comma-dangle": "always" ("always-multiline", "never")
|
||||
var foo = {
|
||||
bar: "baz",
|
||||
qux: "quux",
|
||||
};
|
||||
var arr = [1,2,];
|
||||
```
|
||||
|
||||
```
|
||||
// "yoda": "always" ("never")
|
||||
if ("red" === color)
|
||||
```
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
title: GitHub
|
||||
category: Git
|
||||
---
|
||||
|
||||
### URLs
|
||||
|
||||
github.com/:userrepo/blame/:branch/:path
|
||||
github.com/:userrepo/commit/:commit
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
title: jQuery mobile events
|
||||
category: JavaScript libraries
|
||||
---
|
||||
|
||||
### Mobile events
|
||||
|
||||
For support for `tap`, `swipe`, `swipeLeft`, et al, use
|
||||
[jquery.mobile.event.js][m]. Be sure to set `$.support.touch` first.
|
||||
|
||||
To get `$.support.touch` (and family), use this from
|
||||
[jquery.mobile.support.js][s]:
|
||||
|
||||
$.extend($.support, {
|
||||
orientation: "orientation" in window && "onorientationchange" in window,
|
||||
touch: "ontouchend" in document,
|
||||
cssTransitions: "WebKitTransitionEvent" in window,
|
||||
pushState: "pushState" in history && "replaceState" in history,
|
||||
mediaquery: $.mobile.media( "only all" ),
|
||||
cssPseudoElement: !!propExists( "content" ),
|
||||
touchOverflow: !!propExists( "overflowScrolling" ),
|
||||
boxShadow: !!propExists( "boxShadow" ) && !bb,
|
||||
scrollTop: ( "pageXOffset" in window || "scrollTop" in document.documentElement || "scrollTop" in fakeBody[ 0 ] ) && !webos && !operamini,
|
||||
dynamicBaseTag: baseTagTest()
|
||||
});
|
||||
|
||||
[m]:https://github.com/jquery/jquery-mobile/blob/master/js/jquery.mobile.event.js
|
||||
[s]:https://github.com/jquery/jquery-mobile/blob/master/js/jquery.mobile.support.js
|
|
@ -1,32 +0,0 @@
|
|||
---
|
||||
title: node-gh
|
||||
category: JavaScript libraries
|
||||
---
|
||||
|
||||
## Everywhere
|
||||
|
||||
| Flag | Description |
|
||||
| ---- | ---- |
|
||||
| `-u rstacruz -r nprogress` | Repo name |
|
||||
| `--browser` | Browser |
|
||||
{:.no-head}
|
||||
|
||||
## Notifications
|
||||
|
||||
```
|
||||
gh nt
|
||||
gh nt --watch
|
||||
```
|
||||
|
||||
## Issues
|
||||
|
||||
| Command | Description |
|
||||
| ---- | ---- |
|
||||
| `gh is 'Issue name'` | Create issue |
|
||||
| `gh is --search 'foo'` | Search issues |
|
||||
| `gh is 'Name' 'Description'` | Create issue |
|
||||
| `gh is 123` | Modify issue `123` (use with flags below) |
|
||||
| ... `-L`/`--label x,y,z` | Add label |
|
||||
| ... `-A`/`--assignee` | Assign to user |
|
||||
| ... `-c`/`--comment 'Thanks'` | Add a comment
|
||||
{:.no-head}
|
|
@ -1,7 +0,0 @@
|
|||
---
|
||||
title: Git one-liners
|
||||
---
|
||||
|
||||
When did someone work
|
||||
|
||||
git log --all --author='Rico' --pretty="%ai" | awk '{ print $1 }' | sort | uniq
|
|
@ -1,26 +0,0 @@
|
|||
|
||||
### Encrypt decrypt
|
||||
|
||||
gpg --encrypt --recepient 'James Receiverson' foo.txt
|
||||
gpg --decrypt foo.txt.gpg
|
||||
|
||||
### Making keys
|
||||
|
||||
gpg --gen-key
|
||||
|
||||
### Share your public key
|
||||
|
||||
# via file
|
||||
gpg --armor --output pub.txt --export "Rico Sta. Cruz"
|
||||
|
||||
# via server
|
||||
gpg --send-keys "Rico Sta. Cruz" --keyserver http://...
|
||||
|
||||
### Key management
|
||||
|
||||
gpg --list-keys
|
||||
gpg --delete-key 'email@addie'
|
||||
|
||||
### See
|
||||
|
||||
* https://www.madboa.com/geek/gpg-quickstart/
|
|
@ -1,19 +0,0 @@
|
|||
---
|
||||
title: Homebrew formula
|
||||
---
|
||||
|
||||
brew create http://example.com/foo-0.1.tar.gz
|
||||
|
||||
https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md#formula-cookbook
|
||||
|
||||
assert(this.ary.indexOf(zero) === two)
|
||||
|
||||
|
||||
```
|
||||
def install
|
||||
system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
|
||||
system "make", "install"
|
||||
cd "build/cmake"
|
||||
mv "a", "b"
|
||||
end
|
||||
```
|
|
@ -1,21 +0,0 @@
|
|||
---
|
||||
title: iOS
|
||||
---
|
||||
|
||||
Multiple Exchange accounts:
|
||||
|
||||
scp root@iphone.local:/private/var/mobile/Library/Preferences/com.apple.accountsettings.plist .
|
||||
|
||||
Paths:
|
||||
|
||||
/Library/Themes # Winterboard themes
|
||||
/User/Media/DCIM/100APPLE # Photos
|
||||
/User/Media/Recordings # Voice recordings
|
||||
|
||||
Copy photos:
|
||||
|
||||
rsync -v -r root@iphone.local:/User/Media/DCIM/100APPLE ./photos
|
||||
|
||||
Ringtone conversion using ffmpeg:
|
||||
|
||||
ffmpeg -i foo.mp3 -ac 1 -ab 128000 -f mp4 -acodec libfaac -y target.m4r
|
|
@ -1,10 +0,0 @@
|
|||
{% if site.data.content.announcement %}
|
||||
<div class='announcements-list'>
|
||||
<div class='announcements-item item -hide' data-js-dismissable='{"id":"{{ site.data.content.announcement.id }}"}'>
|
||||
<h3 class='title'>{{ site.data.content.announcement.title }}</h3>
|
||||
<div class='body'>{{ site.data.content.announcement.body | markdownify }}</div>
|
||||
<button data-js-dismiss class='close'></button>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<script type='application/ld+json'>
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "NewsArticle",
|
||||
"mainEntityOfPage": {
|
||||
"@type": "WebPage",
|
||||
"@id": "https://google.com/article"
|
||||
},
|
||||
"headline": {{ meta_title | jsonify }},
|
||||
"image": [ {{ meta_image | jsonify }} ],
|
||||
"description": {{ meta_description | jsonify }}
|
||||
}
|
||||
</script>
|
||||
<script type='application/ld+json'>
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "BreadcrumbList",
|
||||
"itemListElement": [{
|
||||
"@type": "ListItem",
|
||||
"position": 1,
|
||||
"item": {
|
||||
"@id": "{{ site.url }}/#{{ page.category | downcase | replace: ' ', '-' }}",
|
||||
"name": "{{ page.category }}"
|
||||
}
|
||||
},{
|
||||
"@type": "ListItem",
|
||||
"position": 2,
|
||||
"item": {
|
||||
"@id": {{ page_url | jsonify }},
|
||||
"name": {{ page.title | jsonify }}
|
||||
}
|
||||
}]
|
||||
}
|
||||
</script>
|
|
@ -1,22 +0,0 @@
|
|||
{% assign identifier = include.page.url | remove: '.html' | remove_first: '/' %}
|
||||
{% if site.data.disqus.enabled %}
|
||||
<section class='comments-area' id='comments' data-js-no-preview>
|
||||
<div class='container'>
|
||||
<details class='comments-details'>
|
||||
<summary>
|
||||
<strong class='count'>
|
||||
<span class='disqus-comment-count' data-disqus-identifier="{{ identifier }}" data-disqus-url='{{ site.url }}/{{ identifier }}'>0 Comments</span>
|
||||
</strong>
|
||||
<span class='suffix'>{{ site.data.content.comments_area.suffix }}</span>
|
||||
<span class='fauxlink'>{{ site.data.content.comments_area.link }}</span>
|
||||
</summary>
|
||||
<div class='comments-section'>
|
||||
<div class='comments'>
|
||||
<div id='disqus_thread'></div>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
<noscript data-js-disqus='{"host":"{{ site.data.disqus.host }}","url":"{{ site.url }}/{{ identifier }}","identifier":"{{ identifier }}"}'></noscript>
|
||||
</section>
|
||||
{% endif %}
|
|
@ -1,3 +0,0 @@
|
|||
<script>{% include 2017/critical/critical.js %}</script>
|
||||
<script src='{{base}}/assets/packed/app.js?t={{ timestamp }}'></script>
|
||||
{% for lang in page.prism_languages %}<script src='https://cdn.jsdelivr.net/npm/prismjs@1.6.0/components/prism-{{lang}}.min.js'></script>{% endfor %}
|
|
@ -1,24 +0,0 @@
|
|||
{% include meta.html %}
|
||||
{% include polyfills.html %}
|
||||
|
||||
<!-- critical css -->
|
||||
{% if include.critical == 'home'
|
||||
%}<style id='critical-css'>{% include 2017/critical/critical-home.css %}</style>{%
|
||||
endif
|
||||
%}{%
|
||||
if include.critical == 'sheet'
|
||||
%}<style id='critical-css'>{% include 2017/critical/critical-sheet.css %}</style>{%
|
||||
endif %}
|
||||
|
||||
<!-- allow disabling critical CSS optimization by passing ?nocrit=1 -->
|
||||
<script id='critical-css-disable'>if (~window.location.search.indexOf('nocrit')){;[].slice.call(document.querySelectorAll('#critical-css')).map(function(e){e.parentNode.removeChild(e)})}</script>
|
||||
|
||||
<!-- deferred css -->
|
||||
<script id='deferred-css'>;(function(links){(requestAnimationFrame||mozRequestAnimationFrame||webkitRequestAnimationFrame||msRequestAnimationFrame||(function(fn){window.addEventListener('load',fn)}))(function(){var h=document.getElementsByTagName('head')[0],l,i;for (i=0;i<links.length;i++){l=document.createElement('link');l.rel='stylesheet';l.href=links[i];h.appendChild(l);}})})([
|
||||
'https://fonts.googleapis.com/css?family=Cousine',
|
||||
'{{base}}/assets/2017/style.css?t={{ timestamp }}'
|
||||
])</script>
|
||||
<noscript id='deferred-css-fallback'>
|
||||
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Cousine'>
|
||||
<link rel='stylesheet' href='{{base}}/assets/2017/style.css?t={{ timestamp }}'>
|
||||
</noscript>
|
|
@ -1,7 +0,0 @@
|
|||
<div class='HeadlinePub' role='complementary'>
|
||||
<script async src='{{ site.data.carbon.src }}' id="_carbonads_js"></script>
|
||||
<span class='placeholder -one'></span>
|
||||
<span class='placeholder -two'></span>
|
||||
<span class='placeholder -three'></span>
|
||||
<span class='placeholder -four'></span>
|
||||
</div>
|
|
@ -1,41 +0,0 @@
|
|||
{% comment %}
|
||||
|
||||
This partial assigns these variables:
|
||||
|
||||
meta_image: "https://assets.devhints.io/previews/react.jpg"
|
||||
meta_description: "A comprehensive cheatsheet for React."
|
||||
meta_title: "React cheatsheet"
|
||||
depth: "1"
|
||||
base: "./"
|
||||
timestamp: "293048189123"
|
||||
page_url: "https://devhints.io/react"
|
||||
|
||||
It emits some blank lines because Jekyll, lol.
|
||||
|
||||
{% endcomment %}
|
||||
|
||||
{% assign depth = page.url | split: '/' | size | minus: 1 %}
|
||||
|
||||
{% assign base = '' %}
|
||||
{% if depth <= 1 %}{% assign base = '.' %}
|
||||
{% elsif depth == 2 %}{% assign base = '..' %}
|
||||
{% elsif depth == 3 %}{% assign base = '../..' %}
|
||||
{% elsif depth == 4 %}{% assign base = '../../..' %}{% endif %}
|
||||
|
||||
{% assign timestamp = site.time | date: "%Y%m%d%H%M%S" %}
|
||||
|
||||
{% if site.data.assets.preview_host %}{% capture meta_image %}{%
|
||||
if page.url == '/'
|
||||
%}{{ site.data.assets.preview_host }}/index.jpg?t={{ timestamp }}{%
|
||||
else
|
||||
%}{{ site.data.assets.preview_host }}{{ include.page.url | remove: '.html' }}.jpg?t={{ timestamp }}{%
|
||||
endif
|
||||
%}{% endcapture %}{% endif %}
|
||||
|
||||
{% capture meta_title %}{% include values/title.html page=include.page %}{% endcapture %}
|
||||
{% assign meta_title = meta_title | strip_newlines %}
|
||||
|
||||
{% capture meta_description %}{% include values/description.html page=include.page %}{% endcapture %}
|
||||
{% assign meta_description = meta_description | strip_newlines %}
|
||||
|
||||
{% capture page_url %}{{ site.url }}{{ page.url | remove: '.html' }}{% endcapture %}
|
|
@ -1,14 +0,0 @@
|
|||
{% assign slug = include.page.url | remove: '.html' | remove_first: '/' %}
|
||||
<a class='{{ include.class }} -item-{{ slug }}'
|
||||
href="{{base}}{{ include.page.url | remove: '.html' }}"
|
||||
data-js-searchable-item='{"slug":"{{ slug }}","category":"{{ include.page.category }}"}'>
|
||||
<span class='info'>
|
||||
<code class='slug'>{{ slug }}</code>
|
||||
|
||||
{% if include.page.layout == '2017/sheet' %}
|
||||
<abbr class='attribute-peg -new-layout hint--bottom' data-hint='New layout!'><span></span></abbr>
|
||||
{% endif %}
|
||||
|
||||
<span class='title'>{{ include.page.title }} {{ include.page.redirect_to }}</span>
|
||||
</span>
|
||||
</a>
|
|
@ -1,12 +0,0 @@
|
|||
<li class='{{ include.class }}'>
|
||||
<a href='{{ base }}{{ include.page.url | remove: '.html' }}'>
|
||||
<strong>{{ include.page.title }}</strong>
|
||||
<span>
|
||||
cheatsheet
|
||||
|
||||
{% if include.page.layout == '2017/sheet' %}
|
||||
<abbr class='attribute-peg -new-layout hint--bottom' data-hint='New layout!'><span></span></abbr>
|
||||
{% endif %}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
|
@ -1,62 +0,0 @@
|
|||
{% assign category_pages = site.pages
|
||||
| where: "category", include.page.category
|
||||
| where_exp: "page", "page.url != include.page.url"
|
||||
| where_exp: "page", "page.deprecated != true"
|
||||
| where_exp: "page", "page.redirect_to == null"
|
||||
| sort: "weight", "last"
|
||||
%}
|
||||
{% assign top_pages = site.pages
|
||||
| where_exp: "page", "page.url != include.page.url"
|
||||
| where_exp: "page", "page.deprecated != true"
|
||||
| sort: "weight", "last"
|
||||
%}
|
||||
{% assign size = site.pages | size %}
|
||||
<footer class='related-posts-area' id='related' data-js-no-preview>
|
||||
<div class='container'>
|
||||
<div class='related-posts-section'>
|
||||
<div class='callout'>
|
||||
<a class='related-posts-callout' href='{{ base }}'>
|
||||
<div class='text'>
|
||||
<i class='icon'></i>
|
||||
|
||||
<span class='description'>
|
||||
{{ site.data.content.related_posts_callout.description | replace: "SIZE", size }}
|
||||
</span>
|
||||
|
||||
<span class='push-button -dark'>
|
||||
{{ site.data.content.related_posts_callout.link }}
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class='group'>
|
||||
<div class='related-posts-group'>
|
||||
{% if include.page.category == 'Others' %}
|
||||
<h3>{{ site.data.content.related_posts_group.other }}</h3>
|
||||
{% else %}
|
||||
<h3>{{ site.data.content.related_posts_group.category | replace: "CATEGORY", include.page.category }}</h3>
|
||||
{% endif %}
|
||||
|
||||
<ul class='related-post-list'>
|
||||
{% for page in category_pages limit: 6 %}
|
||||
{% include 2017/related-posts-item.html page=page class='item related-post-item' %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='group'>
|
||||
<div class='related-posts-group'>
|
||||
<h3>{{ site.data.content.related_posts_group.top }}</h3>
|
||||
|
||||
<ul class='related-post-list'>
|
||||
{% for page in top_pages limit: 6 %}
|
||||
{% include 2017/related-posts-item.html page=page class='item related-post-item' %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
|
@ -1,12 +0,0 @@
|
|||
<footer class='search-footer' data-js-no-preview>
|
||||
<div class='container'>
|
||||
<div class='search-footer-section'>
|
||||
<div class='search'>
|
||||
{% include 2017/search-form.html class="-small" %}
|
||||
</div>
|
||||
<div class='links'>
|
||||
<a class='home-button' href='{{ base }}'><i></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
|
@ -1,19 +0,0 @@
|
|||
<form
|
||||
{% if include.live %}data-js-search-form{% endif %}
|
||||
class='search' action='{{ base }}' method='get'>
|
||||
<label class='search-box {{ include.class }}'>
|
||||
<span class='prefix'>{{ site.data.content.search_form.prefix }}</span>
|
||||
<span class='sep'>/</span>
|
||||
<input name='q'
|
||||
type='text'
|
||||
{% if include.live %}
|
||||
{% assign placeholder = site.data.content.search_form.home_placeholder | replace: "%{size}", size %}
|
||||
autofocus data-js-search-input
|
||||
placeholder='{{ placeholder }}'
|
||||
{% else %}
|
||||
{% assign size = site.pages | size %}
|
||||
{% assign placeholder = site.data.content.search_form.default_placeholder | replace: "SIZE", size %}
|
||||
placeholder='{{ placeholder }}'
|
||||
{% endif %}>
|
||||
</label>
|
||||
</form>
|
|
@ -1,35 +0,0 @@
|
|||
{% comment %}
|
||||
Params:
|
||||
- noshare
|
||||
- noedit
|
||||
- noback
|
||||
{% endcomment %}
|
||||
<nav class='top-nav' data-js-no-preview role='navigation'>
|
||||
<div class='container'>
|
||||
{% unless include.noback %}
|
||||
<div class='left'>
|
||||
<a class='home back-button' href='{{base}}'></a>
|
||||
</div>
|
||||
{% endunless %}
|
||||
|
||||
<a class='brand' href='{{base}}'>
|
||||
{{ site.data.content.top_nav.title }}
|
||||
</a>
|
||||
|
||||
{% unless include.noshare %}
|
||||
<div class='actions'>
|
||||
{% include social-list.html class="social page-actions" page=include.page %}
|
||||
|
||||
{% unless include.noedit %}
|
||||
<ul class='page-actions'>
|
||||
<li class='link github -button hint--bottom' data-hint='{{ site.data.content.top_nav.edit_on_github }}'>
|
||||
<a href='{{ site.github.repository_url }}/blob/master/{{ page.path | remove: '.html' }}'>
|
||||
<span class='text -visible'>{{ site.data.content.top_nav.edit }}</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endunless %}
|
||||
</div>
|
||||
{% endunless %}
|
||||
</div>
|
||||
</nav>
|
|
@ -1,20 +0,0 @@
|
|||
<div class="about-the-site">
|
||||
<div class="container">
|
||||
<p class='blurb'>
|
||||
<strong><a href="{{ base }}">{{ site.title }}</a></strong> is a collection of cheatsheets I've written over the years.
|
||||
Suggestions and corrections? <a href='https://github.com/rstacruz/cheatsheets/issues/907'>Send them in</a>.
|
||||
<i class='fleuron'></i>
|
||||
I'm <a href="http://ricostacruz.com">Rico Sta. Cruz</a>.
|
||||
Check out my <a href="http://ricostacruz.com/posts">Today I learned blog</a> for more.
|
||||
</p>
|
||||
|
||||
{% if page.url != '/index.html' %}
|
||||
<p class='back'>
|
||||
<a class='big-button -back -slim' href='.#toc'></a>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
|
@ -1,14 +0,0 @@
|
|||
{% include about-the-site.html %}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/highlight.min.js"></script>
|
||||
|
||||
{% comment %}<!-- https://github.com/highlightjs/cdn-release/tree/master/build/languages -->{% endcomment %}
|
||||
{% for lang in page.hljs_languages %}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/languages/{{lang}}.min.js"></script>
|
||||
{% endfor %}
|
||||
|
||||
<script src="https://cdn.rawgit.com/rstacruz/unorphan/v1.0.1/index.js"></script>
|
||||
<script>hljs.initHighlightingOnLoad()</script>
|
||||
<script>unorphan('h1, h2, h3, p, li, .unorphan')</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,12 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang='en' class='no-js {{ page.html_class }}'>
|
||||
<head>
|
||||
{% include meta.html %}
|
||||
{% include polyfills.html %}
|
||||
<style>html{opacity:0}</style>
|
||||
<link rel="stylesheet" href="{{base}}/assets/2015/style.css?t={{ timestamp }}">
|
||||
<link href="{{base}}/assets/style.css?t={{ timestamp }}" rel="stylesheet" />
|
||||
<link href="{{base}}/assets/print.css?t={{ timestamp }}" rel="stylesheet" media="print" />
|
||||
</head>
|
||||
<body>
|
||||
<div class='all'>
|
|
@ -1,85 +0,0 @@
|
|||
{% include 2017/meta-vars.html page=page %}
|
||||
<meta charset='utf-8'>
|
||||
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
|
||||
<link href='{{ base }}/assets/favicon.png' rel='shortcut icon'>
|
||||
<meta content='{{ page.url | escape }}' name='app:pageurl'>
|
||||
|
||||
{% if meta_title %}
|
||||
<title>{{ meta_title | escape }}</title>
|
||||
<meta content='{{ meta_title | escape }}' property='og:title'>
|
||||
<meta content='{{ meta_title | escape }}' property='twitter:title'>
|
||||
<meta content='{{ page.og_type | default: "article" | escape }}' property='og:type'>
|
||||
{% endif %}
|
||||
|
||||
{% if meta_image %}
|
||||
<meta content='{{ meta_image | escape }}' property='og:image'>
|
||||
<meta content='{{ meta_image | escape }}' property='twitter:image'>
|
||||
<meta content='900' property='og:image:width'>
|
||||
<meta content='471' property='og:image:height'>
|
||||
{% endif %}
|
||||
|
||||
{% if meta_description %}
|
||||
<meta content="{{ meta_description | escape }}" name="description">
|
||||
<meta content="{{ meta_description | escape }}" property="og:description">
|
||||
<meta content="{{ meta_description | escape }}" property="twitter:description">
|
||||
{% endif %}
|
||||
|
||||
<link rel="canonical" href="{{ page_url | escape }}">
|
||||
<meta name="og:url" content="{{ page_url | escape }}">
|
||||
{% if page.url == '/' %}
|
||||
<link rel="prefetch" href="{{ site.url | escape }}">
|
||||
<link rel="prerender" href="{{ site.url | escape }}">
|
||||
{% endif %}
|
||||
|
||||
{% if page.author %}
|
||||
{% for author in site.authors | where: "name", page.author %}
|
||||
<meta content='{{ author.name }}' name='author'>
|
||||
{% if author.ogp %}
|
||||
<meta content='{{ author.ogp }}' property='article:author'>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if site.title %}
|
||||
<meta content='{{ site.title | escape }}' property='og:site_name'>
|
||||
{% endif %}
|
||||
|
||||
{% if site.facebook.app_id %}
|
||||
<meta content='{{ site.facebook.app_id | escape }}' property='fb:app_id'>
|
||||
{% endif %}
|
||||
|
||||
{% if site.facebook.admin %}
|
||||
<meta content='{{ site.facebook.admin | escape }}' property='fb:admins'>
|
||||
{% endif %}
|
||||
|
||||
{% if page.date %}
|
||||
<meta content='{{ page.date | date: "%Y-%m-%d" }}' property='article:published_date'>
|
||||
{% endif %}
|
||||
|
||||
{% if page.category %}
|
||||
<meta content='{{ page.category | escape }}' property='article:section'>
|
||||
{% endif %}
|
||||
|
||||
{% if page.tags %}
|
||||
{% for tag in page.tags %}
|
||||
<meta content='{{ tag | escape }}' property='article:tag'>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if site.data.google_analytics.enabled %}
|
||||
<script async src='https://www.googletagmanager.com/gtag/js?id={{ site.data.google_analytics.id }}'></script>
|
||||
<script>
|
||||
{% comment %} if(~location.hostname.indexOf('{{site.data.google_analytics.hostname}}')){ {% endcomment %}
|
||||
window.dataLayer=window.dataLayer||[];
|
||||
function gtag(){dataLayer.push(arguments)};
|
||||
gtag('js',new Date());
|
||||
gtag('config','{{ site.data.google_analytics.id }}');
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% if depth %}
|
||||
<meta property='page:depth' content='{{depth}}'>
|
||||
{% endif %}
|
||||
|
||||
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
|
||||
<script>(function(H){H.className=H.className.replace(/\bNoJs\b/,'WithJs')})(document.documentElement)</script>
|
|
@ -1,9 +0,0 @@
|
|||
<script>(function(d,s){if(window.Promise&&[].includes&&Object.assign&&window.Map)return;var js,sc=d.getElementsByTagName(s)[0];js=d.createElement(s);js.src='https://cdn.polyfill.io/v2/polyfill.min.js';sc.parentNode.insertBefore(js, sc);}(document,'script'))</script>
|
||||
|
||||
<!--[if lt IE 9]>{%comment%}
|
||||
{%endcomment%}<script src='https://cdnjs.cloudflare.com/ajax/libs/nwmatcher/1.2.5/nwmatcher.min.js'></script>{%comment%}
|
||||
{%endcomment%}<script src='https://cdnjs.cloudflare.com/ajax/libs/json2/20140204/json2.js'></script>{%comment%}
|
||||
{%endcomment%}<script src='https://cdn.rawgit.com/gisu/selectivizr/1.0.3/selectivizr.js'></script>{%comment%}
|
||||
{%endcomment%}<script src='https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js'></script>{%comment%}
|
||||
{%endcomment%}<script src='https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js'></script>{%comment%}
|
||||
{%endcomment%}<![endif]-->
|
|
@ -1,6 +0,0 @@
|
|||
<div class='site-header'>
|
||||
<div class='container'>
|
||||
This is <a href="."><em>{{ site.title }}</em></a> — a collection of cheatsheets I've written.
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
{% if include.page.type == 'home' %}
|
||||
{% assign description = site.data.content.social_list.default_description %}
|
||||
{% else %}
|
||||
{% assign description = site.data.content.social_list.description | replace: "TITLE", include.page.title %}
|
||||
{% endif %}
|
||||
<ul class="social-list {{ include.class }}">
|
||||
<li class="facebook link hint--bottom" data-hint="{{ site.data.content.social_list.facebook_share }}"><a href="https://www.facebook.com/sharer/sharer.php?u={{ site.url | uri_escape }}{{ include.page.url | uri_escape }}" target="share"><span class="text"></span></a></li>
|
||||
<li class="twitter link hint--bottom" data-hint="{{ site.data.content.social_list.twitter_share }}"><a href="https://twitter.com/intent/tweet?text={{ description | uri_escape }}%20{{ site.url | uri_escape }}{{ include.page.url | uri_escape }}" target="share"><span class="text"></span></a></li>
|
||||
{% comment %}
|
||||
<li class="googleplus link hint--bottom" data-hint="Share on Google Plus"><a href="https://plus.google.com/share?url={{ site.url }}{{ include.page.url }}" target="share"><span class="text">+1</span></a></li>-->
|
||||
{% endcomment %}
|
||||
</ul>
|
|
@ -1,17 +0,0 @@
|
|||
{%
|
||||
if page.description and page.intro
|
||||
%}{{ page.description }} {{ page.intro | markdownify | strip_html }}{%
|
||||
elsif page.description
|
||||
%}{{ page.description }} · One-page guide to {{ page.title }}{%
|
||||
elsif page.keywords and page.intro
|
||||
%}{{ page.keywords | join: ' · ' }} · {{ page.intro | markdownify | strip_html }}{%
|
||||
elsif page.keywords
|
||||
%}{{ page.keywords | join: ' · ' }} · One-page guide to {{ page.title }}{%
|
||||
elsif page.intro
|
||||
%}One-page guide to {{ page.title }}: usage, examples, and more. {{ page.intro | markdownify | strip_html }}{%
|
||||
elsif page.type == 'article'
|
||||
%}The one-page guide to {{ page.title }}: usage, examples, links, snippets, and more.{%
|
||||
else
|
||||
%}The one-page guide to {{ page.title }}: usage, examples, links, snippets, and more.{%
|
||||
endif
|
||||
%}
|
|
@ -1,11 +0,0 @@
|
|||
{%
|
||||
if page.full_title
|
||||
%}{{ page.full_title }}{%
|
||||
elsif page.type == 'article'
|
||||
%}{{ page.title }} cheatsheet{%
|
||||
elsif page.title
|
||||
%}{{ page.title }}{%
|
||||
else
|
||||
%}{{ site.title }}{%
|
||||
endif
|
||||
%}
|
|
@ -1,78 +0,0 @@
|
|||
<!doctype html>
|
||||
<html class='NoJs' lang='en'><head>
|
||||
|
||||
{% assign featured_pages = site.pages
|
||||
| where_exp: "page", "page.tags contains 'Featured'"
|
||||
%}
|
||||
{% assign recent_pages = site.pages
|
||||
| where_exp: "page", "page.updated"
|
||||
| sort: "updated", "first"
|
||||
%}
|
||||
{% include 2017/head.html critical='home' %}
|
||||
|
||||
</head><body class='UseCompactHeader HighlightPubFirstLine'>
|
||||
|
||||
{% include 2017/top-nav.html page=page is_home=true noedit=true noback=true %}
|
||||
|
||||
<div class='body-area -slim'>
|
||||
<div class='site-header' role='banner'>
|
||||
<h1>
|
||||
{{ site.data.content.home.title }}
|
||||
</h1>
|
||||
<p>
|
||||
{{ site.data.content.home.tagline }}
|
||||
</p>
|
||||
|
||||
{% include 2017/search-form.html live=true %}
|
||||
|
||||
{% if site.data.carbon.enabled %}
|
||||
<div class='pubbox'>
|
||||
{% include 2017/headline-pub.html %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class='pages-list' role='main'>
|
||||
{% for page in featured_pages %}
|
||||
{% include 2017/pages-list-item.html page=page class='item top-sheet' %}
|
||||
{% endfor %}
|
||||
|
||||
<h2 class='category item' data-js-searchable-header>
|
||||
<span>Recently updated</span>
|
||||
</h2>
|
||||
|
||||
{% for page in recent_pages reversed %}
|
||||
{% if forloop.index <= 18 %}
|
||||
{% include 2017/pages-list-item.html page=page class='article item' %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% for category in site.data.categories.names %}
|
||||
<h2 class='category item' id='{{ category | downcase | replace: " ", "-" }}' data-js-searchable-header>
|
||||
<span>{{ category }}</span>
|
||||
</h2>
|
||||
|
||||
{% for page in site.pages %}
|
||||
{% if page.category == category %}
|
||||
{% if page.title %}
|
||||
{% include 2017/pages-list-item.html page=page class='article item' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
<div class='message item missing-message'>
|
||||
<h3>See something missing?</h3>
|
||||
<p>
|
||||
<a class='push-button' href='{{ site.github.repository_url }}/issues/907'>Request cheatsheet</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include 2017/announcements-list.html %}
|
||||
|
||||
{% include 2017/foot.html %}
|
||||
</body>
|
||||
</html>
|
|
@ -1,26 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang='en'><head>
|
||||
|
||||
{% include 2017/head.html %}
|
||||
|
||||
</head><body>
|
||||
|
||||
{% include 2017/top-nav.html page=page noshare=true %}
|
||||
|
||||
<div class='body-area -slim'>
|
||||
<div class='site-header'>
|
||||
<h1>{{ site.data.content.not_found.title }}</h1>
|
||||
<p>{{ site.data.content.not_found.description }}</p>
|
||||
|
||||
{% include 2017/search-form.html %}
|
||||
|
||||
<p class='action'>
|
||||
<a class='push-button' href='./'>{{ site.data.content.not_found.home }}</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include 2017/foot.html %}
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,54 +0,0 @@
|
|||
<!doctype html>
|
||||
<html class='NoJs' lang='en'><head>
|
||||
|
||||
{% include 2017/head.html critical='sheet' %}
|
||||
{% include 2017/article-schema.html page=page %}
|
||||
|
||||
</head><body class='UseCompactHeader HighlightPubFirstLine'>
|
||||
|
||||
{% include 2017/top-nav.html page=page %}
|
||||
|
||||
<div class='body-area'>
|
||||
<header class='main-heading -center' role='banner'>
|
||||
<h1 class='h1'>{{ page.title }} <em>{{ site.data.content.sheet.suffix }}</em></h1>
|
||||
|
||||
<div class='pubbox' data-js-no-preview>
|
||||
{% if site.data.carbon.enabled %}
|
||||
{% include 2017/headline-pub.html %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{% if page.tags contains 'WIP' %}
|
||||
<aside class='notice-box'>
|
||||
This page is a work in progress. You can help by <a href='{{ site.github.repository_url }}/blob/master/{{ page.path | remove: '.html' }}'>suggesting edits</a>!
|
||||
</aside>
|
||||
{% endif %}
|
||||
|
||||
{% if page.deprecated_by %}
|
||||
<aside class='notice-box'>
|
||||
<strong>Deprecated:</strong> This guide covers an older version.
|
||||
<a href='{{ base }}{{ page.deprecated_by }}'>A newer version is available here.</a>
|
||||
</aside>
|
||||
{% endif %}
|
||||
|
||||
{% if page.intro %}
|
||||
<div class='intro-content MarkdownBody'>
|
||||
{{ page.intro | markdownify }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<main class='post-content MarkdownBody' data-js-main-body data-js-anchors role='main'>
|
||||
{{ content }}
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div class='pre-footer' data-js-no-preview><i class='icon'></i></div>
|
||||
|
||||
{% include 2017/comments-area.html page=page %}
|
||||
{% include 2017/search-footer.html %}
|
||||
{% include 2017/related-posts.html page=page %}
|
||||
{% include 2017/foot.html %}
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1 +0,0 @@
|
|||
{{content}}
|
|
@ -1,30 +0,0 @@
|
|||
---
|
||||
type: article
|
||||
---
|
||||
{% include head.html %}
|
||||
{% include site-header.html %}
|
||||
|
||||
<div class='post-list -single -cheatsheet'>
|
||||
<div class='post-item'>
|
||||
{% include social-list.html page=page class="-collapse" %}
|
||||
|
||||
<div class='post-headline -cheatsheet'>
|
||||
<p class='prelude'><span></span></p>
|
||||
<h1><span>{{ page.title }}</span></h1>
|
||||
</div>
|
||||
|
||||
{% if site.data.carbon.enabled %}
|
||||
<div class='headline-pub'>
|
||||
<script async src='{{ site.data.carbon.src }}' id="_carbonads_js"></script>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class='post-content -cheatsheet'>
|
||||
{{ content }}
|
||||
</div>
|
||||
|
||||
{% include social-list.html page=page %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include foot.html %}
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
type: article
|
||||
---
|
||||
{% include head.html %}
|
||||
{% include site-header.html %}
|
||||
|
||||
{% include 2017/article-schema.html page=page %}
|
||||
|
||||
<div class='post-list -single -cheatsheet'>
|
||||
<div class='post-item'>
|
||||
<div class='post-headline -cheatsheet'>
|
||||
<p class='prelude'><span></span></p>
|
||||
<h1><span>{{ page.title }}</span></h1>
|
||||
|
||||
<div class='pubbox'>
|
||||
{% include 2017/headline-pub.html %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='post-content -cheatsheet'>
|
||||
{{ content }}
|
||||
</div>
|
||||
|
||||
{% include social-list.html page=page %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include foot.html %}
|
|
@ -1,30 +0,0 @@
|
|||
---
|
||||
html_class: home
|
||||
type: home
|
||||
---
|
||||
{% include head.html %}
|
||||
{% include site-header.html %}
|
||||
|
||||
{% for category in site.data.categories.names %}
|
||||
<div class='pages-header'>
|
||||
<h2 id='{{ category | downcase | replace: " ", "-" }}'>{{ category }}</h2>
|
||||
</div>
|
||||
<div class='pages-list'>
|
||||
{% for page in site.pages %}
|
||||
{% if page.category == category %}
|
||||
<a href="{{base}}{{ page.url }}">
|
||||
<span class='title'>{{ page.title }}</span>
|
||||
<span class='date'>{{ page.url | remove: '.html' | remove: '/' }}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% if site.data.carbon.enabled %}
|
||||
<div class='side-ad'>
|
||||
<script async src='{{ site.data.carbon.src }}' id="_carbonads_js"></script>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% include foot.html %}
|
|
@ -1,11 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
{% assign target = page.redirect.to | remove: '.html' | replace: 'cheatsheets/cheatsheets', 'cheatsheets' %}
|
||||
<html lang="en-US">
|
||||
<meta charset="utf-8">
|
||||
<title>Redirecting…</title>
|
||||
<link rel="canonical" href="{{ target }}">
|
||||
<meta http-equiv="refresh" content="0; url={{ target }}">
|
||||
<h1>Redirecting...</h1>
|
||||
<a href="{{ target }}">Click here if you are not redirected.</a>
|
||||
<script>location="{{ target }}"</script>
|
||||
</html>
|
|
@ -1,3 +0,0 @@
|
|||
// Base
|
||||
@import '../_sass/2017/base/base.scss';
|
||||
@import '../_sass/2017/base/fade.scss';
|
|
@ -1,30 +0,0 @@
|
|||
// Prismjs
|
||||
import 'prismjs'
|
||||
import 'prismjs/plugins/line-highlight/prism-line-highlight.min.js'
|
||||
import 'prismjs/components/prism-jsx.min.js'
|
||||
import 'prismjs/components/prism-bash.min.js'
|
||||
import 'prismjs/components/prism-scss.min.js'
|
||||
import 'prismjs/components/prism-css.min.js'
|
||||
import 'prismjs/components/prism-elixir.min.js'
|
||||
import 'prismjs/components/prism-ruby.min.js'
|
||||
|
||||
// Initializers
|
||||
import './initializers/prism'
|
||||
import './initializers/onmount'
|
||||
|
||||
// Behaviors
|
||||
import './behaviors/anchors'
|
||||
import './behaviors/dismissable'
|
||||
import './behaviors/dismiss'
|
||||
import './behaviors/disqus'
|
||||
import './behaviors/h3-section-list'
|
||||
import './behaviors/main-body'
|
||||
import './behaviors/no-preview'
|
||||
import './behaviors/searchable-header'
|
||||
import './behaviors/searchable-item'
|
||||
import './behaviors/search-form'
|
||||
import './behaviors/search-input'
|
||||
|
||||
// CSS
|
||||
import 'prismjs/plugins/line-highlight/prism-line-highlight.css'
|
||||
import 'hint.css/hint.min.css'
|
|
@ -1,46 +0,0 @@
|
|||
import onmount from 'onmount'
|
||||
import prepend from 'dom101/prepend'
|
||||
|
||||
const DEFAULTS = {
|
||||
// select elements to put anchor on
|
||||
rule: 'h2[id]',
|
||||
// class name for anchor
|
||||
className: 'local-anchor anchor',
|
||||
// text of anchor
|
||||
text: '#',
|
||||
// append before or after innerText?
|
||||
shouldAppend: false
|
||||
}
|
||||
|
||||
/*
|
||||
* Behavior: Add local anchors
|
||||
*/
|
||||
|
||||
onmount('[data-js-anchors]', function () {
|
||||
const data = JSON.parse(this.getAttribute('data-js-anchors') || '{}')
|
||||
const rules = Array.isArray(data)
|
||||
? data.length
|
||||
? data
|
||||
: [DEFAULTS]
|
||||
: [Object.assign({}, DEFAULTS, data)]
|
||||
|
||||
for (const { rule, className, text, shouldAppend } of rules) {
|
||||
for (const el of this.querySelectorAll(rule)) {
|
||||
if (!el.hasAttribute('id')) {
|
||||
continue
|
||||
}
|
||||
|
||||
const id = el.getAttribute('id')
|
||||
const anchor = document.createElement('a')
|
||||
anchor.setAttribute('href', `#${id}`)
|
||||
anchor.setAttribute('class', className)
|
||||
anchor.innerText = String(text || DEFAULTS.text)
|
||||
|
||||
if (shouldAppend) {
|
||||
el.appendChild(anchor)
|
||||
} else {
|
||||
prepend(el, anchor)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
|
@ -1,22 +0,0 @@
|
|||
import closest from 'dom101/closest'
|
||||
import remove from 'dom101/remove'
|
||||
import on from 'dom101/on'
|
||||
import { getData } from '../helpers/data'
|
||||
import onmount from 'onmount'
|
||||
import * as Dismiss from '../helpers/dismiss'
|
||||
|
||||
/**
|
||||
* Dismiss button
|
||||
*/
|
||||
|
||||
onmount('[data-js-dismiss]', function () {
|
||||
const parent = closest(this, '[data-js-dismissable]')
|
||||
const dismissable = getData(parent, 'js-dismissable')
|
||||
const id = (dismissable && dismissable.id) || ''
|
||||
|
||||
on(this, 'click', (e) => {
|
||||
Dismiss.setDismissed(id)
|
||||
e.preventDefault()
|
||||
if (parent) remove(parent)
|
||||
})
|
||||
})
|
|
@ -1,17 +0,0 @@
|
|||
import onmount from 'onmount'
|
||||
import remove from 'dom101/remove'
|
||||
import removeClass from 'dom101/remove-class'
|
||||
|
||||
import { getData } from '../helpers/data'
|
||||
import { isDismissed } from '../helpers/dismiss'
|
||||
import { isPreview } from '../helpers/preview'
|
||||
|
||||
onmount('[data-js-dismissable]', function () {
|
||||
const id = getData(this, 'js-dismissable').id || ''
|
||||
|
||||
if (isPreview() || isDismissed(id)) {
|
||||
remove(this)
|
||||
} else {
|
||||
removeClass(this, '-hide')
|
||||
}
|
||||
})
|
|
@ -1,32 +0,0 @@
|
|||
import onmount from 'onmount'
|
||||
import injectDisqus from '../helpers/inject_disqus'
|
||||
|
||||
/**
|
||||
* Delay disqus by some time. It's at the bottom of the page, there's no need
|
||||
* for it to load fast. This will give more time to load more critical assets.
|
||||
*/
|
||||
|
||||
const DISQUS_DELAY = 100
|
||||
|
||||
/**
|
||||
* Injects Disqus onto the page.
|
||||
*/
|
||||
|
||||
onmount('[data-js-disqus]', function () {
|
||||
const data = JSON.parse(this.getAttribute('data-js-disqus'))
|
||||
const $parent = this.parentNode
|
||||
$parent.setAttribute('hidden', true)
|
||||
|
||||
window.disqus_config = function () {
|
||||
this.page.url = data.url
|
||||
this.page.identifier = data.identifier
|
||||
}
|
||||
|
||||
// Disqus takes a while to load, don't do it so eagerly.
|
||||
window.addEventListener('load', () => {
|
||||
setTimeout(() => {
|
||||
injectDisqus(data.host)
|
||||
$parent.removeAttribute('hidden')
|
||||
}, DISQUS_DELAY)
|
||||
})
|
||||
})
|
|
@ -1,32 +0,0 @@
|
|||
/* eslint-disable no-new */
|
||||
|
||||
import Isotope from 'isotope-layout'
|
||||
import onmount from 'onmount'
|
||||
import on from 'dom101/on'
|
||||
import qsa from 'dom101/query-selector-all'
|
||||
|
||||
/*
|
||||
* Behavior: Isotope
|
||||
*/
|
||||
|
||||
onmount('[data-js-h3-section-list]', function () {
|
||||
const iso = new Isotope(this, {
|
||||
itemSelector: '.h3-section',
|
||||
transitionDuration: 0
|
||||
})
|
||||
|
||||
const images = qsa('img', this)
|
||||
|
||||
images.forEach((image) => {
|
||||
on(image, 'load', () => {
|
||||
iso.layout()
|
||||
})
|
||||
})
|
||||
|
||||
// Insurance against weirdness on pages like devhints.io/vim, where the
|
||||
// critical path CSS may look different from the final CSS (because of the
|
||||
// tables).
|
||||
on(window, 'load', () => {
|
||||
iso.layout()
|
||||
})
|
||||
})
|
|
@ -1,16 +0,0 @@
|
|||
import remove from 'dom101/remove'
|
||||
import onmount from 'onmount'
|
||||
import addClass from 'dom101/add-class'
|
||||
|
||||
import { isPreview } from '../helpers/preview'
|
||||
|
||||
/*
|
||||
* Behavior: Things to remove when preview mode is on
|
||||
*/
|
||||
|
||||
onmount('[data-js-no-preview]', function (b) {
|
||||
if (isPreview()) {
|
||||
remove(this)
|
||||
addClass(document.documentElement, 'PreviewMode')
|
||||
}
|
||||
})
|
|
@ -1,17 +0,0 @@
|
|||
import onmount from 'onmount'
|
||||
import on from 'dom101/on'
|
||||
|
||||
/**
|
||||
* Submitting the search form
|
||||
*/
|
||||
|
||||
onmount('[data-js-search-form]', function () {
|
||||
on(this, 'submit', (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
const link = document.querySelector('a[data-search-index]:not([hidden])')
|
||||
const href = link && link.getAttribute('href')
|
||||
|
||||
if (href) window.location = href
|
||||
})
|
||||
})
|
|
@ -1,24 +0,0 @@
|
|||
import onmount from 'onmount'
|
||||
import * as Search from '../helpers/search'
|
||||
import qs from '../helpers/qs'
|
||||
import on from 'dom101/on'
|
||||
|
||||
onmount('[data-js-search-input]', function () {
|
||||
on(this, 'input', () => {
|
||||
const val = this.value
|
||||
|
||||
if (val === '') {
|
||||
Search.showAll()
|
||||
} else {
|
||||
Search.show(val)
|
||||
}
|
||||
})
|
||||
|
||||
const query = (qs(window.location.search) || {}).q
|
||||
if (query && query.length) {
|
||||
this.value = query
|
||||
setTimeout(() => {
|
||||
Search.show(query)
|
||||
})
|
||||
}
|
||||
})
|
|
@ -1,23 +0,0 @@
|
|||
import onmount from 'onmount'
|
||||
import { nextUntil } from '../helpers/dom'
|
||||
import matches from 'dom101/matches'
|
||||
|
||||
// Ensure that search-index is set first
|
||||
import './searchable-item'
|
||||
|
||||
/**
|
||||
* Propagate item search indices to headers
|
||||
*/
|
||||
|
||||
onmount('[data-js-searchable-header]', function () {
|
||||
const els = nextUntil(this, '[data-js-searchable-header]').filter((el) =>
|
||||
matches(el, '[data-search-index]')
|
||||
)
|
||||
|
||||
const keywords = els
|
||||
.map((n) => n.getAttribute('data-search-index'))
|
||||
.join(' ')
|
||||
.split(' ')
|
||||
|
||||
this.setAttribute('data-search-index', keywords.join(' '))
|
||||
})
|
|
@ -1,13 +0,0 @@
|
|||
import onmount from 'onmount'
|
||||
import permutate from '../helpers/permutate'
|
||||
|
||||
/**
|
||||
* Sets search indices (`data-search-index` attribute)
|
||||
*/
|
||||
|
||||
onmount('[data-js-searchable-item]', function () {
|
||||
const data = JSON.parse(this.getAttribute('data-js-searchable-item') || '{}')
|
||||
const words = permutate(data)
|
||||
|
||||
this.setAttribute('data-search-index', words.join(' '))
|
||||
})
|
|
@ -1,2 +0,0 @@
|
|||
import 'sanitize.css'
|
||||
import './critical-home.scss'
|
|
@ -1,16 +0,0 @@
|
|||
@import './_utils.scss';
|
||||
@import './_base.scss';
|
||||
|
||||
// Components
|
||||
@import '../_sass/2017/components/attribute-peg.scss';
|
||||
@import '../_sass/2017/components/announcements-item.scss';
|
||||
@import '../_sass/2017/components/announcements-list.scss';
|
||||
@import '../_sass/2017/components/back-button.scss';
|
||||
@import '../_sass/2017/components/body-area.scss';
|
||||
@import '../_sass/2017/components/headline-pub.scss';
|
||||
@import '../_sass/2017/components/page-actions.scss';
|
||||
@import '../_sass/2017/components/pages-list.scss';
|
||||
@import '../_sass/2017/components/search-box.scss';
|
||||
@import '../_sass/2017/components/site-header.scss';
|
||||
@import '../_sass/2017/components/top-nav.scss';
|
||||
@import '../_sass/2017/components/top-sheet.scss';
|
|
@ -1,2 +0,0 @@
|
|||
import 'sanitize.css'
|
||||
import './critical-sheet.scss'
|
|
@ -1,21 +0,0 @@
|
|||
@import './_utils.scss';
|
||||
@import './_base.scss';
|
||||
|
||||
// Markdown
|
||||
@import '../_sass/2017/markdown/a-em.scss';
|
||||
@import '../_sass/2017/markdown/code.scss';
|
||||
@import '../_sass/2017/markdown/headings.scss';
|
||||
@import '../_sass/2017/markdown/local-anchor.scss';
|
||||
@import '../_sass/2017/markdown/p.scss';
|
||||
@import '../_sass/2017/markdown/table.scss';
|
||||
@import '../_sass/2017/markdown/ul.scss';
|
||||
|
||||
// Components
|
||||
@import '../_sass/2017/components/back-button.scss';
|
||||
@import '../_sass/2017/components/body-area.scss';
|
||||
@import '../_sass/2017/components/h3-section.scss';
|
||||
@import '../_sass/2017/components/h3-section-list.scss';
|
||||
@import '../_sass/2017/components/headline-pub.scss';
|
||||
@import '../_sass/2017/components/main-heading.scss';
|
||||
@import '../_sass/2017/components/page-actions.scss';
|
||||
@import '../_sass/2017/components/top-nav.scss';
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* This is the "critical path" JavaScript that will be included INLINE on every
|
||||
* page. Keep this as small as possible!
|
||||
*/
|
||||
|
||||
import wrapify from './wrapify'
|
||||
import addClass from 'dom101/add-class'
|
||||
import on from 'dom101/on'
|
||||
|
||||
// Transform the main body markup to make it readable.
|
||||
const body = document.querySelector('[data-js-main-body]')
|
||||
|
||||
if (body) {
|
||||
wrapify(body)
|
||||
addClass(body, '-wrapified')
|
||||
}
|
||||
|
||||
// Be "done" when we're done, or after a certain timeout.
|
||||
on(window, 'load', done)
|
||||
setTimeout(done, 5000)
|
||||
|
||||
let isDone
|
||||
function done() {
|
||||
if (isDone) return
|
||||
addClass(document.documentElement, 'LoadDone')
|
||||
isDone = true
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
import matches from 'dom101/matches'
|
||||
|
||||
/*
|
||||
* Just like jQuery.append
|
||||
*/
|
||||
|
||||
export function appendMany(el, children) {
|
||||
children.forEach((child) => {
|
||||
el.appendChild(child)
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
* Just like jQuery.nextUntil
|
||||
*/
|
||||
|
||||
export function nextUntil(el, selector) {
|
||||
const nextEl = el.nextSibling
|
||||
return nextUntilTick(nextEl, selector, [])
|
||||
}
|
||||
|
||||
function nextUntilTick(el, selector, acc) {
|
||||
if (!el) return acc
|
||||
|
||||
const isMatch = matches(el, selector)
|
||||
if (isMatch) return acc
|
||||
|
||||
return nextUntilTick(el.nextSibling, selector, [...acc, el])
|
||||
}
|
||||
|
||||
/*
|
||||
* Just like jQuery.before
|
||||
*/
|
||||
|
||||
export function before(reference, newNode) {
|
||||
reference.parentNode.insertBefore(newNode, reference)
|
||||
}
|
||||
|
||||
/*
|
||||
* Like jQuery.children('selector')
|
||||
*/
|
||||
|
||||
export function findChildren(el, selector) {
|
||||
return [].slice.call(el.children).filter((child) => matches(child, selector))
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a div
|
||||
* @private
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* createDiv({ class: 'foo' })
|
||||
*/
|
||||
|
||||
export function createDiv(props) {
|
||||
const d = document.createElement('div')
|
||||
Object.keys(props).forEach((key) => {
|
||||
d.setAttribute(key, props[key])
|
||||
})
|
||||
return d
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
/* blank */
|
|
@ -1,72 +0,0 @@
|
|||
/**
|
||||
* Permutates a searcheable item.
|
||||
*
|
||||
* permutate({
|
||||
* slug: 'hello-world',
|
||||
* category: 'greetings'
|
||||
* })
|
||||
*/
|
||||
|
||||
export default function permutate(data) {
|
||||
let words = []
|
||||
if (data.slug) {
|
||||
words = words.concat(permutateString(data.slug))
|
||||
}
|
||||
if (data.category) {
|
||||
words = words.concat(permutateString(data.category))
|
||||
}
|
||||
return words
|
||||
}
|
||||
|
||||
/**
|
||||
* Permutates strings.
|
||||
*
|
||||
* @example
|
||||
* permutateString('hi joe')
|
||||
* => ['h', 'hi', 'j', 'jo', 'joe']
|
||||
*/
|
||||
|
||||
export function permutateString(str) {
|
||||
let words = []
|
||||
let inputs = splitwords(str)
|
||||
|
||||
inputs.forEach((word) => {
|
||||
words = words.concat(permutateWord(word))
|
||||
})
|
||||
|
||||
return words
|
||||
}
|
||||
|
||||
/**
|
||||
* Permutates a word.
|
||||
*
|
||||
* @example
|
||||
* permutateWord('hello')
|
||||
* => ['h', 'he', 'hel', 'hell', 'hello']
|
||||
*/
|
||||
|
||||
export function permutateWord(str) {
|
||||
let words = []
|
||||
const len = str.length
|
||||
for (var i = 1; i <= len; ++i) {
|
||||
words.push(str.substr(0, i))
|
||||
}
|
||||
return words
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for splitting to words.
|
||||
*
|
||||
* @example
|
||||
* splitWords('Hello, world!')
|
||||
* => ['hello', 'world']
|
||||
*/
|
||||
|
||||
export function splitwords(str) {
|
||||
const words = str
|
||||
.toLowerCase()
|
||||
.split(/[ /\-_]/)
|
||||
.filter((k) => k && k.length !== 0)
|
||||
|
||||
return words
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
import { splitwords } from './permutate'
|
||||
import qsa from 'dom101/query-selector-all'
|
||||
|
||||
/**
|
||||
* Show everything.
|
||||
*
|
||||
* @example
|
||||
* Search.showAll()
|
||||
*/
|
||||
|
||||
export function showAll() {
|
||||
qsa('[data-search-index]').forEach((el) => {
|
||||
el.removeAttribute('hidden')
|
||||
el.style.removeProperty('display')
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for a given keyword.
|
||||
*
|
||||
* @example
|
||||
* Search.show('hello')
|
||||
*/
|
||||
|
||||
export function show(val) {
|
||||
const keywords = splitwords(val)
|
||||
|
||||
if (!keywords.length) return showAll()
|
||||
|
||||
const selectors = keywords
|
||||
.map((k) => `[data-search-index~=${JSON.stringify(k)}]`)
|
||||
.join('')
|
||||
|
||||
qsa('[data-search-index]').forEach((el) => {
|
||||
el.setAttribute('hidden', true)
|
||||
el.style.setProperty('display', "none")
|
||||
})
|
||||
|
||||
qsa(selectors).forEach((el) => {
|
||||
el.removeAttribute('hidden')
|
||||
el.style.removeProperty('display')
|
||||
})
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue