stupid prismjs

This commit is contained in:
Xetera
2019-07-26 14:37:31 -07:00
parent 6982552205
commit 36f4e41e16
16 changed files with 2234 additions and 646 deletions
+3
View File
@@ -5,3 +5,6 @@
*/ */
// You can delete this file if you're not using it // You can delete this file if you're not using it
require("prismjs/themes/prism.css");
require("prismjs/themes/prism-tomorrow.css");
require("prismjs/plugins/line-numbers/prism-line-numbers.css");
+23 -3
View File
@@ -1,11 +1,23 @@
module.exports = { module.exports = {
siteMetadata: { siteMetadata: {
title: `Gatsby Default Starter`, title: `The Programmers Hangout`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`, description: `A cozy community of programmers on Discord`,
author: `@gatsbyjs`, author: `TPH Community`,
}, },
plugins: [ plugins: [
`gatsby-plugin-react-helmet`, `gatsby-plugin-react-helmet`,
`gatsby-plugin-typescript`,
{
resolve: `gatsby-transformer-remark`,
plugins: [
{
resolve: `gatsby-remark-prismjs`,
options: {
classPrefix: ""
}
}
],
},
{ {
resolve: `gatsby-source-filesystem`, resolve: `gatsby-source-filesystem`,
options: { options: {
@@ -13,8 +25,16 @@ module.exports = {
path: `${__dirname}/src/images`, path: `${__dirname}/src/images`,
}, },
}, },
{
resolve: `gatsby-source-filesystem`,
options: {
name: `docs`,
path: `${__dirname}/src/content/docs`,
},
},
`gatsby-transformer-sharp`, `gatsby-transformer-sharp`,
`gatsby-plugin-sharp`, `gatsby-plugin-sharp`,
`gatsby-plugin-sass`,
{ {
resolve: `gatsby-plugin-manifest`, resolve: `gatsby-plugin-manifest`,
options: { options: {
+61 -6
View File
@@ -1,7 +1,62 @@
/** const { graphql } = require('gatsby');
* Implement Gatsby's Node APIs in this file. const { createFilePath } = require("gatsby-source-filesystem");
* const path = require(`path`)
* See: https://www.gatsbyjs.org/docs/node-apis/
*/
// You can delete this file if you're not using it const usersEndpoint = (id) => `https://discordapp.com/api/guilds/${id}/members`;
const fetchUsers = () => {
// Fetch user data from discord using bot token here
}
const createDocs = async ({ createPage, graphql }) => {
const languageDocs = path.resolve(`src/templates/languagePost.tsx`)
const result = await graphql(`
{
allFile(filter: {sourceInstanceName: {eq: "docs"}}) {
edges {
node {
relativePath
childMarkdownRemark {
frontmatter {
author
date
}
}
}
}
}
}
`);
if (result.errors) {
return Promise.reject(result.errors)
}
return result.data.allFile.edges.forEach(({ node }) => {
createPage({
path: path.join('docs', node.relativePath),
component: languageDocs,
context: {
file: node.relativePath
},
})
})
}
exports.onCreateNode = async ({ node, getNode, actions }) => {
const { createPage, createNodeField } = actions;
if (node.internal.type === "MarkdownRemark") {
const slug = createFilePath({ node, getNode, basePath: "src/content/docs" })
createNodeField({
node,
name: "slug",
value: slug
});
}
}
exports.createPages = ({ actions, graphql }) => {
const { createPage } = actions
return createDocs({ createPage, graphql });
}
+1393
View File
File diff suppressed because it is too large Load Diff
+9 -1
View File
@@ -3,16 +3,24 @@
"private": true, "private": true,
"description": "A simple starter to get up and developing quickly with Gatsby", "description": "A simple starter to get up and developing quickly with Gatsby",
"version": "0.1.0", "version": "0.1.0",
"author": "Xetera", "author": "TPH",
"dependencies": { "dependencies": {
"axios": "^0.19.0",
"gatsby": "^2.13.39", "gatsby": "^2.13.39",
"gatsby-image": "^2.2.6", "gatsby-image": "^2.2.6",
"gatsby-plugin-manifest": "^2.2.4", "gatsby-plugin-manifest": "^2.2.4",
"gatsby-plugin-offline": "^2.2.4", "gatsby-plugin-offline": "^2.2.4",
"gatsby-plugin-react-helmet": "^3.1.2", "gatsby-plugin-react-helmet": "^3.1.2",
"gatsby-plugin-sass": "^2.1.3",
"gatsby-plugin-sharp": "^2.2.9", "gatsby-plugin-sharp": "^2.2.9",
"gatsby-plugin-typescript": "^2.1.2",
"gatsby-remark-prismjs": "^3.3.3",
"gatsby-source-filesystem": "^2.1.6", "gatsby-source-filesystem": "^2.1.6",
"gatsby-transformer-remark": "^2.6.9",
"gatsby-transformer-sharp": "^2.2.4", "gatsby-transformer-sharp": "^2.2.4",
"highlight.js": "^9.15.8",
"node-sass": "^4.12.0",
"prismjs": "^1.17.1",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"react": "^16.8.6", "react": "^16.8.6",
"react-dom": "^16.8.6", "react-dom": "^16.8.6",
+19 -13
View File
@@ -1,11 +1,12 @@
import { Link } from "gatsby" import { Link } from "gatsby"
import PropTypes from "prop-types" import PropTypes from "prop-types"
import React from "react" import React from "react"
import icon from "./icon.png"
const Header = ({ siteTitle }) => ( const Header = ({ siteTitle }) => (
<header <header
style={{ style={{
background: `rebeccapurple`, background: `#ba1a2e`,
marginBottom: `1.45rem`, marginBottom: `1.45rem`,
}} }}
> >
@@ -16,19 +17,24 @@ const Header = ({ siteTitle }) => (
padding: `1.45rem 1.0875rem`, padding: `1.45rem 1.0875rem`,
}} }}
> >
<h1 style={{ margin: 0 }}> <div style={{ display: "flex", flexDirection: "row", alignItems: "center" }}>
<Link <img src={icon} style={{ width: "70px" }} />
to="/" <h1 style={{ margin: 0 }}>
style={{ <Link
color: `white`, to="/"
textDecoration: `none`, style={{
}} paddingLeft: 25,
> color: `white`,
{siteTitle} textDecoration: `none`,
</Link> }}
</h1> >
{siteTitle}
</Link>
</h1>
</div>
</div> </div>
</header>
</header >
) )
Header.propTypes = { Header.propTypes = {
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

-622
View File
@@ -1,622 +0,0 @@
html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
menu,
nav,
section,
summary {
display: block;
}
audio,
canvas,
progress,
video {
display: inline-block;
}
audio:not([controls]) {
display: none;
height: 0;
}
progress {
vertical-align: baseline;
}
[hidden],
template {
display: none;
}
a {
background-color: transparent;
-webkit-text-decoration-skip: objects;
}
a:active,
a:hover {
outline-width: 0;
}
abbr[title] {
border-bottom: none;
text-decoration: underline;
text-decoration: underline dotted;
}
b,
strong {
font-weight: inherit;
font-weight: bolder;
}
dfn {
font-style: italic;
}
h1 {
font-size: 2em;
margin: 0.67em 0;
}
mark {
background-color: #ff0;
color: #000;
}
small {
font-size: 80%;
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
img {
border-style: none;
}
svg:not(:root) {
overflow: hidden;
}
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
figure {
margin: 1em 40px;
}
hr {
box-sizing: content-box;
height: 0;
overflow: visible;
}
button,
input,
optgroup,
select,
textarea {
font: inherit;
margin: 0;
}
optgroup {
font-weight: 700;
}
button,
input {
overflow: visible;
}
button,
select {
text-transform: none;
}
[type="reset"],
[type="submit"],
button,
html [type="button"] {
-webkit-appearance: button;
}
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner,
button::-moz-focus-inner {
border-style: none;
padding: 0;
}
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring,
button:-moz-focusring {
outline: 1px dotted ButtonText;
}
fieldset {
border: 1px solid silver;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
legend {
box-sizing: border-box;
color: inherit;
display: table;
max-width: 100%;
padding: 0;
white-space: normal;
}
textarea {
overflow: auto;
}
[type="checkbox"],
[type="radio"] {
box-sizing: border-box;
padding: 0;
}
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
[type="search"] {
-webkit-appearance: textfield;
outline-offset: -2px;
}
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-input-placeholder {
color: inherit;
opacity: 0.54;
}
::-webkit-file-upload-button {
-webkit-appearance: button;
font: inherit;
}
html {
font: 112.5%/1.45em georgia, serif;
box-sizing: border-box;
overflow-y: scroll;
}
* {
box-sizing: inherit;
}
*:before {
box-sizing: inherit;
}
*:after {
box-sizing: inherit;
}
body {
color: hsla(0, 0%, 0%, 0.8);
font-family: georgia, serif;
font-weight: normal;
word-wrap: break-word;
font-kerning: normal;
-moz-font-feature-settings: "kern", "liga", "clig", "calt";
-ms-font-feature-settings: "kern", "liga", "clig", "calt";
-webkit-font-feature-settings: "kern", "liga", "clig", "calt";
font-feature-settings: "kern", "liga", "clig", "calt";
}
img {
max-width: 100%;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
}
h1 {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
color: inherit;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-weight: bold;
text-rendering: optimizeLegibility;
font-size: 2.25rem;
line-height: 1.1;
}
h2 {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
color: inherit;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-weight: bold;
text-rendering: optimizeLegibility;
font-size: 1.62671rem;
line-height: 1.1;
}
h3 {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
color: inherit;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-weight: bold;
text-rendering: optimizeLegibility;
font-size: 1.38316rem;
line-height: 1.1;
}
h4 {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
color: inherit;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-weight: bold;
text-rendering: optimizeLegibility;
font-size: 1rem;
line-height: 1.1;
}
h5 {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
color: inherit;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-weight: bold;
text-rendering: optimizeLegibility;
font-size: 0.85028rem;
line-height: 1.1;
}
h6 {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
color: inherit;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-weight: bold;
text-rendering: optimizeLegibility;
font-size: 0.78405rem;
line-height: 1.1;
}
hgroup {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
}
ul {
margin-left: 1.45rem;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
list-style-position: outside;
list-style-image: none;
}
ol {
margin-left: 1.45rem;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
list-style-position: outside;
list-style-image: none;
}
dl {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
}
dd {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
}
p {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
}
figure {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
}
pre {
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin-bottom: 1.45rem;
font-size: 0.85rem;
line-height: 1.42;
background: hsla(0, 0%, 0%, 0.04);
border-radius: 3px;
overflow: auto;
word-wrap: normal;
padding: 1.45rem;
}
table {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
font-size: 1rem;
line-height: 1.45rem;
border-collapse: collapse;
width: 100%;
}
fieldset {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
}
blockquote {
margin-left: 1.45rem;
margin-right: 1.45rem;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
}
form {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
}
noscript {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
}
iframe {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
}
hr {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: calc(1.45rem - 1px);
background: hsla(0, 0%, 0%, 0.2);
border: none;
height: 1px;
}
address {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
}
b {
font-weight: bold;
}
strong {
font-weight: bold;
}
dt {
font-weight: bold;
}
th {
font-weight: bold;
}
li {
margin-bottom: calc(1.45rem / 2);
}
ol li {
padding-left: 0;
}
ul li {
padding-left: 0;
}
li > ol {
margin-left: 1.45rem;
margin-bottom: calc(1.45rem / 2);
margin-top: calc(1.45rem / 2);
}
li > ul {
margin-left: 1.45rem;
margin-bottom: calc(1.45rem / 2);
margin-top: calc(1.45rem / 2);
}
blockquote *:last-child {
margin-bottom: 0;
}
li *:last-child {
margin-bottom: 0;
}
p *:last-child {
margin-bottom: 0;
}
li > p {
margin-bottom: calc(1.45rem / 2);
}
code {
font-size: 0.85rem;
line-height: 1.45rem;
}
kbd {
font-size: 0.85rem;
line-height: 1.45rem;
}
samp {
font-size: 0.85rem;
line-height: 1.45rem;
}
abbr {
border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5);
cursor: help;
}
acronym {
border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5);
cursor: help;
}
abbr[title] {
border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5);
cursor: help;
text-decoration: none;
}
thead {
text-align: left;
}
td,
th {
text-align: left;
border-bottom: 1px solid hsla(0, 0%, 0%, 0.12);
font-feature-settings: "tnum";
-moz-font-feature-settings: "tnum";
-ms-font-feature-settings: "tnum";
-webkit-font-feature-settings: "tnum";
padding-left: 0.96667rem;
padding-right: 0.96667rem;
padding-top: 0.725rem;
padding-bottom: calc(0.725rem - 1px);
}
th:first-child,
td:first-child {
padding-left: 0;
}
th:last-child,
td:last-child {
padding-right: 0;
}
tt,
code {
background-color: hsla(0, 0%, 0%, 0.04);
border-radius: 3px;
font-family: "SFMono-Regular", Consolas, "Roboto Mono", "Droid Sans Mono",
"Liberation Mono", Menlo, Courier, monospace;
padding: 0;
padding-top: 0.2em;
padding-bottom: 0.2em;
}
pre code {
background: none;
line-height: 1.42;
}
code:before,
code:after,
tt:before,
tt:after {
letter-spacing: -0.2em;
content: " ";
}
pre code:before,
pre code:after,
pre tt:before,
pre tt:after {
content: "";
}
@media only screen and (max-width: 480px) {
html {
font-size: 100%;
}
}
+2 -1
View File
@@ -10,7 +10,8 @@ import PropTypes from "prop-types"
import { useStaticQuery, graphql } from "gatsby" import { useStaticQuery, graphql } from "gatsby"
import Header from "./header" import Header from "./header"
import "./layout.css" import "./layout.scss"
// import "prismjs/plugins/line-numbers/prism-line-numbers.css";
const Layout = ({ children }) => { const Layout = ({ children }) => {
const data = useStaticQuery(graphql` const data = useStaticQuery(graphql`
+610
View File
@@ -0,0 +1,610 @@
// @import "~prismjs/themes/prism-tomorrow.css";
html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/**
* If you already use line highlighting
*/
/* Adjust the position of the line numbers */
.gatsby-highlight pre[class*="language-"].line-numbers {
padding-left: 2.8em;
}
/**
* If you only want to use line numbering
*/
.gatsby-highlight {
background-color: #fdf6e3;
border-radius: 0.3em;
margin: 0.5em 0;
padding: 1em;
overflow: auto;
}
.gatsby-highlight pre[class*="language-"].line-numbers {
padding: 0;
padding-left: 2.8em;
overflow: initial;
}
// article,
// aside,
// details,
// figcaption,
// figure,
// footer,
// header,
// main,
// menu,
// nav,
// section,
// summary {
// display: block;
// }
// audio,
// canvas,
// progress,
// video {
// display: inline-block;
// }
// audio:not([controls]) {
// display: none;
// height: 0;
// }
// progress {
// vertical-align: baseline;
// }
// [hidden],
// template {
// display: none;
// }
// a {
// background-color: transparent;
// -webkit-text-decoration-skip: objects;
// }
// a:active,
// a:hover {
// outline-width: 0;
// }
// abbr[title] {
// border-bottom: none;
// text-decoration: underline;
// text-decoration: underline dotted;
// }
// b,
// strong {
// font-weight: inherit;
// font-weight: bolder;
// }
// dfn {
// font-style: italic;
// }
// h1 {
// font-size: 2em;
// margin: 0.67em 0;
// }
// mark {
// background-color: #ff0;
// color: #000;
// }
// small {
// font-size: 80%;
// }
// sub,
// sup {
// font-size: 75%;
// line-height: 0;
// position: relative;
// vertical-align: baseline;
// }
// sub {
// bottom: -0.25em;
// }
// sup {
// top: -0.5em;
// }
// img {
// border-style: none;
// }
// svg:not(:root) {
// overflow: hidden;
// }
// code,
// kbd,
// samp {
// font-family: monospace, monospace;
// font-size: 1em;
// }
// figure {
// margin: 1em 40px;
// }
// hr {
// box-sizing: content-box;
// height: 0;
// overflow: visible;
// }
// button,
// input,
// optgroup,
// select,
// textarea {
// font: inherit;
// margin: 0;
// }
// optgroup {
// font-weight: 700;
// }
// button,
// input {
// overflow: visible;
// }
// button,
// select {
// text-transform: none;
// }
// [type="reset"],
// [type="submit"],
// button,
// html [type="button"] {
// -webkit-appearance: button;
// }
// [type="button"]::-moz-focus-inner,
// [type="reset"]::-moz-focus-inner,
// [type="submit"]::-moz-focus-inner,
// button::-moz-focus-inner {
// border-style: none;
// padding: 0;
// }
// [type="button"]:-moz-focusring,
// [type="reset"]:-moz-focusring,
// [type="submit"]:-moz-focusring,
// button:-moz-focusring {
// outline: 1px dotted ButtonText;
// }
// fieldset {
// border: 1px solid silver;
// margin: 0 2px;
// padding: 0.35em 0.625em 0.75em;
// }
// legend {
// box-sizing: border-box;
// color: inherit;
// display: table;
// max-width: 100%;
// padding: 0;
// white-space: normal;
// }
// textarea {
// overflow: auto;
// }
// [type="checkbox"],
// [type="radio"] {
// box-sizing: border-box;
// padding: 0;
// }
// [type="number"]::-webkit-inner-spin-button,
// [type="number"]::-webkit-outer-spin-button {
// height: auto;
// }
// [type="search"] {
// -webkit-appearance: textfield;
// outline-offset: -2px;
// }
// [type="search"]::-webkit-search-cancel-button,
// [type="search"]::-webkit-search-decoration {
// -webkit-appearance: none;
// }
// ::-webkit-input-placeholder {
// color: inherit;
// opacity: 0.54;
// }
// ::-webkit-file-upload-button {
// -webkit-appearance: button;
// font: inherit;
// }
// html {
// font: 112.5%/1.45em georgia, serif;
// box-sizing: border-box;
// overflow-y: scroll;
// }
// * {
// box-sizing: inherit;
// }
// *:before {
// box-sizing: inherit;
// }
// *:after {
// box-sizing: inherit;
// }
// body {
// color: hsla(0, 0%, 0%, 0.8);
// font-family: georgia, serif;
// font-weight: normal;
// word-wrap: break-word;
// font-kerning: normal;
// -moz-font-feature-settings: "kern", "liga", "clig", "calt";
// -ms-font-feature-settings: "kern", "liga", "clig", "calt";
// -webkit-font-feature-settings: "kern", "liga", "clig", "calt";
// font-feature-settings: "kern", "liga", "clig", "calt";
// }
// img {
// max-width: 100%;
// margin-left: 0;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// }
h1 {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
color: inherit;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-weight: bold;
text-rendering: optimizeLegibility;
font-size: 2.25rem;
line-height: 1.1;
}
h2 {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
color: inherit;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-weight: bold;
text-rendering: optimizeLegibility;
font-size: 1.62671rem;
line-height: 1.1;
}
h3 {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
color: inherit;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-weight: bold;
text-rendering: optimizeLegibility;
font-size: 1.38316rem;
line-height: 1.1;
}
h4 {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
color: inherit;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-weight: bold;
text-rendering: optimizeLegibility;
font-size: 1rem;
line-height: 1.1;
}
h5 {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
color: inherit;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-weight: bold;
text-rendering: optimizeLegibility;
font-size: 0.85028rem;
line-height: 1.1;
}
h6 {
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
margin-bottom: 1.45rem;
color: inherit;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-weight: bold;
text-rendering: optimizeLegibility;
font-size: 0.78405rem;
line-height: 1.1;
}
// hgroup {
// margin-left: 0;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// }
// ul {
// margin-left: 1.45rem;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// list-style-position: outside;
// list-style-image: none;
// }
// ol {
// margin-left: 1.45rem;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// list-style-position: outside;
// list-style-image: none;
// }
// dl {
// margin-left: 0;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// }
// dd {
// margin-left: 0;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// }
// p {
// margin-left: 0;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// }
// figure {
// margin-left: 0;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// }
// table {
// margin-left: 0;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// font-size: 1rem;
// line-height: 1.45rem;
// border-collapse: collapse;
// width: 100%;
// }
// fieldset {
// margin-left: 0;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// }
// blockquote {
// margin-left: 1.45rem;
// margin-right: 1.45rem;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// }
// form {
// margin-left: 0;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// }
// noscript {
// margin-left: 0;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// }
// iframe {
// margin-left: 0;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// }
// hr {
// margin-left: 0;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: calc(1.45rem - 1px);
// background: hsla(0, 0%, 0%, 0.2);
// border: none;
// height: 1px;
// }
// address {
// margin-left: 0;
// margin-right: 0;
// margin-top: 0;
// padding-bottom: 0;
// padding-left: 0;
// padding-right: 0;
// padding-top: 0;
// margin-bottom: 1.45rem;
// }
// b {
// font-weight: bold;
// }
// strong {
// font-weight: bold;
// }
// dt {
// font-weight: bold;
// }
// th {
// font-weight: bold;
// }
// li {
// margin-bottom: calc(1.45rem / 2);
// }
// ol li {
// padding-left: 0;
// }
// ul li {
// padding-left: 0;
// }
// li > ol {
// margin-left: 1.45rem;
// margin-bottom: calc(1.45rem / 2);
// margin-top: calc(1.45rem / 2);
// }
// li > ul {
// margin-left: 1.45rem;
// margin-bottom: calc(1.45rem / 2);
// margin-top: calc(1.45rem / 2);
// }
// blockquote *:last-child {
// margin-bottom: 0;
// }
// li *:last-child {
// margin-bottom: 0;
// }
// p *:last-child {
// margin-bottom: 0;
// }
// li > p {
// margin-bottom: calc(1.45rem / 2);
// }
// code {
// font-size: 0.85rem;
// line-height: 1.45rem;
// }
// kbd {
// font-size: 0.85rem;
// line-height: 1.45rem;
// }
// samp {
// font-size: 0.85rem;
// line-height: 1.45rem;
// }
// abbr {
// border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5);
// cursor: help;
// }
// acronym {
// border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5);
// cursor: help;
// }
// abbr[title] {
// border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5);
// cursor: help;
// text-decoration: none;
// }
// thead {
// text-align: left;
// }
// td,
// th {
// text-align: left;
// border-bottom: 1px solid hsla(0, 0%, 0%, 0.12);
// font-feature-settings: "tnum";
// -moz-font-feature-settings: "tnum";
// -ms-font-feature-settings: "tnum";
// -webkit-font-feature-settings: "tnum";
// padding-left: 0.96667rem;
// padding-right: 0.96667rem;
// padding-top: 0.725rem;
// padding-bottom: calc(0.725rem - 1px);
// }
// th:first-child,
// td:first-child {
// padding-left: 0;
// }
// th:last-child,
// td:last-child {
// padding-right: 0;
// }
// @media only screen and (max-width: 480px) {
// html {
// font-size: 100%;
// }
// }
@@ -0,0 +1,71 @@
---
author: "@Xetera"
date: "2019/07/26"
---
# Simplifying Promises
-- placeholder --
The first naive attempt, using new Promise for something that already returns a promise.
```javascript
function doAsync(number) {
return new Promise(function(resolve, reject) {
doDatabase().then(function(dbResult) {
otherDbFunction(dbResult).then(function(secondResult) {
resolve(secondResult + 10);
})
});
})
}
```
Turns out you don't need new Promise if you're working with a function that
already returns a promise, you can just return the original thing.
```js
function doAsync(number) {
return doDatabase().then(function(dbResult) {
otherDbFunction(dbResult).then(function(secondResult) {
return secondResult + 10;
})
});
}
```
You also don't have to nest `.then` functions, the whole point of promises
is that they allow you do chain them sequentially.
```js
function doAsync(number) {
return doDatabase().then(function(dbResult) {
return otherDbFunction(dbResult)
}).then(function(secondResult) {
return secondResult + 10;
});
}
```
you also don't have to create a new function just to pass in one
variable, you can pass in the entire function itself to the then block
```js
function doAsync(number) {
return doDatabase()
.then(otherDbFunction)
.then(function(secondResult) {
return secondResult + 10;
});
}
```
And you don't need those returns if you just have ES6 arrow functions
```js
const doAsync = number => doDatabase()
.then(otherDbFunction)
.then(secondResult => secondResult + 10);
```
Wow, that last one looks a lot cleaner to me than the first. Keeping that in mind, maybe we could be making some of our other functions cleaner as well
+13
View File
@@ -0,0 +1,13 @@
---
author: "@Xetera"
date: 2019/06/26
---
# Python
This is a placeholder post
```py
def test():
return "Hello world"
```
+1
View File
@@ -0,0 +1 @@
# Hello
+29
View File
@@ -0,0 +1,29 @@
import * as React from "react";
import { graphql } from "gatsby";
import Layout from "../components/layout";
const LanguagePost = ({ data }) => {
const { html } = data.file.post;
console.log(data)
return (
<Layout>
<div dangerouslySetInnerHTML={{ __html: html }} />
</Layout >
)
}
export default LanguagePost;
export const query = graphql`
query LanguagePost($file: String!) {
file(relativePath: {eq: $file }) {
post: childMarkdownRemark {
html
frontmatter {
author
date
}
}
}
}
`