Initial commit
|
|
@ -0,0 +1,19 @@
|
||||||
|
module.exports = {
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es6": true,
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"react",
|
||||||
|
],
|
||||||
|
"globals": {
|
||||||
|
"graphql": false,
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module",
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"experimentalObjectRestSpread": true,
|
||||||
|
"jsx": true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Typescript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
|
||||||
|
# gatsby files
|
||||||
|
.cache/
|
||||||
|
public
|
||||||
|
|
||||||
|
# Mac files
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Yarn
|
||||||
|
yarn-error.log
|
||||||
|
.pnp/
|
||||||
|
.pnp.js
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
.idea/
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,674 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
{one line to give the program's name and a brief idea of what it does.}
|
||||||
|
Copyright (C) {year} {name of author}
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
{project} Copyright (C) {year} {fullname}
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
<h1 align="center">
|
||||||
|
Flexible Gatsby
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
[](https://app.netlify.com/sites/flexible-gatsby/deploys)
|
||||||
|
|
||||||
|
A simple minimalist Gatsby starter for your blog. [Demo](https://flexible-gatsby.netlify.com/).
|
||||||
|
|
||||||
|
Inspired by [flexible-jekyll](https://github.com/artemsheludko/flexible-jekyll).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Quick Start 🚀
|
||||||
|
|
||||||
|
1. **Create a Gatsby site.**
|
||||||
|
|
||||||
|
Use the Gatsby CLI to create a new site, specifying the default starter.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# create a new Gatsby site using the-plain-gatsby starter
|
||||||
|
gatsby new my-blog https://github.com/wangonya/flexible-gatsby
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Start developing.**
|
||||||
|
|
||||||
|
Navigate into your new site’s directory and start it up.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd my-blog/
|
||||||
|
gatsby develop
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Open the source code and start editing!**
|
||||||
|
|
||||||
|
Your site is now running at `http://localhost:8000`!
|
||||||
|
|
||||||
|
_Note: You'll also see a second link: _`http://localhost:8000/___graphql`_. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the [Gatsby tutorial](https://www.gatsbyjs.org/tutorial/part-five/#introducing-graphiql)._
|
||||||
|
|
||||||
|
Edit `gatsby.config.js` to update site metadata.
|
||||||
|
|
||||||
|
Add blog posts in markdown in `content/blog`. Example blog posts have been provided.
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
Much thanks to these contributors for making this project awesome:
|
||||||
|
|
||||||
|
- [@scottelundgren](https://github.com/scottelundgren)
|
||||||
|
- [@sparky005](https://github.com/sparky005)
|
||||||
|
- [@wozniaklukasz](https://github.com/wozniaklukasz)
|
||||||
|
After Width: | Height: | Size: 21 KiB |
|
|
@ -0,0 +1,213 @@
|
||||||
|
---
|
||||||
|
title: POJ 2456 Aggressive Cow
|
||||||
|
date: 2020-04-03 12:43:00 +0800
|
||||||
|
tags:
|
||||||
|
- 二分搜索
|
||||||
|
img: ./software.jpg
|
||||||
|
---
|
||||||
|
|
||||||
|
## **题目信息**
|
||||||
|
|
||||||
|
作者:不详
|
||||||
|
链接:[http://poj.org/problem?id=2456](https://link.zhihu.com/?target=http%3A//poj.org/problem%3Fid%3D2456)
|
||||||
|
来源:PKU JudgeOnline
|
||||||
|
|
||||||
|
### **Aggressive cows**[[1\]](https://zhuanlan.zhihu.com/p/120450034#ref_1)
|
||||||
|
|
||||||
|
Time Limit: 1000MS
|
||||||
|
Memory Limit: 65536K
|
||||||
|
|
||||||
|
**描述**
|
||||||
|
|
||||||
|
Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (0 <= xi <= 1,000,000,000).
|
||||||
|
His C (2 <= C <= N) cows don't like this barn layout and become aggressive towards each other once put into a stall. To prevent the cows from hurting each other, FJ want to assign the cows to the stalls, such that the minimum distance between any two of them is as large as possible. What is the largest minimum distance?
|
||||||
|
|
||||||
|
**输入**
|
||||||
|
|
||||||
|
- Line 1: Two space-separated integers: N and C
|
||||||
|
- Lines 2..N+1: Line i+1 contains an integer stall location, xi
|
||||||
|
|
||||||
|
**输出**
|
||||||
|
|
||||||
|
- Line 1: One integer: the largest minimum distance
|
||||||
|
|
||||||
|
**样例输入**
|
||||||
|
|
||||||
|
```text
|
||||||
|
5 3
|
||||||
|
1
|
||||||
|
2
|
||||||
|
8
|
||||||
|
4
|
||||||
|
9
|
||||||
|
```
|
||||||
|
|
||||||
|
**样例输出**
|
||||||
|
|
||||||
|
```text
|
||||||
|
3
|
||||||
|
```
|
||||||
|
|
||||||
|
**提示**
|
||||||
|
|
||||||
|
OUTPUT DETAILS:
|
||||||
|
FJ can put his 3 cows in the stalls at positions 1, 4 and 8, resulting in a minimum distance of 3.
|
||||||
|
Huge input data,scanf is recommended.
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
## 题目解读与分析
|
||||||
|
|
||||||
|
(如果您已熟练掌握二分搜索,可以跳过本段与下一段,直接浏览代码)
|
||||||
|
|
||||||
|
- **这是一个搜索问题,适宜使用二分搜索**
|
||||||
|
|
||||||
|
首先观察样例输入,输入的牛棚坐标不一定有序,反手一个快速排序,闷声发大财(逃
|
||||||
|
|
||||||
|
题目的意图是,给定一系列正整数 ![[公式]](https://www.zhihu.com/equation?tex=x_%7B1%7D%2Cx_%7B2%7D..x_%7Bn%7D) ,最大化其中任意 ![[公式]](https://www.zhihu.com/equation?tex=c) 个数中两两之差的最小值(以下用 D 表示)。能不能直接利用输入的数据计算出这个“最大的最小值”呢?以我浅薄的智慧想不到可行的解决方案。相比起来,通过多次试探找出合理的 D 无疑更有可操作性。因此,这是一个搜索问题,或者至少将其当做一个搜索问题来对待。
|
||||||
|
|
||||||
|
- **为什么采用二分搜索?**
|
||||||
|
|
||||||
|
现在我们需要在1~ ![[公式]](https://www.zhihu.com/equation?tex=D_%7Bmax%7D) 之间试出一个满足题意的 D 。
|
||||||
|
|
||||||
|
最简单粗暴的方法就是从![[公式]](https://www.zhihu.com/equation?tex=D_%7Bmax%7D) 开始降序验证 D 是否可行,并输出第一个可行的 D,但是这样的线性搜索太慢了。输入n个牛棚的坐标,最大的计算次数就是 ![[公式]](https://www.zhihu.com/equation?tex=%5Cfrac%7B10%5E%7B9%7D%7D%7BC%7D%5Ccdot+n) ,约等于 ![[公式]](https://www.zhihu.com/equation?tex=10%5E%7B9%7D) 次,会超时。所以需要使用二分搜索。
|
||||||
|
|
||||||
|
- **怎么验证一个D是否可行?**
|
||||||
|
|
||||||
|
如何确定一个D是否可行呢?我们只要把第一头牛放在第一个牛棚里,把第二头牛放在 D 距离以外第一个遇到的牛棚,以此类推,最后看一看能不能放得下所有的牛。显然,D 有个不可逾越的上界,就是假设所有牛在总长度上(最右牛棚 - 最左牛棚)均匀分布时的间距,这个值就是 ![[公式]](https://www.zhihu.com/equation?tex=D_%7Bmax%7D) 。
|
||||||
|
|
||||||
|
- **二分搜索**
|
||||||
|
|
||||||
|
- **如何通过二分搜索寻找最优解?**
|
||||||
|
对区间[ L, R ],当中间值mid不可行时,所有比mid大的D都不可行,右界左移开始下一轮;当mid可行时,不能确定mid右侧是否还有更大的可行解,因此用一个变量暂存当前可行解,然后左界右移,开始下一轮。当二分循环结束时,暂存的可行解即为所求最优解。
|
||||||
|
- **初始右界的确定**
|
||||||
|
\#——#——#——#——#——#
|
||||||
|
0——1——2——3——4——5
|
||||||
|
根据植树原理,右边界,即均匀分布时的距离,等于总长度 ![[公式]](https://www.zhihu.com/equation?tex=%5Cdiv) (牛的头数 - 1)
|
||||||
|
- **边界的移动**
|
||||||
|
左边界右移时,如果将left更新为mid,当left与right相差1时,mid = (left + right) / 2的值总等于left,会引起死循环,所以应该将left更新为mid+1
|
||||||
|
由于数组是升序的,右边界左移时,不需考虑。想一想,这是为什么?
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
## 细节说明
|
||||||
|
|
||||||
|
- **输入方式**
|
||||||
|
题目中提到“Huge input data,scanf is recommended.”,因此使用scanf_s而不是cin输入
|
||||||
|
- **命名与程序结构**
|
||||||
|
为了增加程序的可读性、可修改性,可以将所有变量与函数都用英文单词(一些含义明确的局部变量除外)命名,并且将二分搜索的过程、验证最小距离D可行性的过程,抽象为函数。详见参考题解
|
||||||
|
- **排序**
|
||||||
|
除非题目要求或有特殊需求,否则应尽量使用内置的排序。一般来说,语言、编译器提供的排序算法更安全、更高效
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
## 参考题解
|
||||||
|
|
||||||
|
[完整代码](./poj2456.7z)如下,仅供参考
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
//global
|
||||||
|
const int MAX_N = 100000;
|
||||||
|
const int MAX_STALL = 1000000000;
|
||||||
|
int N = 0,C = 1;
|
||||||
|
int stall[MAX_N] = {0};
|
||||||
|
|
||||||
|
//prototype
|
||||||
|
bool IsDOK(int D);
|
||||||
|
int SearchLargestMinDistance(int left, int right);
|
||||||
|
int cmpInt(const void * a, const void * b);
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
int L = 1, R = (stall[N-1] - stall[0]) / (C - 1);
|
||||||
|
int result = SearchLargestMinDistance(L, R);
|
||||||
|
cout << result;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Init()
|
||||||
|
{
|
||||||
|
//input boundary data
|
||||||
|
cin >> N >> C;
|
||||||
|
|
||||||
|
//error check
|
||||||
|
if(N > MAX_N || N < C || C < 2)
|
||||||
|
{
|
||||||
|
cout << "Input error! Out of range." << endl;
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//input stall data and sort it
|
||||||
|
for(int i = 0;i<N;i++)
|
||||||
|
{
|
||||||
|
scanf_s("%d",&stall[i]);
|
||||||
|
if(stall[i] > MAX_STALL || stall[i] < 0)
|
||||||
|
{
|
||||||
|
cout << "Input error! Out of range." << endl;
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qsort(stall, N, sizeof(int), cmpInt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int SearchLargestMinDistance(int left, int right)
|
||||||
|
{
|
||||||
|
//init
|
||||||
|
int mid = (left + right) / 2;
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//binary search
|
||||||
|
while(right - left >= 0)
|
||||||
|
{
|
||||||
|
if(IsDOK(mid))
|
||||||
|
{
|
||||||
|
left = mid + 1;
|
||||||
|
result = mid;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
right = mid - 1;
|
||||||
|
}
|
||||||
|
mid = (left + right) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsDOK(int D)
|
||||||
|
{
|
||||||
|
//init
|
||||||
|
int i = 0,p = stall[0];
|
||||||
|
int restCow = C - 1;
|
||||||
|
|
||||||
|
for(i = 1;i<N;i++)
|
||||||
|
{
|
||||||
|
if(stall[i] >= p + D)
|
||||||
|
{
|
||||||
|
p = stall[i];
|
||||||
|
restCow--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return restCow <= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cmpInt(const void * a, const void * b)
|
||||||
|
{
|
||||||
|
return ( *(int*)a - *(int*)b );
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 参考
|
||||||
|
|
||||||
|
1. Aggressive cows http://poj.org/problem?id=2456
|
||||||
|
After Width: | Height: | Size: 76 KiB |
|
|
@ -0,0 +1,112 @@
|
||||||
|
---
|
||||||
|
title: '如何使用VS Code在Windows下调试C++'
|
||||||
|
date: 2021-10-24 12:43:00 +0800
|
||||||
|
tags:
|
||||||
|
- VSCode
|
||||||
|
- C++
|
||||||
|
img: null
|
||||||
|
---
|
||||||
|
|
||||||
|
本文系原创,首发于[blog.smagic.top](https://blog.smagic.top/),同步发布于cnblogs与知乎,作者SMagic保留一切著作权,转载请注明来源与出处。
|
||||||
|
|
||||||
|
## 前言
|
||||||
|
|
||||||
|
最近在用VS Code写C++,发现VS Code官方文档中没有自动用VS的C++编译器cl.exe编译并且在VS Code中调试程序的方案,在网上也找不到合适的。无奈之下只有自己琢磨,通过翻阅微软的文档,DIY出了一套方案,于是写篇博客记录一下。其实主要原因是懒得为了写点水代码,专门用VS开一个项目(逃
|
||||||
|
|
||||||
|
这篇文章最初写于2021-6-25,写完了以后没有发布,后来VS Code官方文档于2021-8-19更新了[VS Code在Windows下调试C++的相关教程](https://code.visualstudio.com/docs/cpp/config-msvc),看了以后感觉官方的实现更优雅一点。但是我文章都写完了,如果就这么作废了,心里会很不舒服,所以还是打算发出来,给大家献个丑。
|
||||||
|
|
||||||
|
## 为什么使用 Visual Studio 开发人员命令行工具
|
||||||
|
|
||||||
|
关于调试C++程序,VS Code 官方给出的解决方案是使用MinGW,而MinGW有个问题,用它生成的exe文件如果需要在别的电脑上运行,就需要带着MinGW的一堆库一起走。相比之下,使用Visual Studio编译C++源代码得到的exe,运行所需要的“Microsoft Visual C++ Redistributable”在绝大多数Windows电脑上都是自带的。即使不使用 Visual Studio 进行开发工作,也可以只下载[Visual Studio 2019 生成工具](https://visualstudio.microsoft.com/zh-hans/downloads/#build-tools-for-visual-studio-2019),或者只下载[Microsoft C++ 生成工具](https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/),然后使用命令行工具。这些就是我推荐使用它的理由。
|
||||||
|
|
||||||
|
“Visual Studio 开发人员命令行工具”是Visual Studio自带的几个创建了一堆临时环境变量的脚本。运行这个脚本会打开一个命令行界面,可以在其中使用Visual Studio的各种语言的编译工具,比如解决方案(*.sln)生成工具`msbuild`,C++编译器`cl.exe`,C#编译器`csc.exe`,Visual Basic编译器`vbc.exe`,而无需为其配置任何环境变量。
|
||||||
|
|
||||||
|
常规的做法是在开始菜单——Visual Studio 所在的文件夹中打开它们,然后切换到项目的目录,运行编译指令。如果想要实现在VS Code 中点击“调试“按钮后自动编译程序,仅仅这样是行不通的。我们需要让 cl.exe 在批处理脚本(\*.bat,\*.cmd)中可用,然后才能在VS Code的调试配置文件中使用 cl.exe 编译c++源码,以及使用VS Code 调试 C++ 程序。
|
||||||
|
|
||||||
|
## 配置 VS 命令行编译环境
|
||||||
|
|
||||||
|
打开Visual Studio 开发人员 PowerShell的路径,一般为`C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools`,具体路径因人而异,在该路径下看到`Launch-VsDevShell.ps1`文件即可。
|
||||||
|
|
||||||
|
接下来将这个路径加入系统变量Path。点击上方地址栏,复制完整路径,在桌面上右击【此电脑】-【属性】,在弹出的窗口最下方点击【高级系统设置】,在弹出的【系统属性】窗口中点击【高级】选项卡,然后点击【环境变量】,在下方的【系统变量】中点击【Path】-【编辑】,在弹出的【编辑环境变量】窗口中点击【新建】,将复制的路径粘贴进去,保存退出。
|
||||||
|
|
||||||
|
完成后,打开命令提示符(cmd.exe),输入`call vcvars64.bat`,如果出现如下提示信息,说明配置成功
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
C:\Users\SMagic>call vcvars64.bat
|
||||||
|
**********************************************************************
|
||||||
|
** Visual Studio 2019 Developer Command Prompt v16.10.2
|
||||||
|
** Copyright (c) 2021 Microsoft Corporation
|
||||||
|
**********************************************************************
|
||||||
|
[vcvarsall.bat] Environment initialized for: 'x64'
|
||||||
|
|
||||||
|
C:\Users\SMagic>
|
||||||
|
```
|
||||||
|
|
||||||
|
> 说到这儿,最近抄袭文章的挺多的,再次声明一下,本文系原创,首发于[blog.smagic.top](https://blog.smagic.top/),同步发布于cnblogs与知乎,作者SMagic保留一切著作权,转载请注明来源与出处。
|
||||||
|
|
||||||
|
## 配置VS Code 调试环境
|
||||||
|
|
||||||
|
打开VS Code,点击【文件】-【打开文件夹】,将项目所在的文件夹打开,作为工作区。
|
||||||
|
|
||||||
|
在文件夹中创建文件`make.bat`,将下列代码粘贴在其中:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
call vcvars64.bat
|
||||||
|
cl /Zi /GX /Fe:main.exe *.cpp
|
||||||
|
```
|
||||||
|
|
||||||
|
`/Zi`的作用是启用调试信息,`/Fe:main.exe`表明输出文件为`main.exe`,可以自行更改。
|
||||||
|
|
||||||
|
点击【运行】-【添加配置】,VS Code会自动创建`.vscode\launch.json`文件,或者手动创建。将下列代码粘贴在其中:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "(Windows) 启动",
|
||||||
|
"type": "cppvsdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/main.exe",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"environment": [],
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"preLaunchTask": "build"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`${workspaceFolder}`是工作区目录,即当前打开的文件夹。main.exe需与`make.bat`中保持一致。
|
||||||
|
|
||||||
|
在`.vscode`文件夹下创建`tasks.json`,将下列代码粘贴在其中:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "build",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "cd ${workspaceFolder} ; .\\make.bat",
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`"label": "build"`中的`build`可以自行更改,但需要与`launch.json`中的`"preLaunchTask": "build"`保持一致。
|
||||||
|
|
||||||
|
现在就可以使用VS Code调试代码了。点击左侧【运行与调试】,点击上方的绿色三角形开始调试。可以在代码文件中设置断点,观察VS Code调试器是否可以命中断点。
|
||||||
|
|
||||||
|
## 参考
|
||||||
|
|
||||||
|
[适用于开发人员的命令行 shell 和提示 - Visual Studio](https://docs.microsoft.com/zh-cn/visualstudio/ide/reference/command-prompt-powershell?view=vs-2019)
|
||||||
|
|
||||||
|
[通过命令行使用 Microsoft C++ 工具集](https://docs.microsoft.com/zh-cn/cpp/build/building-on-the-command-line?view=msvc-160#command-line-tools)
|
||||||
|
|
||||||
|
[Configure VS Code for Microsoft C++](https://code.visualstudio.com/docs/cpp/config-msvc)
|
||||||
|
After Width: | Height: | Size: 126 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 346 KiB |
|
After Width: | Height: | Size: 165 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
|
@ -0,0 +1,222 @@
|
||||||
|
---
|
||||||
|
title: 超详细!如何搭建国际版我的世界服务器
|
||||||
|
date: 2020-07-29 12:43:00 +0800
|
||||||
|
tags:
|
||||||
|
- Minecraft
|
||||||
|
img: null
|
||||||
|
---
|
||||||
|
|
||||||
|
**关键词**: 我的世界 Minecraft 服务器 1.16 国际版
|
||||||
|
|
||||||
|
## 前言
|
||||||
|
|
||||||
|
我是一个老MC划水员,为了和好朋友远程联机玩MC,我尝试过很多办法。网易代理MC以后,年少无知的我以为MC迎来了春天,结果网易版不仅特性频出,而且远程联机和租赁服十分卡顿,最终把我演走了。不久前,我通过学习与摸索,成功地在云端建了一个国际版1.16.1MC纯净版服务器,并用HMCL客户端开始了愉快的划水。
|
||||||
|
|
||||||
|
写这篇文章,是为了记录一下自己的建服历程,并且希望能帮助到一些需要的朋友。如果您没有建服经验,在**做好支出预算**的情况下,可以按照本文 **【除了租用服务器以外的】** 内容搭建一个MC服务器。如果您有一定计算机基础,本文将是一份详细的参考资料,您也可以直接观看“熟练者段落”速成服务器搭建。
|
||||||
|
|
||||||
|
如果这篇文章对您有帮助,还请点一个免费的赞,谢谢~
|
||||||
|
|
||||||
|
## 致谢
|
||||||
|
|
||||||
|
我在建服的时候主要学习了云栖社区的sws797所著的文章[**阿里云ECS搭建我的世界服务器**](https://yq.aliyun.com/articles/675070),对于它对我的帮助我表示由衷的感谢。同时,为了避免抄袭嫌疑,我将链接置于此处以便与本文对比。
|
||||||
|
|
||||||
|
非常感谢HMCL客户端的开发者及其团队、支持者,以及[**MCBBS中文论坛**](https://www.mcbbs.net/),让我玩上了顺滑的MC 1.16.1。
|
||||||
|
|
||||||
|
## 观前提醒
|
||||||
|
|
||||||
|
- 本文为原创,发布于 cnblogs与知乎,作者保留一切著作权,**【转载请在开头注明作者、来源与链接】**,侵权必究。
|
||||||
|
- 租服务器是要花钱的,月费**可能**上百,请量入为出,衡量好建服成本。如果您不需要24小时保持服务器开启,成本**可能**会大幅降低。
|
||||||
|
- 本文为线上建服教程,线下购买或组装服务器在长时间
|
||||||
|
- 本文基于作者的实际建服经历,服务器为Linux系统,本地电脑为Windows 10 家庭版,游戏版本为1.16.1,没有装载mod,服务器不会24小时开机。如遇与本文例子不同的情况,使得解决方案失效,那么还请读者自行摸索。
|
||||||
|
- 适度娱乐有益健康,沉迷游戏隐患巨大,建议您平衡好学习与娱乐、生活与娱乐的关系。
|
||||||
|
- 作者(SMagic)所建服务器为私人性质服务器,暂不对外开放。
|
||||||
|
|
||||||
|
## 为熟练者提供的概述
|
||||||
|
|
||||||
|
- 租用一台装有 Linux 系统的服务器,配置公网IP,开放25565端口
|
||||||
|
|
||||||
|
- 在本地电脑上安装WinSCP,以便于向服务器上传文件。在服务器上安装java,将MC服务端程序拷贝在/opt目录下运行
|
||||||
|
|
||||||
|
- 第一次运行服务端程序会失败,用WinSCP修改`eula.txt`文件来签署用户协议,之后可以正常运行
|
||||||
|
|
||||||
|
- 在本地电脑上安装HMCL,下载1.16.1版本,启动游戏,点击“多人游戏”,点击“添加服务器”,输入服务器公网IP
|
||||||
|
|
||||||
|
## 准备工作
|
||||||
|
|
||||||
|
出于不明原因,官网链接下载可能会很慢
|
||||||
|
|
||||||
|
- 服务器软件下载
|
||||||
|
|
||||||
|
- 下载MC 1.16.1 服务端程序,官网链接:[https://www.minecraft.net/zh-hans/download/server](https://www.minecraft.net/zh-hans/download/server)
|
||||||
|
|
||||||
|
- 本地电脑软件下载
|
||||||
|
|
||||||
|
- 下载java,官网链接:[https://www.java.com/zh_CN/download/windows_offline.jsp](https://www.java.com/zh_CN/download/windows_offline.jsp)
|
||||||
|
- 下载HMCL,官网链接:[https://hmcl.huangyuhui.net/download](https://hmcl.huangyuhui.net/download)
|
||||||
|
- 下载WinSCP,官网链接:[https://winscp.net/eng/docs/lang:chs](https://winscp.net/eng/docs/lang:chs)
|
||||||
|
|
||||||
|
## 租用、配置服务器
|
||||||
|
|
||||||
|
<u>**免责声明:本段内容提供详细购买步骤,意在方便读者理解选购过程,无意推广任何特定厂商,也不构成任何选购建议。阅读本段与购买服务器时请您仔细阅读、独立思考、自主决定,任何由于购买服务器时误操作造成的财产损失依法由购买者自行负责。本文所述“购买服务器”意为租用可以远程访问的服务器,而不是购买实体的服务器。如您不认同这条声明,请不要阅读本段内容。**</u>
|
||||||
|
|
||||||
|
服务器可以在阿里云、腾讯云、华为云等网站中租赁,鉴于该步骤操作大同小异,本文仅以阿里云为例(因为我租的是阿里云的2333)。
|
||||||
|
|
||||||
|
首先,注册帐号,打开服务器购买页面,如图。
|
||||||
|
|
||||||
|
【配置信息仅供参考,不构成购买建议】
|
||||||
|
|
||||||
|
配置页面中的“**1v2g**”表示单核CPU、2G内存。人数比较少的纯净服 1v2g 够用,2v4g 的配置可以带得动一些mod。镜像随便选一个Linux系统(我用的是默认的 Aliyun Linux),存储选择默认的高效云盘40G。“地域及可用区”选择离自己最近的,减少延迟。
|
||||||
|
|
||||||
|
关于付费模式的选择,如果您打算保持服务器24小时开机,建议选择包年包月。如果您想要随用随开,建议选择按量付费。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
点击下一步,进入“网络与安全组”页面。关于带宽计费模式,随用随开型服主建议选择按使用流量付费,24小时开机型服主请自行斟酌。本页面其他内容可以保持默认。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
点击下一步,进入系统配置页面,选择登录凭证为自定义密码(密钥对我不会用QAQ,高手可以自便),设置root用户的登录密码,然后根据自己的需求完成其他的各项设置。**确认订单内容为自己的真实意思表达,并确认金额无误后,提交订单并支付。**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
前往控制台(这里以阿里云ECS控制台为例),点击“网络与安全”、“安全组”,在列表中通过创建时间找到服务器对应的安全组,点击名称,在“入方向”中添加25565端口的TCP规则。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 在服务器上安装java
|
||||||
|
|
||||||
|
- **首先确认服务器有没有预装java**
|
||||||
|
|
||||||
|
通过服务器管理页面给出的方法,远程连接服务器,在SSH命令窗口输入
|
||||||
|
|
||||||
|
```shell
|
||||||
|
java -version
|
||||||
|
```
|
||||||
|
|
||||||
|
如果出现java版本信息说明java已经安装,否则应先安装java。
|
||||||
|
|
||||||
|
- 通过yum安装服务端java
|
||||||
|
|
||||||
|
在SSH命令窗口输入以下命令,即可安装
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yum -y install java-1.8.0-openjdk
|
||||||
|
```
|
||||||
|
|
||||||
|
- 通过上传安装包安装服务端java
|
||||||
|
|
||||||
|
如果使用上述方法无法安装java,请按照以下步骤操作。
|
||||||
|
|
||||||
|
前往[https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html](https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html),下载64位的、后缀为`.tar.gz`的Linux版JDK,如图。(图片中版本仅供参考)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
使用WinSCP登录到服务器,将其上传至`/usr/local`目录下。登录SSH命令窗口,输入以下命令,其中`xxx.tar.gz`需替换为实际的文件名。
|
||||||
|
|
||||||
|
```
|
||||||
|
tar -zxvf /usr/local/xxx.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
解压完成后,在WinSCP中将`/usr/local`目录下的`jdk1.8.0_261`文件夹(名称可能不同)改为`java`,这样做是为了方便配置环境变量,因此也可以不改。
|
||||||
|
|
||||||
|
用WinSCP打开`/etc`目录下的`profile`文件,右键点击编辑,在最后添加如下几行信息,保存
|
||||||
|
|
||||||
|
```shell
|
||||||
|
export JAVA_HOME=/usr/local/java
|
||||||
|
export PATH=$PATH:$JAVA_HOME/bin
|
||||||
|
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
|
||||||
|
export JRE_HOME=$JAVA_HOME/jre
|
||||||
|
```
|
||||||
|
|
||||||
|
通过网页控制台或者命令重启服务器,在SSH命令窗口输入
|
||||||
|
|
||||||
|
```shell
|
||||||
|
java -version
|
||||||
|
```
|
||||||
|
|
||||||
|
来确认java是否正确安装
|
||||||
|
|
||||||
|
## 在服务器上安装、配置MC服务端
|
||||||
|
|
||||||
|
本步骤中上传文件、修改eula.txt文件等操作可以使用其他工具来等效完成,本文介绍相对简单的WinSCP。
|
||||||
|
|
||||||
|
在本地电脑上安装WinSCP并打开,第一次使用时,点击“新建站点”,文件协议保持默认的SFTP,站点名称处填写服务器的公网IP地址,密码填写本文上一段中所设置的登录密码。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
登录WinSCP,在`opt`目录中随便新建一个目录(比如MC1.16),将MC服务端程序`server.jar`上传至该目录下。
|
||||||
|
|
||||||
|
在SSH命令窗口输入以下命令来运行程序,其中“MC1.16”为自定义的目录名称,请根据实际命名修改。
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cd opt/MC1.16
|
||||||
|
java -Xmx1024M -Xms1024M -jar server.jar nogui
|
||||||
|
```
|
||||||
|
|
||||||
|
第一次运行肯定会失败,并且会生成`eula.txt`文件,这是因为尚未签署用户协议。用WinSCP找到该文件,右键点击,选择“编辑”。将其中的`eula=false`更改为`eula=true`,点击保存。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
用WinSCP打开游戏规则配置文件`server.properties`,将`online-mode`后的`true`改为`false`来关闭正版帐号验证,否则无法进入游戏。之后可以根据个人需求对游戏规则进行修改。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 制作自动启动游戏的脚本
|
||||||
|
|
||||||
|
用WinSCP在根目录下新建`start_mc16.sh`文件(文件名可以自行设置,但不建议使用中文),右键点击编辑,将以下代码复制到文件中并保存。代码中的“MC1.16”为自定义的目录名称,请根据实际命名修改。这个脚本文件的作用是,自动打开服务端游戏程序,记录游戏日志,并保持后台运行。
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/bin/bash
|
||||||
|
cd /opt/MC1.16
|
||||||
|
nohup java -Xmx1024M -Xms1024M -jar server.jar nogui >/root/MC1.16.log &
|
||||||
|
tail -f /root/MC1.16.log
|
||||||
|
```
|
||||||
|
|
||||||
|
要运行游戏,只需在SSH命令窗口输入
|
||||||
|
|
||||||
|
```shell
|
||||||
|
bash /start_mc16.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## 在本地电脑上安装HMCL,连接游戏服务器
|
||||||
|
|
||||||
|
将下载好的HMCL客户端放置在一个单独的文件夹里,双击运行。点击"版本列表"、“安装新游戏版本”。加载过程可能较慢,需要多刷新几次,等待列表加载完成后,选择1.16.1稳定版。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
下载完成后,点击左上角返回,然后点击“启动游戏”,游戏启动后,点击“多人游戏”、“添加服务器”,输入服务器公网IP,即可连接服务端游戏。
|
||||||
|
|
||||||
|
## 在服务器中手动设置初始OP
|
||||||
|
|
||||||
|
在你第一次连接MC服务端的时候,你会发现没有人是OP,此时你需要手动修改文件来添加第一个OP。OP即多人游戏管理员,您可以搜索“我的世界 OP”了解更多信息。
|
||||||
|
|
||||||
|
在你进入过服务端游戏之后,用WinSCP登录服务器,在`/opt/MC1.16`目录下打开`user.json`文件,找到你想设置OP的玩家,将他的`name`字段和`uuid`字段复制到某处。接着打开`ops.json`文件,参考以下示例的格式设置该用户为OP。
|
||||||
|
|
||||||
|
`level`为OP等级,我暂时不知道它有什么用,姑且设置为4即可(我怀疑这个4是个magic number)。`bypassesPlayerLimit`为`true`时表示可以在服务器满员的情况下进入服务器,为`false`则不行。
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
|
||||||
|
"name": "SMagic",
|
||||||
|
"level": 4,
|
||||||
|
"bypassesPlayerLimit": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
|
||||||
|
"name": "Is666",
|
||||||
|
"level": 4,
|
||||||
|
"bypassesPlayerLimit": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
## 在其他端口上开放游戏(非必需)
|
||||||
|
|
||||||
|
服务端游戏默认使用25565端口,如果您想在其他端口上开放游戏,需要在服务器控制台网页(例如阿里云控制台)设置端口,在服务器`/opt/MC1.16`目录下(“MC1.16为自定义目录名称”)修改`server.properties`文件中的端口,在本地游戏客户端“多人游戏”、“添加服务器”页面中在公网IP后添加英文冒号与端口号。相关操作方法前文已经出现,这里不再赘述。如果您对这些内容感到疑惑,请放心,这些操作不是必需的,忽略这些内容对游戏的运行没有影响。
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
require('prismjs/themes/prism.css')
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
module.exports = {
|
||||||
|
siteMetadata: {
|
||||||
|
title: `SMagic's Blog`,
|
||||||
|
description: `一个兴趣广泛的软件开发者`,
|
||||||
|
author: `SMagic`,
|
||||||
|
siteUrl: `https://blog.smagic.top/`,
|
||||||
|
social: {
|
||||||
|
twitter: ``,
|
||||||
|
facebook: ``,
|
||||||
|
github: `SMagic-L`,
|
||||||
|
linkedin: ``,
|
||||||
|
email: `tmp@smagic.top`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
{
|
||||||
|
resolve: `gatsby-source-filesystem`,
|
||||||
|
options: {
|
||||||
|
path: `${__dirname}/content/blog`,
|
||||||
|
name: `blog`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
resolve: `gatsby-source-filesystem`,
|
||||||
|
options: {
|
||||||
|
path: `${__dirname}/content/assets`,
|
||||||
|
name: `assets`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
resolve: `gatsby-transformer-remark`,
|
||||||
|
options: {
|
||||||
|
plugins: [
|
||||||
|
{
|
||||||
|
resolve: `gatsby-remark-images`,
|
||||||
|
options: {
|
||||||
|
maxWidth: 970,
|
||||||
|
withWebp: true,
|
||||||
|
withAvif: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
resolve: `gatsby-remark-katex`,
|
||||||
|
options: {
|
||||||
|
strict: `warn`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
resolve: `gatsby-remark-copy-linked-files`,
|
||||||
|
options: {
|
||||||
|
destinationDir: `files`,
|
||||||
|
ignoreFileExtensions: [`png`, `jpg`, `jpeg`, `bmp`, `tiff`],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
`gatsby-remark-prismjs`,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
`gatsby-plugin-image`,
|
||||||
|
`gatsby-plugin-sharp`,
|
||||||
|
`gatsby-transformer-sharp`,
|
||||||
|
// uncomment this and input the trackingId to enable google analytics
|
||||||
|
// {
|
||||||
|
// resolve: `gatsby-plugin-google-analytics`,
|
||||||
|
// options: {
|
||||||
|
// trackingId: `ADD YOUR TRACKING ID HERE`,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
resolve: `gatsby-plugin-manifest`,
|
||||||
|
options: {
|
||||||
|
name: `flexible-gatsby-starter`,
|
||||||
|
short_name: `flexible-gatsby`,
|
||||||
|
start_url: `/`,
|
||||||
|
background_color: `#663399`,
|
||||||
|
theme_color: `#663399`,
|
||||||
|
display: `minimal-ui`,
|
||||||
|
icon: `./static/gatsby-icon.png`, // This path is relative to the root of the site.
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// `gatsby-plugin-offline`,
|
||||||
|
`gatsby-plugin-react-helmet`,
|
||||||
|
`gatsby-plugin-sass`,
|
||||||
|
`gatsby-plugin-decap-cms`
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
const path = require(`path`)
|
||||||
|
const _ = require('lodash')
|
||||||
|
const { createFilePath } = require(`gatsby-source-filesystem`)
|
||||||
|
|
||||||
|
exports.createPages = ({ graphql, actions }) => {
|
||||||
|
const { createPage } = actions
|
||||||
|
|
||||||
|
const blogPost = path.resolve(`./src/templates/blog-post.js`)
|
||||||
|
const tagTemplate = path.resolve(`./src/templates/tags.js`)
|
||||||
|
|
||||||
|
return graphql(
|
||||||
|
`
|
||||||
|
{
|
||||||
|
allMarkdownRemark(
|
||||||
|
sort: { fields: [frontmatter___date], order: DESC }
|
||||||
|
limit: 1000
|
||||||
|
) {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
fields {
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
frontmatter {
|
||||||
|
title
|
||||||
|
tags
|
||||||
|
img {
|
||||||
|
childImageSharp {
|
||||||
|
gatsbyImageData(placeholder: BLURRED, layout: FULL_WIDTH)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
).then((result) => {
|
||||||
|
if (result.errors) {
|
||||||
|
throw result.errors
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create blog posts pages.
|
||||||
|
const posts = result.data.allMarkdownRemark.edges
|
||||||
|
|
||||||
|
posts.forEach((post, index) => {
|
||||||
|
const previous = index === posts.length - 1 ? null : posts[index + 1].node
|
||||||
|
const next = index === 0 ? null : posts[index - 1].node
|
||||||
|
|
||||||
|
createPage({
|
||||||
|
path: post.node.fields.slug,
|
||||||
|
component: blogPost,
|
||||||
|
context: {
|
||||||
|
slug: post.node.fields.slug,
|
||||||
|
previous,
|
||||||
|
next,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create blog post list pages
|
||||||
|
const postsPerPage = 10
|
||||||
|
const numPages = Math.ceil(posts.length / postsPerPage)
|
||||||
|
|
||||||
|
Array.from({ length: numPages }).forEach((_, i) => {
|
||||||
|
createPage({
|
||||||
|
path: i === 0 ? `/` : `/${i + 1}`,
|
||||||
|
component: path.resolve('./src/templates/blog-list.js'),
|
||||||
|
context: {
|
||||||
|
limit: postsPerPage,
|
||||||
|
skip: i * postsPerPage,
|
||||||
|
numPages,
|
||||||
|
currentPage: i + 1,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// create Tags pages
|
||||||
|
// pulled directly from https://www.gatsbyjs.org/docs/adding-tags-and-categories-to-blog-posts/#add-tags-to-your-markdown-files
|
||||||
|
let tags = []
|
||||||
|
// Iterate through each post, putting all found tags into `tags`
|
||||||
|
_.each(posts, (edge) => {
|
||||||
|
if (_.get(edge, 'node.frontmatter.tags')) {
|
||||||
|
tags = tags.concat(edge.node.frontmatter.tags)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// Eliminate duplicate tags
|
||||||
|
tags = _.uniq(tags)
|
||||||
|
// Make tag pages
|
||||||
|
tags.forEach((tag) => {
|
||||||
|
createPage({
|
||||||
|
path: `/tags/${_.kebabCase(tag)}/`,
|
||||||
|
component: tagTemplate,
|
||||||
|
context: {
|
||||||
|
tag,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.onCreateNode = ({ node, actions, getNode }) => {
|
||||||
|
const { createNodeField } = actions
|
||||||
|
|
||||||
|
if (node.internal.type === `MarkdownRemark`) {
|
||||||
|
const value = createFilePath({ node, getNode })
|
||||||
|
createNodeField({
|
||||||
|
name: `slug`,
|
||||||
|
node,
|
||||||
|
value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
{
|
||||||
|
"name": "flexible-gatsby",
|
||||||
|
"private": true,
|
||||||
|
"description": "A starter for a paginated blog powered by Gatsby and Markdown",
|
||||||
|
"version": "1.2.0",
|
||||||
|
"author": "Kinyanjui Wangonya",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/wangonya/flexible-gatsby/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"decap-cms-app": "^3.1.10",
|
||||||
|
"gatsby": "^4.25.7",
|
||||||
|
"gatsby-plugin-decap-cms": "^4.0.4",
|
||||||
|
"gatsby-plugin-google-analytics": "^5.1.0",
|
||||||
|
"gatsby-plugin-image": "^2.7.0",
|
||||||
|
"gatsby-plugin-manifest": "^4.23.0",
|
||||||
|
"gatsby-plugin-offline": "^5.7.0",
|
||||||
|
"gatsby-plugin-react-helmet": "^5.7.0",
|
||||||
|
"gatsby-plugin-sass": "^5.7.0",
|
||||||
|
"gatsby-plugin-sharp": "^4.25.1",
|
||||||
|
"gatsby-remark-copy-linked-files": "^5.7.0",
|
||||||
|
"gatsby-remark-images": "^6.25.0",
|
||||||
|
"gatsby-remark-katex": "^6.7.0",
|
||||||
|
"gatsby-remark-prismjs": "^6.7.0",
|
||||||
|
"gatsby-source-filesystem": "^4.7.0",
|
||||||
|
"gatsby-transformer-remark": "^5.25.1",
|
||||||
|
"gatsby-transformer-sharp": "^4.23.0",
|
||||||
|
"katex": "^0.13.3",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"node-sass": "^7.0.1",
|
||||||
|
"prismjs": "^1.27.0",
|
||||||
|
"prop-types": "^15.8.1",
|
||||||
|
"react": "^17.0.2",
|
||||||
|
"react-dom": "^17.0.2",
|
||||||
|
"react-helmet": "^6.1.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^8.8.0",
|
||||||
|
"eslint-plugin-react": "^7.28.0",
|
||||||
|
"prettier": "^2.5.1"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/wangonya/flexible-gatsby",
|
||||||
|
"keywords": [
|
||||||
|
"gatsby"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "n/a",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/wangonya/flexible-gatsby.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "gatsby build",
|
||||||
|
"dev": "gatsby develop",
|
||||||
|
"develop": "gatsby develop",
|
||||||
|
"test": "echo \"Write tests! -> https://gatsby.app/unit-testing\"",
|
||||||
|
"lint": "eslint --ext .js,.jsx --ignore-pattern public .",
|
||||||
|
"format": "prettier --trailing-comma es5 --no-semi --single-quote --write 'src/**/*.js' 'content/**/*.md'",
|
||||||
|
"fix-semi": "eslint --quiet --ignore-pattern node_modules --ignore-pattern public --parser babel-eslint --no-eslintrc --rule '{\"semi\": [2, \"never\"], \"no-extra-semi\": [2]}' --fix gatsby-node.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
import React from 'react'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
import { StaticQuery, graphql } from 'gatsby'
|
||||||
|
import Helmet from 'react-helmet'
|
||||||
|
|
||||||
|
import Sidebar from '.././components/sidebar'
|
||||||
|
import '../styles/main.scss'
|
||||||
|
import '../styles/fonts/font-awesome/css/font-awesome.min.css'
|
||||||
|
|
||||||
|
const DefaultLayout = ({ children }) => (
|
||||||
|
<StaticQuery
|
||||||
|
query={graphql`
|
||||||
|
query SiteTitleQuery {
|
||||||
|
site {
|
||||||
|
siteMetadata {
|
||||||
|
author
|
||||||
|
description
|
||||||
|
social {
|
||||||
|
twitter
|
||||||
|
facebook
|
||||||
|
linkedin
|
||||||
|
github
|
||||||
|
email
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
render={data => (
|
||||||
|
<div className="wrapper">
|
||||||
|
<Helmet>
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css?family=Lato|PT+Serif&display=swap"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
|
</Helmet>
|
||||||
|
<Sidebar siteMetadata={data.site.siteMetadata} />
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
DefaultLayout.propTypes = {
|
||||||
|
children: PropTypes.node.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DefaultLayout
|
||||||
|
After Width: | Height: | Size: 37 KiB |
|
|
@ -0,0 +1,88 @@
|
||||||
|
/**
|
||||||
|
* SEO component that queries for data with
|
||||||
|
* Gatsby's useStaticQuery React hook
|
||||||
|
*
|
||||||
|
* See: https://www.gatsbyjs.org/docs/use-static-query/
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React from 'react'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
import Helmet from 'react-helmet'
|
||||||
|
import { useStaticQuery, graphql } from 'gatsby'
|
||||||
|
|
||||||
|
function SEO({ description, lang, meta, title }) {
|
||||||
|
const { site } = useStaticQuery(
|
||||||
|
graphql`
|
||||||
|
query {
|
||||||
|
site {
|
||||||
|
siteMetadata {
|
||||||
|
title
|
||||||
|
description
|
||||||
|
author
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
)
|
||||||
|
|
||||||
|
const metaDescription = description || site.siteMetadata.description
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Helmet
|
||||||
|
htmlAttributes={{
|
||||||
|
lang,
|
||||||
|
}}
|
||||||
|
title={title}
|
||||||
|
titleTemplate={`%s | ${site.siteMetadata.title}`}
|
||||||
|
meta={[
|
||||||
|
{
|
||||||
|
name: `description`,
|
||||||
|
content: metaDescription,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
property: `og:title`,
|
||||||
|
content: title,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
property: `og:description`,
|
||||||
|
content: metaDescription,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
property: `og:type`,
|
||||||
|
content: `website`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: `twitter:card`,
|
||||||
|
content: `summary`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: `twitter:creator`,
|
||||||
|
content: site.siteMetadata.author,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: `twitter:title`,
|
||||||
|
content: title,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: `twitter:description`,
|
||||||
|
content: metaDescription,
|
||||||
|
},
|
||||||
|
].concat(meta)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
SEO.defaultProps = {
|
||||||
|
lang: `en`,
|
||||||
|
meta: [],
|
||||||
|
description: ``,
|
||||||
|
}
|
||||||
|
|
||||||
|
SEO.propTypes = {
|
||||||
|
description: PropTypes.string,
|
||||||
|
lang: PropTypes.string,
|
||||||
|
meta: PropTypes.arrayOf(PropTypes.object),
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SEO
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
import { Link } from 'gatsby'
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
import Logo from './pic.jpg'
|
||||||
|
|
||||||
|
const Sidebar = ({ siteMetadata }) => (
|
||||||
|
<>
|
||||||
|
<aside className="sidebar">
|
||||||
|
<header>
|
||||||
|
<div className="about">
|
||||||
|
<div className="cover-author-image">
|
||||||
|
<Link to="/">
|
||||||
|
<img src={Logo} alt={siteMetadata.author} />
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
<div className="author-name">{siteMetadata.author}</div>
|
||||||
|
<p>{siteMetadata.description}</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<footer>
|
||||||
|
<section className="contact">
|
||||||
|
<h3 className="contact-title">Contact me</h3>
|
||||||
|
<ul>
|
||||||
|
{siteMetadata.social.twitter && (
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href={`https://twitter.com/${siteMetadata.social.twitter}`}
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
<i className="fa fa-twitter" aria-hidden="true" />
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
{siteMetadata.social.facebook && (
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href={`https://facebook.com/${siteMetadata.social.facebook}`}
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
<i className="fa fa-facebook" aria-hidden="true" />
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
{siteMetadata.social.github && (
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href={`https://github.com/${siteMetadata.social.github}`}
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
<i className="fa fa-github" aria-hidden="true" />
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
{siteMetadata.social.linkedin && (
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href={`https://linkedin.com/in/${siteMetadata.social.linkedin}`}
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
<i className="fa fa-linkedin" aria-hidden="true" />
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
{siteMetadata.social.email && (
|
||||||
|
<li>
|
||||||
|
<a href={`mailto:${siteMetadata.social.email}`} target="_blank">
|
||||||
|
<i className="fa fa-envelope-o" aria-hidden="true" />
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
<div className="copyright">
|
||||||
|
<p>
|
||||||
|
{new Date().getFullYear()} © {siteMetadata.author}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</aside>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
|
||||||
|
export default Sidebar
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
import DefaultLayout from '../components/layout'
|
||||||
|
import SEO from '../components/seo'
|
||||||
|
|
||||||
|
class NotFoundPage extends React.Component {
|
||||||
|
render() {
|
||||||
|
const { data } = this.props
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DefaultLayout>
|
||||||
|
<SEO title="404: Not Found" />
|
||||||
|
<div className="content-box clearfix">
|
||||||
|
<h1>That page doesn't exist.</h1>
|
||||||
|
</div>
|
||||||
|
</DefaultLayout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default NotFoundPage
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
// https://www.gatsbyjs.org/docs/adding-tags-and-categories-to-blog-posts/#add-tags-to-your-markdown-files
|
||||||
|
|
||||||
|
import React from 'react'
|
||||||
|
import { Link, graphql } from 'gatsby'
|
||||||
|
|
||||||
|
import { kebabCase } from 'lodash'
|
||||||
|
|
||||||
|
import Layout from '../components/layout'
|
||||||
|
const TagsPage = ({ data }) => {
|
||||||
|
const allTags = data.allMarkdownRemark.group
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<div className="content-box clearfix">
|
||||||
|
<div className="blog-tags">
|
||||||
|
<h1>Tags</h1>
|
||||||
|
<ul className="tags">
|
||||||
|
{allTags.map((tag) => (
|
||||||
|
<li key={tag.fieldValue}>
|
||||||
|
<Link
|
||||||
|
to={`/tags/${kebabCase(tag.fieldValue)}/`}
|
||||||
|
className="tag"
|
||||||
|
>
|
||||||
|
{tag.fieldValue} ({tag.totalCount})
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TagsPage
|
||||||
|
|
||||||
|
export const pageQuery = graphql`
|
||||||
|
query {
|
||||||
|
allMarkdownRemark(limit: 2000) {
|
||||||
|
group(field: frontmatter___tags) {
|
||||||
|
fieldValue
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
/* Medium Devices, Desktops */
|
||||||
|
@media only screen and (max-width : 992px) {
|
||||||
|
.post {
|
||||||
|
width: 48%;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 0 0.9% 1.5%;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.post-thumbnail {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-content {
|
||||||
|
width: 100%;
|
||||||
|
.post-title {
|
||||||
|
margin: 0 0 5px;
|
||||||
|
a {
|
||||||
|
font-size: 21px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Small Devices, Tablets */
|
||||||
|
@media only screen and (max-width : 768px) {
|
||||||
|
.sidebar {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
box-shadow: 0 1px 1px 0 rgba(31, 35, 46, .15);
|
||||||
|
|
||||||
|
footer {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
.about {
|
||||||
|
text-align: center;
|
||||||
|
max-width: 480px;
|
||||||
|
margin: 10px auto auto;
|
||||||
|
img {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
border-radius: 100%;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-box {
|
||||||
|
padding: 20px 10px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-content-box {
|
||||||
|
padding: 20px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-title, .copyright {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Extra Small Devices, Phones */
|
||||||
|
@media only screen and (max-width : 480px) {
|
||||||
|
.content-box {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-content-box {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post {
|
||||||
|
width: 98%;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 2%;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.post-thumbnail {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-content {
|
||||||
|
width: 100%;
|
||||||
|
.post-title {
|
||||||
|
margin: 0 0 5px;
|
||||||
|
a {
|
||||||
|
font-size: 21px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,447 @@
|
||||||
|
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
|
||||||
|
|
||||||
|
/* Document
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Correct the line height in all browsers.
|
||||||
|
* 2. Prevent adjustments of font size after orientation changes in
|
||||||
|
* IE on Windows Phone and in iOS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
html {
|
||||||
|
line-height: 1.15; /* 1 */
|
||||||
|
-ms-text-size-adjust: 100%; /* 2 */
|
||||||
|
-webkit-text-size-adjust: 100%; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sections
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the margin in all browsers (opinionated).
|
||||||
|
*/
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the correct display in IE 9-.
|
||||||
|
*/
|
||||||
|
|
||||||
|
article,
|
||||||
|
aside,
|
||||||
|
footer,
|
||||||
|
header,
|
||||||
|
nav,
|
||||||
|
section {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Correct the font size and margin on `h1` elements within `section` and
|
||||||
|
* `article` contexts in Chrome, Firefox, and Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2em;
|
||||||
|
margin: 0.67em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Grouping content
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the correct display in IE 9-.
|
||||||
|
* 1. Add the correct display in IE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
figcaption,
|
||||||
|
figure,
|
||||||
|
main { /* 1 */
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the correct margin in IE 8.
|
||||||
|
*/
|
||||||
|
|
||||||
|
figure {
|
||||||
|
margin: 1em 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Add the correct box sizing in Firefox.
|
||||||
|
* 2. Show the overflow in Edge and IE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
hr {
|
||||||
|
box-sizing: content-box; /* 1 */
|
||||||
|
height: 0; /* 1 */
|
||||||
|
overflow: visible; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||||
|
* 2. Correct the odd `em` font sizing in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
pre {
|
||||||
|
font-family: monospace, monospace; /* 1 */
|
||||||
|
font-size: 1em; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Text-level semantics
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Remove the gray background on active links in IE 10.
|
||||||
|
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
|
||||||
|
*/
|
||||||
|
|
||||||
|
a {
|
||||||
|
background-color: transparent; /* 1 */
|
||||||
|
-webkit-text-decoration-skip: objects; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Remove the bottom border in Chrome 57- and Firefox 39-.
|
||||||
|
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
abbr[title] {
|
||||||
|
border-bottom: none; /* 1 */
|
||||||
|
text-decoration: underline; /* 2 */
|
||||||
|
text-decoration: underline dotted; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent the duplicate application of `bolder` by the next rule in Safari 6.
|
||||||
|
*/
|
||||||
|
|
||||||
|
b,
|
||||||
|
strong {
|
||||||
|
font-weight: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the correct font weight in Chrome, Edge, and Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
b,
|
||||||
|
strong {
|
||||||
|
font-weight: bolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||||
|
* 2. Correct the odd `em` font sizing in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
code,
|
||||||
|
kbd,
|
||||||
|
samp {
|
||||||
|
font-family: monospace, monospace; /* 1 */
|
||||||
|
font-size: 1em; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the correct font style in Android 4.3-.
|
||||||
|
*/
|
||||||
|
|
||||||
|
dfn {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the correct background and color in IE 9-.
|
||||||
|
*/
|
||||||
|
|
||||||
|
mark {
|
||||||
|
background-color: #ff0;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the correct font size in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent `sub` and `sup` elements from affecting the line height in
|
||||||
|
* all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sub,
|
||||||
|
sup {
|
||||||
|
font-size: 75%;
|
||||||
|
line-height: 0;
|
||||||
|
position: relative;
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub {
|
||||||
|
bottom: -0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
sup {
|
||||||
|
top: -0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Embedded content
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the correct display in IE 9-.
|
||||||
|
*/
|
||||||
|
|
||||||
|
audio,
|
||||||
|
video {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the correct display in iOS 4-7.
|
||||||
|
*/
|
||||||
|
|
||||||
|
audio:not([controls]) {
|
||||||
|
display: none;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the border on images inside links in IE 10-.
|
||||||
|
*/
|
||||||
|
|
||||||
|
img {
|
||||||
|
border-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide the overflow in IE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
svg:not(:root) {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Forms
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Change the font styles in all browsers (opinionated).
|
||||||
|
* 2. Remove the margin in Firefox and Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
input,
|
||||||
|
optgroup,
|
||||||
|
select,
|
||||||
|
textarea {
|
||||||
|
font-family: sans-serif; /* 1 */
|
||||||
|
font-size: 100%; /* 1 */
|
||||||
|
line-height: 1.15; /* 1 */
|
||||||
|
margin: 0; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the overflow in IE.
|
||||||
|
* 1. Show the overflow in Edge.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
input { /* 1 */
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the inheritance of text transform in Edge, Firefox, and IE.
|
||||||
|
* 1. Remove the inheritance of text transform in Firefox.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
select { /* 1 */
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
|
||||||
|
* controls in Android 4.
|
||||||
|
* 2. Correct the inability to style clickable types in iOS and Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
html [type="button"], /* 1 */
|
||||||
|
[type="reset"],
|
||||||
|
[type="submit"] {
|
||||||
|
-webkit-appearance: button; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the inner border and padding in Firefox.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button::-moz-focus-inner,
|
||||||
|
[type="button"]::-moz-focus-inner,
|
||||||
|
[type="reset"]::-moz-focus-inner,
|
||||||
|
[type="submit"]::-moz-focus-inner {
|
||||||
|
border-style: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore the focus styles unset by the previous rule.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button:-moz-focusring,
|
||||||
|
[type="button"]:-moz-focusring,
|
||||||
|
[type="reset"]:-moz-focusring,
|
||||||
|
[type="submit"]:-moz-focusring {
|
||||||
|
outline: 1px dotted ButtonText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Correct the padding in Firefox.
|
||||||
|
*/
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
padding: 0.35em 0.75em 0.625em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Correct the text wrapping in Edge and IE.
|
||||||
|
* 2. Correct the color inheritance from `fieldset` elements in IE.
|
||||||
|
* 3. Remove the padding so developers are not caught out when they zero out
|
||||||
|
* `fieldset` elements in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
legend {
|
||||||
|
box-sizing: border-box; /* 1 */
|
||||||
|
color: inherit; /* 2 */
|
||||||
|
display: table; /* 1 */
|
||||||
|
max-width: 100%; /* 1 */
|
||||||
|
padding: 0; /* 3 */
|
||||||
|
white-space: normal; /* 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Add the correct display in IE 9-.
|
||||||
|
* 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.
|
||||||
|
*/
|
||||||
|
|
||||||
|
progress {
|
||||||
|
display: inline-block; /* 1 */
|
||||||
|
vertical-align: baseline; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the default vertical scrollbar in IE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Add the correct box sizing in IE 10-.
|
||||||
|
* 2. Remove the padding in IE 10-.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[type="checkbox"],
|
||||||
|
[type="radio"] {
|
||||||
|
box-sizing: border-box; /* 1 */
|
||||||
|
padding: 0; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Correct the cursor style of increment and decrement buttons in Chrome.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[type="number"]::-webkit-inner-spin-button,
|
||||||
|
[type="number"]::-webkit-outer-spin-button {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Correct the odd appearance in Chrome and Safari.
|
||||||
|
* 2. Correct the outline style in Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[type="search"] {
|
||||||
|
-webkit-appearance: textfield; /* 1 */
|
||||||
|
outline-offset: -2px; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the inner padding and cancel buttons in Chrome and Safari on macOS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[type="search"]::-webkit-search-cancel-button,
|
||||||
|
[type="search"]::-webkit-search-decoration {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Correct the inability to style clickable types in iOS and Safari.
|
||||||
|
* 2. Change font properties to `inherit` in Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
::-webkit-file-upload-button {
|
||||||
|
-webkit-appearance: button; /* 1 */
|
||||||
|
font: inherit; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Interactive
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add the correct display in IE 9-.
|
||||||
|
* 1. Add the correct display in Edge, IE, and Firefox.
|
||||||
|
*/
|
||||||
|
|
||||||
|
details, /* 1 */
|
||||||
|
menu {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add the correct display in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
summary {
|
||||||
|
display: list-item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scripting
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the correct display in IE 9-.
|
||||||
|
*/
|
||||||
|
|
||||||
|
canvas {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the correct display in IE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
template {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hidden
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the correct display in IE 10-.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[hidden] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
.highlight {background-color: #faf9f9; border-radius: 3px; margin: 0;}
|
||||||
|
.highlighter-rouge {color: #ce887b; font-weight: 400; border: 1px solid #607D8B; border-radius: 3px; padding: 0.1rem 0.5rem;}
|
||||||
|
.highlight .hll { background-color: #ffc; }
|
||||||
|
.highlight .c { color: #999; } /* Comment */
|
||||||
|
.highlight .err { color: #a00; background-color: #faa; } /* Error */
|
||||||
|
.highlight .k { color: #069; } /* Keyword */
|
||||||
|
.highlight .o { color: #555; } /* Operator */
|
||||||
|
.highlight .cm { color: #09f; font-style: italic; } /* Comment.Multiline */
|
||||||
|
.highlight .cp { color: #099; } /* Comment.Preproc */
|
||||||
|
.highlight .c1 { color: #999; } /* Comment.Single */
|
||||||
|
.highlight .cs { color: #999; } /* Comment.Special */
|
||||||
|
.highlight .gd { background-color: #fcc; border: 1px solid #c00; } /* Generic.Deleted */
|
||||||
|
.highlight .ge { font-style: italic; } /* Generic.Emph */
|
||||||
|
.highlight .gr { color: #f00; } /* Generic.Error */
|
||||||
|
.highlight .gh { color: #030; } /* Generic.Heading */
|
||||||
|
.highlight .gi { background-color: #cfc; border: 1px solid #0c0; } /* Generic.Inserted */
|
||||||
|
.highlight .go { color: #aaa; } /* Generic.Output */
|
||||||
|
.highlight .gp { color: #009; } /* Generic.Prompt */
|
||||||
|
.highlight .gs { } /* Generic.Strong */
|
||||||
|
.highlight .gu { color: #030; } /* Generic.Subheading */
|
||||||
|
.highlight .gt { color: #9c6; } /* Generic.Traceback */
|
||||||
|
.highlight .kc { color: #069; } /* Keyword.Constant */
|
||||||
|
.highlight .kd { color: #069; } /* Keyword.Declaration */
|
||||||
|
.highlight .kn { color: #069; } /* Keyword.Namespace */
|
||||||
|
.highlight .kp { color: #069; } /* Keyword.Pseudo */
|
||||||
|
.highlight .kr { color: #069; } /* Keyword.Reserved */
|
||||||
|
.highlight .kt { color: #078; } /* Keyword.Type */
|
||||||
|
.highlight .m { color: #f60; } /* Literal.Number */
|
||||||
|
.highlight .s { color: #d44950; } /* Literal.String */
|
||||||
|
.highlight .na { color: #4f9fcf; } /* Name.Attribute */
|
||||||
|
.highlight .nb { color: #366; } /* Name.Builtin */
|
||||||
|
.highlight .nc { color: #0a8; } /* Name.Class */
|
||||||
|
.highlight .no { color: #360; } /* Name.Constant */
|
||||||
|
.highlight .nd { color: #99f; } /* Name.Decorator */
|
||||||
|
.highlight .ni { color: #999; } /* Name.Entity */
|
||||||
|
.highlight .ne { color: #c00; } /* Name.Exception */
|
||||||
|
.highlight .nf { color: #c0f; } /* Name.Function */
|
||||||
|
.highlight .nl { color: #99f; } /* Name.Label */
|
||||||
|
.highlight .nn { color: #0cf; } /* Name.Namespace */
|
||||||
|
.highlight .nt { color: #2f6f9f; } /* Name.Tag */
|
||||||
|
.highlight .nv { color: #033; } /* Name.Variable */
|
||||||
|
.highlight .ow { color: #000; } /* Operator.Word */
|
||||||
|
.highlight .w { color: #bbb; } /* Text.Whitespace */
|
||||||
|
.highlight .mf { color: #f60; } /* Literal.Number.Float */
|
||||||
|
.highlight .mh { color: #f60; } /* Literal.Number.Hex */
|
||||||
|
.highlight .mi { color: #f60; } /* Literal.Number.Integer */
|
||||||
|
.highlight .mo { color: #f60; } /* Literal.Number.Oct */
|
||||||
|
.highlight .sb { color: #c30; } /* Literal.String.Backtick */
|
||||||
|
.highlight .sc { color: #c30; } /* Literal.String.Char */
|
||||||
|
.highlight .sd { color: #c30; font-style: italic; } /* Literal.String.Doc */
|
||||||
|
.highlight .s2 { color: #c30; } /* Literal.String.Double */
|
||||||
|
.highlight .se { color: #c30; } /* Literal.String.Escape */
|
||||||
|
.highlight .sh { color: #c30; } /* Literal.String.Heredoc */
|
||||||
|
.highlight .si { color: #a00; } /* Literal.String.Interpol */
|
||||||
|
.highlight .sx { color: #c30; } /* Literal.String.Other */
|
||||||
|
.highlight .sr { color: #3aa; } /* Literal.String.Regex */
|
||||||
|
.highlight .s1 { color: #c30; } /* Literal.String.Single */
|
||||||
|
.highlight .ss { color: #fc3; } /* Literal.String.Symbol */
|
||||||
|
.highlight .bp { color: #366; } /* Name.Builtin.Pseudo */
|
||||||
|
.highlight .vc { color: #033; } /* Name.Variable.Class */
|
||||||
|
.highlight .vg { color: #033; } /* Name.Variable.Global */
|
||||||
|
.highlight .vi { color: #033; } /* Name.Variable.Instance */
|
||||||
|
.highlight .il { color: #f60; } /* Literal.Number.Integer.Long */
|
||||||
|
|
||||||
|
.css .o,
|
||||||
|
.css .o + .nt,
|
||||||
|
.css .nt + .nt { color: #999; }
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
$body-color: #515151;
|
||||||
|
$white: #ffffff;
|
||||||
|
$lightgray: #fafafa;
|
||||||
|
$gray: #ecf0f1;
|
||||||
|
$dark-gray: #a0a0a0;
|
||||||
|
$dark-blue: #263959;
|
||||||
|
$dark: #333030;
|
||||||
|
After Width: | Height: | Size: 434 KiB |
|
|
@ -0,0 +1,149 @@
|
||||||
|
@import 'normalize';
|
||||||
|
@import 'syntax';
|
||||||
|
@import 'variables';
|
||||||
|
|
||||||
|
*, *::after, *::before {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Lato', sans-serif;
|
||||||
|
color: $body-color;
|
||||||
|
background-color: #fbfbfb;
|
||||||
|
margin: 0;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
vertical-align: middle;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
img + em {
|
||||||
|
text-align: center;
|
||||||
|
display: block;
|
||||||
|
margin-top: 10px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote {
|
||||||
|
border-left: 5px solid #000;
|
||||||
|
padding-left: 1.1rem;
|
||||||
|
margin-left: 1rem;
|
||||||
|
font-style: italic;
|
||||||
|
color: #ada8a8;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
padding: 1rem 2rem;
|
||||||
|
overflow: auto;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-all;
|
||||||
|
|
||||||
|
code {
|
||||||
|
border: 0;
|
||||||
|
padding-right: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
overflow: auto;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
background-color: #eee;
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
table td, table.blueTable th {
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
padding: 3px 2px;
|
||||||
|
}
|
||||||
|
table tbody td {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
table tr:nth-child(even) {
|
||||||
|
background: #adbecc;
|
||||||
|
}
|
||||||
|
table thead {
|
||||||
|
background: #a9c4d1;
|
||||||
|
background: linear-gradient(to bottom, #bed3dc 0%, #b1cad5 66%, #A9C4D1 100%);
|
||||||
|
border-bottom: 1px solid #8c8c8c;
|
||||||
|
}
|
||||||
|
table thead th {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #fff;
|
||||||
|
border-left: 1px solid #d0e4f5;
|
||||||
|
}
|
||||||
|
table thead th:first-child {
|
||||||
|
border-left: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
table tfoot {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #fff;
|
||||||
|
background: #d0e4f5;
|
||||||
|
background: linear-gradient(to bottom, #dcebf7 0%, #d4e6f6 66%, #D0E4F5 100%);
|
||||||
|
border-top: 2px solid #444;
|
||||||
|
}
|
||||||
|
table tfoot td {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
max-width: 1250px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post, .article-page {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-moz-selection {
|
||||||
|
background: rgba(38, 57, 89, 0.8);
|
||||||
|
color: $white;
|
||||||
|
}
|
||||||
|
|
||||||
|
::selection {
|
||||||
|
background: rgba(38, 57, 89, 0.8);
|
||||||
|
color: $white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clearfix::before, .clearfix::after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clearfix::after {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* - - - - - - - - - - Home Page Styles - - - - - - - - - - */
|
||||||
|
@import 'parts/home-page';
|
||||||
|
|
||||||
|
/* - - - - - - - - - - Post Page Styles - - - - - - - - - - */
|
||||||
|
@import 'parts/post-page';
|
||||||
|
|
||||||
|
/* - - - - - - - - - - Tag Styles - - - - - - - - - - */
|
||||||
|
@import 'parts/tag';
|
||||||
|
|
||||||
|
/* - - - - - - - - - - Media Styles - - - - - - - - - - */
|
||||||
|
@import 'media';
|
||||||
|
|
@ -0,0 +1,197 @@
|
||||||
|
.sidebar {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 240px;
|
||||||
|
height: 100%;
|
||||||
|
padding: 20px 10px;
|
||||||
|
background-color: $white;
|
||||||
|
}
|
||||||
|
.about {
|
||||||
|
margin: 0 0 40px;
|
||||||
|
text-align: center;
|
||||||
|
.cover-author-image {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
margin: 0 auto 10px;
|
||||||
|
border-radius: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: $dark;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 50%;
|
||||||
|
transition: transform 0.35s;
|
||||||
|
&:hover {
|
||||||
|
transform: scale3d(0.90,0.90,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.author-name {
|
||||||
|
font-family: 'PT Serif', serif;
|
||||||
|
margin: 0 0 10px;
|
||||||
|
position: relative;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
font-size: 16px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: $dark;
|
||||||
|
font-weight: 700;
|
||||||
|
&::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
bottom: 0;
|
||||||
|
display: block;
|
||||||
|
width: 7px;
|
||||||
|
height: 7px;
|
||||||
|
border-radius: 100%;
|
||||||
|
background-color: $body-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
font-size: 16px;
|
||||||
|
margin: 0 0 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-box {
|
||||||
|
padding: 20px 20px 20px 260px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact {
|
||||||
|
.contact-title {
|
||||||
|
position: relative;
|
||||||
|
color: $dark;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 12px;
|
||||||
|
margin: 0 0 5px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
text-align: center;
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
height: 2px;
|
||||||
|
width: calc(50% - 48px);
|
||||||
|
transform: translateY(-50%);
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 0;
|
||||||
|
background-color: $body-color;
|
||||||
|
}
|
||||||
|
&::after {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
height: 2px;
|
||||||
|
width: calc(50% - 48px);
|
||||||
|
transform: translateY(-50%);
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
right: 0;
|
||||||
|
background-color: $body-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
text-align: center;
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 10px;
|
||||||
|
&:first-child {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: $body-color;
|
||||||
|
display: block;
|
||||||
|
padding: 5px;
|
||||||
|
font-size: 18px;
|
||||||
|
transition: all 350ms cubic-bezier(0.13, 0.43, 0.54, 1.82);
|
||||||
|
&:hover {
|
||||||
|
color: $dark;
|
||||||
|
transform: scale(1.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
.copyright {
|
||||||
|
font-size: 14px;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.post {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: stretch;
|
||||||
|
min-height: 11rem;
|
||||||
|
border-radius: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: all .3s ease;
|
||||||
|
box-shadow: 0 1px 1px 0 rgba(31, 35, 46, .15);
|
||||||
|
&:hover {
|
||||||
|
transform: translate(0px, -2px);
|
||||||
|
box-shadow: 0 15px 45px -10px rgba(10, 16, 34, .2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-thumbnail {
|
||||||
|
width: 30%;
|
||||||
|
max-width: 100%;
|
||||||
|
min-height: 11rem;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: 50% 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-content {
|
||||||
|
padding: 1rem;
|
||||||
|
width: 70%;
|
||||||
|
.post-date,
|
||||||
|
.post-words {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.post-title {
|
||||||
|
margin: 0 0 10px;
|
||||||
|
font-size: 30px;
|
||||||
|
font-weight: 400;
|
||||||
|
a {
|
||||||
|
font-family: 'PT Serif', serif;
|
||||||
|
text-decoration: none;
|
||||||
|
color: $dark-blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
a.older-posts, a.newer-posts {
|
||||||
|
font-size: 18px;
|
||||||
|
display: inline-block;
|
||||||
|
color: $body-color;
|
||||||
|
transition: transform .2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.older-posts:hover {
|
||||||
|
transform: translateX(5px);
|
||||||
|
}
|
||||||
|
|
||||||
|
a.newer-posts:hover {
|
||||||
|
transform: translateX(-5px);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
.post-content-box {
|
||||||
|
padding: 20px 20px 20px 260px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrap-content {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-page {
|
||||||
|
text-align: center;
|
||||||
|
margin: 10px 0;
|
||||||
|
.page-title {
|
||||||
|
font-weight: 400;
|
||||||
|
margin: 0 0 10px;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
.page-date {
|
||||||
|
color: $dark-gray;
|
||||||
|
font-weight: 300;
|
||||||
|
font-size: 12px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-cover-image {
|
||||||
|
position: relative;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
max-height: 500px;
|
||||||
|
background-color: $lightgray;
|
||||||
|
overflow: hidden;
|
||||||
|
figure {
|
||||||
|
position: relative;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
figcaption {
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
right: 20px;
|
||||||
|
padding-left: 20px;
|
||||||
|
color: rgba(255, 255, 255, 0.7);
|
||||||
|
text-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
|
||||||
|
font-weight: 700;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
.page-image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
margin: 30px 0 ;
|
||||||
|
border-bottom: 1px solid $dark-gray;
|
||||||
|
.page-share {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
text-align: left;
|
||||||
|
a {
|
||||||
|
display: inline-block;
|
||||||
|
text-decoration: none;
|
||||||
|
background-color: $lightgray;
|
||||||
|
border: 1px solid $gray;
|
||||||
|
padding: 5px 10px;
|
||||||
|
margin-left: 5px;
|
||||||
|
color: $dark-blue;
|
||||||
|
font-size: 12px;
|
||||||
|
transition: background-color .3s;
|
||||||
|
&:first-child {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
background-color: $gray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.page-tag {
|
||||||
|
span {
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 10px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
margin-left: 5px;
|
||||||
|
color: $dark-blue;
|
||||||
|
text-transform: uppercase;
|
||||||
|
border: 1px solid $dark-blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
.blog-tags {
|
||||||
|
width: 100%;
|
||||||
|
background-color: $white;
|
||||||
|
padding: 0 20px 20px;
|
||||||
|
h1 {
|
||||||
|
font-size: 30px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 1.3;
|
||||||
|
color: $dark-blue;
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
color: $dark-blue;
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: $dark-blue;
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags {
|
||||||
|
margin: 0;
|
||||||
|
padding: 10px;
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 5px;
|
||||||
|
list-style: none;
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: $dark-blue;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 5px 10px;
|
||||||
|
border: 1px solid $gray;
|
||||||
|
background-color: $lightgray;
|
||||||
|
transition: all 0.3s;
|
||||||
|
&:hover {
|
||||||
|
background-color: $gray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-list {
|
||||||
|
list-style-type: none;
|
||||||
|
li {
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: $dark-blue;
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-tag {
|
||||||
|
span {
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: $dark-blue;
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
import React from 'react'
|
||||||
|
import { Link, graphql } from 'gatsby'
|
||||||
|
import { GatsbyImage } from 'gatsby-plugin-image'
|
||||||
|
|
||||||
|
import DefaultLayout from '../components/layout'
|
||||||
|
import SEO from '../components/seo'
|
||||||
|
|
||||||
|
class BlogIndex extends React.Component {
|
||||||
|
render() {
|
||||||
|
const { data } = this.props
|
||||||
|
const siteTitle = data.site.siteMetadata.title
|
||||||
|
const posts = data.allMarkdownRemark.edges
|
||||||
|
const { currentPage, numPages } = this.props.pageContext
|
||||||
|
const isFirst = currentPage === 1
|
||||||
|
const isLast = currentPage === numPages
|
||||||
|
const prevPage = currentPage - 1 === 1 ? '/' : `../${currentPage - 1}`
|
||||||
|
const nextPage = `../${currentPage + 1}`
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DefaultLayout>
|
||||||
|
<SEO
|
||||||
|
title={siteTitle}
|
||||||
|
keywords={[`blog`, `gatsby`, `javascript`, `react`]}
|
||||||
|
/>
|
||||||
|
<div className="content-box clearfix">
|
||||||
|
{posts.map(({ node }) => {
|
||||||
|
return (
|
||||||
|
<article className="post" key={node.fields.slug}>
|
||||||
|
{node.frontmatter.img &&
|
||||||
|
node.frontmatter.img.childImageSharp &&
|
||||||
|
node.frontmatter.img.childImageSharp.gatsbyImageData && (
|
||||||
|
<Link to={node.fields.slug} className="post-thumbnail">
|
||||||
|
<GatsbyImage
|
||||||
|
image={
|
||||||
|
node.frontmatter.img.childImageSharp.gatsbyImageData
|
||||||
|
}
|
||||||
|
className="page-image"
|
||||||
|
key={
|
||||||
|
node.frontmatter.img.childImageSharp.gatsbyImageData
|
||||||
|
.src
|
||||||
|
}
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
<div className="post-content">
|
||||||
|
<h2 className="post-title">
|
||||||
|
<Link to={node.fields.slug}>{node.frontmatter.title}</Link>
|
||||||
|
</h2>
|
||||||
|
<p>{node.excerpt}</p>
|
||||||
|
<span className="post-date">
|
||||||
|
{node.frontmatter.date} —
|
||||||
|
</span>
|
||||||
|
<span className="post-words">
|
||||||
|
{node.timeToRead} minute read
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
<div className="container">
|
||||||
|
<nav className="pagination" role="navigation">
|
||||||
|
<ul>
|
||||||
|
{!isFirst && (
|
||||||
|
<p>
|
||||||
|
<Link to={prevPage} rel="prev" className="newer-posts">
|
||||||
|
← Previous Page
|
||||||
|
</Link>
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
<p>
|
||||||
|
<span className="page-number">
|
||||||
|
Page {currentPage} of {numPages}
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
{!isLast && (
|
||||||
|
<p>
|
||||||
|
<Link to={nextPage} rel="next" className="older-posts">
|
||||||
|
Next Page →
|
||||||
|
</Link>
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</DefaultLayout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BlogIndex
|
||||||
|
|
||||||
|
export const pageQuery = graphql`
|
||||||
|
query blogPageQuery($skip: Int!, $limit: Int!) {
|
||||||
|
site {
|
||||||
|
siteMetadata {
|
||||||
|
title
|
||||||
|
}
|
||||||
|
}
|
||||||
|
allMarkdownRemark(
|
||||||
|
sort: { fields: [frontmatter___date], order: DESC }
|
||||||
|
limit: $limit
|
||||||
|
skip: $skip
|
||||||
|
) {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
excerpt
|
||||||
|
fields {
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
timeToRead
|
||||||
|
frontmatter {
|
||||||
|
date(formatString: "YYYY, MMM DD")
|
||||||
|
title
|
||||||
|
img {
|
||||||
|
childImageSharp {
|
||||||
|
gatsbyImageData(
|
||||||
|
placeholder: BLURRED
|
||||||
|
layout: FULL_WIDTH
|
||||||
|
formats: [AUTO, AVIF, WEBP]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
import React from 'react'
|
||||||
|
import { Link, graphql } from 'gatsby'
|
||||||
|
import { kebabCase } from 'lodash'
|
||||||
|
import { GatsbyImage } from 'gatsby-plugin-image'
|
||||||
|
|
||||||
|
import DefaultLayout from '../components/layout'
|
||||||
|
import SEO from '../components/seo'
|
||||||
|
|
||||||
|
import 'katex/dist/katex.min.css'
|
||||||
|
|
||||||
|
class BlogPostTemplate extends React.Component {
|
||||||
|
render() {
|
||||||
|
const post = this.props.data.markdownRemark
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DefaultLayout>
|
||||||
|
<SEO title={post.frontmatter.title} description={post.excerpt} />
|
||||||
|
<div className="clearfix post-content-box">
|
||||||
|
<article className="article-page">
|
||||||
|
<div className="page-content">
|
||||||
|
{post.frontmatter.img && (
|
||||||
|
<div className="page-cover-image">
|
||||||
|
<figure>
|
||||||
|
<GatsbyImage
|
||||||
|
image={
|
||||||
|
post.frontmatter.img.childImageSharp.gatsbyImageData
|
||||||
|
}
|
||||||
|
className="page-image"
|
||||||
|
key={
|
||||||
|
post.frontmatter.img.childImageSharp.gatsbyImageData.src
|
||||||
|
}
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
</figure>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="wrap-content">
|
||||||
|
<header className="header-page">
|
||||||
|
<h1 className="page-title">{post.frontmatter.title}</h1>
|
||||||
|
<div className="page-date">
|
||||||
|
<span>{post.frontmatter.date}</span>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div dangerouslySetInnerHTML={{ __html: post.html }} />
|
||||||
|
<div className="page-footer">
|
||||||
|
<div className="page-tag">
|
||||||
|
{post.frontmatter.tags &&
|
||||||
|
post.frontmatter.tags.map((tag) => (
|
||||||
|
<span key={tag}>
|
||||||
|
<Link className="tag" to={`/tags/${kebabCase(tag)}/`}>
|
||||||
|
# {tag}
|
||||||
|
</Link>
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</DefaultLayout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BlogPostTemplate
|
||||||
|
|
||||||
|
export const pageQuery = graphql`
|
||||||
|
query BlogPostBySlug($slug: String!) {
|
||||||
|
site {
|
||||||
|
siteMetadata {
|
||||||
|
title
|
||||||
|
author
|
||||||
|
}
|
||||||
|
}
|
||||||
|
markdownRemark(fields: { slug: { eq: $slug } }) {
|
||||||
|
id
|
||||||
|
excerpt(pruneLength: 160)
|
||||||
|
html
|
||||||
|
frontmatter {
|
||||||
|
title
|
||||||
|
date(formatString: "YYYY, MMM DD")
|
||||||
|
tags
|
||||||
|
img {
|
||||||
|
childImageSharp {
|
||||||
|
gatsbyImageData(placeholder: BLURRED, layout: FULL_WIDTH, formats: [AUTO, AVIF, WEBP])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
import React from 'react'
|
||||||
|
import { Link, graphql } from 'gatsby'
|
||||||
|
import Layout from '../components/layout'
|
||||||
|
|
||||||
|
const Tags = ({ pageContext, data }) => {
|
||||||
|
const { tag } = pageContext
|
||||||
|
const { edges, totalCount } = data.allMarkdownRemark
|
||||||
|
const tagHeader = `${totalCount} post${
|
||||||
|
totalCount === 1 ? '' : 's'
|
||||||
|
} tagged with "${tag}"`
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<div className="content-box clearfix">
|
||||||
|
<div className="blog-tags">
|
||||||
|
<h1>{tagHeader}</h1>
|
||||||
|
<ul className="tag-list">
|
||||||
|
{edges.map(({ node }) => {
|
||||||
|
const { title, date } = node.frontmatter
|
||||||
|
const { slug } = node.fields
|
||||||
|
return (
|
||||||
|
<li key={slug}>
|
||||||
|
<Link to={slug}>{title}</Link>
|
||||||
|
<small> | {date}</small>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
<span>
|
||||||
|
<Link to="/tags">← All tags</Link>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Tags
|
||||||
|
|
||||||
|
export const pageQuery = graphql`
|
||||||
|
query($tag: String) {
|
||||||
|
allMarkdownRemark(
|
||||||
|
limit: 2000
|
||||||
|
sort: { fields: [frontmatter___date], order: DESC }
|
||||||
|
filter: { frontmatter: { tags: { in: [$tag] } } }
|
||||||
|
) {
|
||||||
|
totalCount
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
fields {
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
frontmatter {
|
||||||
|
title
|
||||||
|
date(formatString: "MMMM DD, YYYY")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
backend:
|
||||||
|
name: gitea
|
||||||
|
repo: SMagic/blog # Path to your Gitea repository
|
||||||
|
app_id: e623c862-2207-4b5d-8723-e46438b5f762 # The Client ID provided by Gitea
|
||||||
|
api_root: https://gitea.smagic.top/api/v1 # API URL of your Gitea instance
|
||||||
|
base_url: https://gitea.smagic.top # Root URL of your Gitea instance
|
||||||
|
auth_endpoint: https://gitea.smagic.top/login/oauth/authorize
|
||||||
|
# optional, defaults to master
|
||||||
|
branch: main
|
||||||
|
# This line should *not* be indented
|
||||||
|
|
||||||
|
media_folder: static/img
|
||||||
|
public_folder: /img
|
||||||
|
|
||||||
|
collections:
|
||||||
|
- name: 'blog'
|
||||||
|
label: 'Blog'
|
||||||
|
folder: 'content/blog'
|
||||||
|
create: true
|
||||||
|
slug: 'index'
|
||||||
|
media_folder: ''
|
||||||
|
public_folder: ''
|
||||||
|
path: '{{title}}/index'
|
||||||
|
editor:
|
||||||
|
preview: false
|
||||||
|
fields:
|
||||||
|
- { label: 'Title', name: 'title', widget: 'string' }
|
||||||
|
- { label: 'Publish Date', name: 'date', widget: 'datetime' }
|
||||||
|
- { label: 'Description', name: 'description', widget: 'string' }
|
||||||
|
- { label: 'Body', name: 'body', widget: 'markdown' }
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<meta name="robots" content="noindex" />
|
||||||
|
<title>Content Manager</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- Include the script that builds the page and powers Decap CMS -->
|
||||||
|
<script src="https://unpkg.com/decap-cms@^3.1.10/dist/decap-cms.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
After Width: | Height: | Size: 198 B |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
|
@ -0,0 +1,2 @@
|
||||||
|
User-agent: *
|
||||||
|
Disallow:
|
||||||