✨ revamp
5
.gitignore
vendored
@@ -1,5 +0,0 @@
|
||||
*.gem
|
||||
.bundle
|
||||
.sass-cache
|
||||
_site
|
||||
Gemfile.lock
|
||||
BIN
.sass-cache/86619ff212e9aa14fb08acc717900e7d9b190c3d/_base.scssc
Normal file
BIN
.sass-cache/86619ff212e9aa14fb08acc717900e7d9b190c3d/_dark.scssc
Normal file
BIN
.sass-cache/86619ff212e9aa14fb08acc717900e7d9b190c3d/_post.scssc
Normal file
BIN
.sass-cache/a28b70ffa7da60916248ddaa0e5956aa0b4fa593/_base.scssc
Normal file
BIN
.sass-cache/a28b70ffa7da60916248ddaa0e5956aa0b4fa593/_dark.scssc
Normal file
BIN
.sass-cache/a28b70ffa7da60916248ddaa0e5956aa0b4fa593/_post.scssc
Normal file
BIN
.sass-cache/d8f8e2d7794ba233dc975c25d0b156d5405bb87a/main.scssc
Normal file
36
Gemfile
@@ -1,4 +1,34 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
gemspec
|
||||
|
||||
# Hello! This is where you manage which Jekyll version is used to run.
|
||||
# When you want to use a different version, change it below, save the
|
||||
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
|
||||
#
|
||||
# bundle exec jekyll serve
|
||||
#
|
||||
# This will help ensure the proper Jekyll version is running.
|
||||
# Happy Jekylling!
|
||||
gem "jekyll", "~> 3.8.3"
|
||||
|
||||
# This is the default theme for new Jekyll sites. You may change this to anything you like.
|
||||
# gem "minima", "~> 2.0"
|
||||
|
||||
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
|
||||
# uncomment the line below. To upgrade, run `bundle update github-pages`.
|
||||
# gem "github-pages", group: :jekyll_plugins
|
||||
|
||||
# If you have any plugins, put them here!
|
||||
group :jekyll_plugins do
|
||||
gem 'jekyll-feed', '~> 0.11.0'
|
||||
gem 'jekyll-sitemap'
|
||||
gem 'jekyll-sass-converter', '~> 1.5', '>= 1.5.2'
|
||||
gem 'jekyll-compose'
|
||||
gem 'jekyll-postfiles', '~> 3.0'
|
||||
gem 'rouge', '3.3.0'
|
||||
end
|
||||
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
# gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||
|
||||
# Performance-booster for watching directories on Windows
|
||||
# gem "wdm", "~> 0.1.0" if Gem.win_platform?
|
||||
|
||||
75
Gemfile.lock
Normal file
@@ -0,0 +1,75 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
colorator (1.1.0)
|
||||
concurrent-ruby (1.1.5)
|
||||
em-websocket (0.5.1)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
eventmachine (1.2.7)
|
||||
ffi (1.12.1)
|
||||
forwardable-extended (2.6.0)
|
||||
http_parser.rb (0.6.0)
|
||||
i18n (0.9.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jekyll (3.8.6)
|
||||
addressable (~> 2.4)
|
||||
colorator (~> 1.0)
|
||||
em-websocket (~> 0.5)
|
||||
i18n (~> 0.7)
|
||||
jekyll-sass-converter (~> 1.0)
|
||||
jekyll-watch (~> 2.0)
|
||||
kramdown (~> 1.14)
|
||||
liquid (~> 4.0)
|
||||
mercenary (~> 0.3.3)
|
||||
pathutil (~> 0.9)
|
||||
rouge (>= 1.7, < 4)
|
||||
safe_yaml (~> 1.0)
|
||||
jekyll-compose (0.12.0)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-feed (0.11.0)
|
||||
jekyll (~> 3.3)
|
||||
jekyll-postfiles (3.1.0)
|
||||
jekyll (>= 3.8.6, < 5)
|
||||
jekyll-sass-converter (1.5.2)
|
||||
sass (~> 3.4)
|
||||
jekyll-sitemap (1.4.0)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-watch (2.2.1)
|
||||
listen (~> 3.0)
|
||||
kramdown (1.17.0)
|
||||
liquid (4.0.3)
|
||||
listen (3.2.1)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
mercenary (0.3.6)
|
||||
pathutil (0.16.2)
|
||||
forwardable-extended (~> 2.6)
|
||||
public_suffix (4.0.3)
|
||||
rb-fsevent (0.10.3)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rouge (3.3.0)
|
||||
safe_yaml (1.0.5)
|
||||
sass (3.7.4)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
jekyll (~> 3.8.3)
|
||||
jekyll-compose
|
||||
jekyll-feed (~> 0.11.0)
|
||||
jekyll-postfiles (~> 3.0)
|
||||
jekyll-sass-converter (~> 1.5, >= 1.5.2)
|
||||
jekyll-sitemap
|
||||
rouge (= 3.3.0)
|
||||
|
||||
BUNDLED WITH
|
||||
2.0.2
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 piharpi
|
||||
Copyright (c) 2019 Mahendrata Harpi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
50
README.md
@@ -1,52 +1,24 @@
|
||||
# bangsring
|
||||
|
||||
Welcome to your new Jekyll theme! In this directory, you'll find the files you need to be able to package up your theme into a gem. Put your layouts in `_layouts`, your includes in `_includes`, your sass files in `_sass` and any other assets in `assets`.
|
||||
|
||||
To experiment with this code, add some sample content and run `bundle exec jekyll serve` – this directory is setup just like a Jekyll site!
|
||||
|
||||
TODO: Delete this and the text above, and describe your gem
|
||||
# Klisé
|
||||
|
||||
Klisé is minimalist Jekyll theme for running a personal site and blog running on Jekyll, Ruby, Netlify, Now.sh.
|
||||
|
||||
## Installation
|
||||
|
||||
Add this line to your Jekyll site's `Gemfile`:
|
||||
Run local server:
|
||||
|
||||
```ruby
|
||||
gem "bangsring"
|
||||
```bash
|
||||
git clone https://github.com/piharpi/jekyll-klise.git
|
||||
cd jekyll-klise
|
||||
bundle install
|
||||
bundel exec jekyll serve
|
||||
```
|
||||
|
||||
And add this line to your Jekyll site's `_config.yml`:
|
||||
|
||||
```yaml
|
||||
theme: bangsring
|
||||
```
|
||||
|
||||
And then execute:
|
||||
|
||||
$ bundle
|
||||
|
||||
Or install it yourself as:
|
||||
|
||||
$ gem install bangsring
|
||||
|
||||
## Usage
|
||||
|
||||
TODO: Write usage instructions here. Describe your available layouts, includes, sass and/or assets.
|
||||
Navigate to `localhost:4000`.
|
||||
|
||||
## Contributing
|
||||
|
||||
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/hello. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
||||
|
||||
## Development
|
||||
|
||||
To set up your environment to develop this theme, run `bundle install`.
|
||||
|
||||
Your theme is setup just like a normal Jekyll site! To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`. This starts a Jekyll server using your theme. Add pages, documents, data, etc. like normal to test your theme's contents. As you make modifications to your theme and to your content, your site will regenerate and you should see the changes in the browser after a refresh, just like normal.
|
||||
|
||||
When your theme is released, only the files in `_layouts`, `_includes`, `_sass` and `assets` tracked with Git will be bundled.
|
||||
To add a custom directory to your theme-gem, please edit the regexp in `bangsring.gemspec` accordingly.
|
||||
If you see any typos or formatting errors in a post, or any other issue that needs to be addressed, please do not hesitate to open a pull request and fix it!
|
||||
|
||||
## License
|
||||
|
||||
The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
||||
|
||||
This project is open source and available under the [MIT License](LICENSE).
|
||||
|
||||
35
_config.yml
@@ -1,25 +1,30 @@
|
||||
# Site settings
|
||||
title: Mahendrata Harpi 🇮🇩
|
||||
title: Klise Theme
|
||||
description: >-
|
||||
this blog is place where i'm writing about web technology
|
||||
what i like and as journal for documentation things what i learned, meet me <a href="https://github.com/piharpi" target="_blank">@github</a>.
|
||||
He's writing in Bahasa about web technology and experience as a journal
|
||||
for documentation things that he learned, meet him <a href="https://github.com/piharpi" target="_blank" rel="noopener">@github</a>.
|
||||
lang: en-US
|
||||
timezone: Asia/Jakarta
|
||||
icon: "favicon.ico"
|
||||
image: assets/img/ogp.png # This image used for Open Graph more info https://ogp.me/
|
||||
repo: https://github.com/piharpi/mahendrata.now.sh
|
||||
mode: dark # default theme "dark" | "light"
|
||||
|
||||
# User settings
|
||||
# Profile settings
|
||||
author:
|
||||
name: Mahendrata Harpi
|
||||
username: piharpi
|
||||
email: justharpi@gmail.com
|
||||
avatar: "/assets/img/avatar.jpg"
|
||||
name: Klisé Theme
|
||||
bio: >-
|
||||
He's writing in Bahasa about web technology and experience as a journal
|
||||
for documentation things that he learned, meet him <a href="https://github.com/piharpi/jekyll-klise" target="_blank" rel="noopener">@github</a>.
|
||||
username: username
|
||||
email: your-email@email.com
|
||||
avatar: /assets/img/avatar.jpg
|
||||
|
||||
# Url settings
|
||||
url: https://piharpi.com
|
||||
baseurl: ""
|
||||
permalink: blog/:categories/:title/
|
||||
google_analytics: UA-105586262-1
|
||||
fb_appid: ""
|
||||
url: "https://klise.now.sh"
|
||||
baseurl:
|
||||
permalink: /:title/
|
||||
google_analytics:
|
||||
fb_appid:
|
||||
|
||||
# Collection setting
|
||||
collections:
|
||||
@@ -67,7 +72,6 @@ exclude:
|
||||
- CHANGELOG.md
|
||||
- README.md
|
||||
- node_modules
|
||||
- bangsring.gemspec
|
||||
- CODE_OF_CONDUCT.md
|
||||
|
||||
# Plugins
|
||||
@@ -75,3 +79,4 @@ plugins:
|
||||
- jekyll-feed
|
||||
- jekyll-sass-converter
|
||||
- jekyll-sitemap
|
||||
- jekyll-postfiles
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
- title: Home
|
||||
- title: home
|
||||
url: /
|
||||
external: false
|
||||
|
||||
- title: About
|
||||
- title: about
|
||||
url: /about/
|
||||
external: false
|
||||
|
||||
- title: RSS
|
||||
url: /feed.xml/
|
||||
- title: notes
|
||||
url: /notes/
|
||||
external: false # set true if you using external link, see bellow
|
||||
|
||||
# Example:
|
||||
# - title: github
|
||||
# url: https://github.com/piharpi/jekyll-klise
|
||||
# external: true
|
||||
|
||||
105
_includes/anchor_headings.html
Normal file
@@ -0,0 +1,105 @@
|
||||
{% capture headingsWorkspace %}
|
||||
{% comment %}
|
||||
Version 1.0.4
|
||||
https://github.com/allejo/jekyll-anchor-headings
|
||||
|
||||
"Be the pull request you wish to see in the world." ~Ben Balter
|
||||
|
||||
Usage:
|
||||
{% include anchor_headings.html html=content %}
|
||||
|
||||
Parameters:
|
||||
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
|
||||
|
||||
Optional Parameters:
|
||||
* beforeHeading (bool) : false - Set to true if the anchor should be placed _before_ the heading's content
|
||||
* anchorAttrs (string) : '' - Any custom HTML attributes that will be added to the `<a>` tag; you may NOT use `href`, `class` or `title`
|
||||
* anchorBody (string) : '' - The content that will be placed inside the anchor; the `%heading%` placeholder is available
|
||||
* anchorClass (string) : '' - The class(es) that will be used for each anchor. Separate multiple classes with a space
|
||||
* anchorTitle (string) : '' - The `title` attribute that will be used for anchors
|
||||
* h_min (int) : 1 - The minimum header level to build an anchor for; any header lower than this value will be ignored
|
||||
* h_max (int) : 6 - The maximum header level to build an anchor for; any header greater than this value will be ignored
|
||||
* bodyPrefix (string) : '' - Anything that should be inserted inside of the heading tag _before_ its anchor and content
|
||||
* bodySuffix (string) : '' - Anything that should be inserted inside of the heading tag _after_ its anchor and content
|
||||
|
||||
Output:
|
||||
The original HTML with the addition of anchors inside of all of the h1-h6 headings.
|
||||
{% endcomment %}
|
||||
|
||||
{% assign minHeader = include.h_min | default: 1 %}
|
||||
{% assign maxHeader = include.h_max | default: 6 %}
|
||||
{% assign beforeHeading = include.beforeHeading %}
|
||||
{% assign nodes = include.html | split: '<h' %}
|
||||
|
||||
{% capture edited_headings %}{% endcapture %}
|
||||
|
||||
{% for _node in nodes %}
|
||||
{% capture node %}{{ _node | strip }}{% endcapture %}
|
||||
|
||||
{% if node == "" %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% assign nextChar = node | replace: '"', '' | strip | slice: 0, 1 %}
|
||||
{% assign headerLevel = nextChar | times: 1 %}
|
||||
|
||||
<!-- If the level is cast to 0, it means it's not a h1-h6 tag, so let's try to fix it -->
|
||||
{% if headerLevel == 0 %}
|
||||
{% if nextChar != '<' and nextChar != '' %}
|
||||
{% capture node %}<h{{ node }}{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% capture edited_headings %}{{ edited_headings }}{{ node }}{% endcapture %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% assign _workspace = node | split: '</h' %}
|
||||
{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
|
||||
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
|
||||
{% assign html_id = _idWorkspace[0] %}
|
||||
|
||||
{% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
|
||||
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}
|
||||
|
||||
<!-- Build the anchor to inject for our heading -->
|
||||
{% capture anchor %}{% endcapture %}
|
||||
|
||||
{% if html_id and headerLevel >= minHeader and headerLevel <= maxHeader %}
|
||||
{% capture anchor %}href="#{{ html_id }}"{% endcapture %}
|
||||
|
||||
{% if include.anchorClass %}
|
||||
{% capture anchor %}{{ anchor }} class="{{ include.anchorClass }}"{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.anchorTitle %}
|
||||
{% capture anchor %}{{ anchor }} title="{{ include.anchorTitle | replace: '%heading%', header }}"{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.anchorAttrs %}
|
||||
{% capture anchor %}{{ anchor }} {{ include.anchorAttrs }}{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% capture anchor %}<a {{ anchor }}>{{ include.anchorBody | replace: '%heading%', header | default: '' }}</a>{% endcapture %}
|
||||
|
||||
<!-- In order to prevent adding extra space after a heading, we'll let the 'anchor' value contain it -->
|
||||
{% if beforeHeading %}
|
||||
{% capture anchor %}{{ anchor }} {% endcapture %}
|
||||
{% else %}
|
||||
{% capture anchor %} {{ anchor }}{% endcapture %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% capture new_heading %}
|
||||
<h{{ _hAttrToStrip }}
|
||||
{{ include.bodyPrefix }}
|
||||
{% if beforeHeading %}
|
||||
{{ anchor }}{{ header }}
|
||||
{% else %}
|
||||
{{ header }}{{ anchor }}
|
||||
{% endif %}
|
||||
{{ include.bodySuffix }}
|
||||
</h{{ _workspace | last }}
|
||||
{% endcapture %}
|
||||
{% capture edited_headings %}{{ edited_headings }}{{ new_heading }}{% endcapture %}
|
||||
{% endfor %}
|
||||
{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}
|
||||
9
_includes/author.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<div class="author">
|
||||
<img
|
||||
class="author-avatar"
|
||||
src="{{ site.author.avatar }}"
|
||||
alt="{{ site.author.username }}"
|
||||
/>
|
||||
<h2 class="author-name">{{ site.author.name }}</h2>
|
||||
<p class="author-bio">{{ site.author.bio }}</p>
|
||||
</div>
|
||||
@@ -1 +1,10 @@
|
||||
<!-- paste here -->
|
||||
<!-- unnecessary file, but you can still use for comment section, e.g disqus -->
|
||||
<script
|
||||
src="https://utteranc.es/client.js"
|
||||
repo="username/reponame"
|
||||
issue-term="pathname"
|
||||
label="✨ comment ✨"
|
||||
theme="github-light"
|
||||
crossorigin="anonymous"
|
||||
async
|
||||
></script>
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
<footer class="footer">
|
||||
<div class="copyright">
|
||||
<a href="/thanks">ack.</a>
|
||||
<b>/</b>
|
||||
<a href="/feed.xml">rss</a>
|
||||
<b>/</b>
|
||||
<b>© {{ site.time | date: "%Y" }}</b>
|
||||
</div>
|
||||
<a class="footer_item" href="/thanks">ack.</a>
|
||||
<a class="footer_item" href="/resume">resume</a>
|
||||
<a class="footer_item" href="/feed.xml">rss</a>
|
||||
<span class="footer_item">© {{ site.time | date: "%Y" }}</span>
|
||||
<small class="footer_theme-copyright">
|
||||
<!-- Klisé Theme: https://github.com/piharpi/jekyll-klise -->
|
||||
<a href="https://github.com/piharpi/jekyll-klise" target="_blank">klisé</a>
|
||||
theme on
|
||||
<a href="https://jekyllrb.com" target="_blank">jekyll</a>
|
||||
</small>
|
||||
</footer>
|
||||
<script src="/assets/js/main.js" defer="defer"></script>
|
||||
<script src="/assets/js/galite.js"></script>
|
||||
<script>
|
||||
var galite = galite || {};
|
||||
|
||||
@@ -3,27 +3,26 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="theme-color" content="#24292e" />
|
||||
<meta name="p:domain_verify" content="74b28158c46b8035f8f4a5ba032e51b2" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="application-name" content="{{ site.title }}" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="#fff" />
|
||||
<meta name="apple-mobile-web-app-title" content="{{ site.title }}" />
|
||||
<title>
|
||||
{% if page.title %}{{ page.title | escape }} - {{ site.title }}{% else %}{{
|
||||
site.title | escape
|
||||
}}{% endif %}
|
||||
site.title | escape }}{% endif %}
|
||||
</title>
|
||||
<link
|
||||
rel="alternate"
|
||||
href="{{
|
||||
page.url | absolute_url | remove: 'index.html' | remove: '.html'
|
||||
page.url | remove: 'index.html' | remove: '.html' | absolute_url
|
||||
}}"
|
||||
hreflang="{{ site.lang }}"
|
||||
/>
|
||||
<link
|
||||
rel="canonical"
|
||||
href="{{
|
||||
page.url | absolute_url | remove: 'index.html' | remove: '.html'
|
||||
page.url | remove: 'index.html' | remove: '.html' | absolute_url
|
||||
}}"
|
||||
/>
|
||||
{% if paginator.previous_page %}
|
||||
@@ -31,7 +30,6 @@
|
||||
rel="prev"
|
||||
href="{{
|
||||
paginator.previous_page_path
|
||||
| absolute_url
|
||||
| remove: 'index.html'
|
||||
| remove: '.html'
|
||||
}}"
|
||||
@@ -41,7 +39,6 @@
|
||||
rel="next"
|
||||
href="{{
|
||||
paginator.next_page_path
|
||||
| absolute_url
|
||||
| remove: 'index.html'
|
||||
| remove: '.html'
|
||||
}}"
|
||||
@@ -84,7 +81,7 @@
|
||||
<meta
|
||||
property="og:url"
|
||||
content="{{
|
||||
page.url | absolute_url | remove: 'index.html' | remove: '.html'
|
||||
page.url | remove: 'index.html' | remove: '.html' | absolute_url
|
||||
}}"
|
||||
/>
|
||||
<meta
|
||||
@@ -115,7 +112,7 @@
|
||||
<meta
|
||||
name="twitter:url"
|
||||
content="{{
|
||||
page.url | absolute_url | remove: 'index.html' | remove: '.html'
|
||||
page.url | remove: 'index.html' | remove: '.html' | absolute_url
|
||||
}}"
|
||||
/>
|
||||
<meta name="twitter:site" content="@{{ site.author.username }}" />
|
||||
@@ -136,13 +133,39 @@
|
||||
{% else %}
|
||||
<meta name="twitter:image" content="{{ site.image | absolute_url }}" />
|
||||
{% endif %} {% feed_meta %}
|
||||
<link rel="icon" href="{{ site.icon | absolute_url }}" type="image/x-icon" />
|
||||
<link
|
||||
rel="shortcut icon"
|
||||
href="{{ site.icon | absolute_url }}"
|
||||
type="image/x-icon"
|
||||
rel="apple-touch-icon"
|
||||
sizes="180x180"
|
||||
href="/assets/favicons/apple-touch-icon.png"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="96x96"
|
||||
href="/assets/favicons/android-chrome-96x96.png"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="32x32"
|
||||
href="/assets/favicons/favicon-32x32.png"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="16x16"
|
||||
href="/assets/favicons/favicon-16x16.png"
|
||||
/>
|
||||
<link rel="manifest" href="/assets/favicons/site.webmanifest" />
|
||||
<link
|
||||
rel="mask-icon"
|
||||
href="/assets/favicons/safari-pinned-tab.svg"
|
||||
color="#5bbad5"
|
||||
/>
|
||||
<meta name="apple-mobile-web-app-title" content="Mahendrata" />
|
||||
<meta name="application-name" content="Mahendrata" />
|
||||
<meta name="msapplication-TileColor" content="#da532c" />
|
||||
<meta name="theme-color" content="#2c2c2c" />
|
||||
|
||||
<link rel="apple-touch-icon" href="{{ site.icon }}" />
|
||||
<link rel="stylesheet" href="{{ '/assets/css/style.css' | absolute_url }}" />
|
||||
<link rel="stylesheet" href="/assets/css/style.css" />
|
||||
</head>
|
||||
@@ -1,9 +0,0 @@
|
||||
<div class="introduction">
|
||||
<img
|
||||
class="introduction-image"
|
||||
src="{{ site.author.avatar | absolute_url }}"
|
||||
alt="{{ site.author.username }}"
|
||||
/>
|
||||
<div class="introduction-name">{{ site.title }}</div>
|
||||
<p class="introduction-description">{{ site.description }}</p>
|
||||
</div>
|
||||
@@ -3,26 +3,30 @@
|
||||
<input type="checkbox" id="menu-trigger" class="menu-trigger" />
|
||||
<label for="menu-trigger">
|
||||
<span class="menu-icon">
|
||||
<svg viewBox="0 0 18 15" width="18px" height="15px" style="background: white;">
|
||||
<path fill="#fff"
|
||||
d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.031C17.335,0,18,0.665,18,1.484L18,1.484z" />
|
||||
<path fill="#fff"
|
||||
d="M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0c0-0.82,0.665-1.484,1.484-1.484 h15.031C17.335,6.031,18,6.696,18,7.516L18,7.516z" />
|
||||
<path fill="#fff"
|
||||
d="M18,13.516C18,14.335,17.335,15,16.516,15H1.484C0.665,15,0,14.335,0,13.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.031C17.335,12.031,18,12.696,18,13.516L18,13.516z" />
|
||||
</svg>
|
||||
<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 512 512'><path d='M64,384H448V341.33H64Zm0-106.67H448V234.67H64ZM64,128v42.67H448V128Z'/></svg>
|
||||
</span>
|
||||
</label>
|
||||
<a id="mood">
|
||||
<svg class="mood-sunny" xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 512 512'><title>LIGHT</title><line x1='256' y1='48' x2='256' y2='96' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='256' y1='416' x2='256' y2='464' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='403.08' y1='108.92' x2='369.14' y2='142.86' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='142.86' y1='369.14' x2='108.92' y2='403.08' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='464' y1='256' x2='416' y2='256' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='96' y1='256' x2='48' y2='256' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='403.08' y1='403.08' x2='369.14' y2='369.14' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='142.86' y1='142.86' x2='108.92' y2='108.92' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><circle cx='256' cy='256' r='80' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/></svg>
|
||||
<svg class="mood-moon" xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 512 512'><title>DARK</title><line x1='256' y1='48' x2='256' y2='96' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='256' y1='416' x2='256' y2='464' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='403.08' y1='108.92' x2='369.14' y2='142.86' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='142.86' y1='369.14' x2='108.92' y2='403.08' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='464' y1='256' x2='416' y2='256' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='96' y1='256' x2='48' y2='256' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='403.08' y1='403.08' x2='369.14' y2='369.14' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><line x1='142.86' y1='142.86' x2='108.92' y2='108.92' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/><circle cx='256' cy='256' r='80' style='stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px'/></svg>
|
||||
</a>
|
||||
<div class="trigger">
|
||||
<div class="trigger-container">
|
||||
{% assign url = page.url %}
|
||||
{% for menu in site.data.menus %}
|
||||
{% if url == menu.url %}
|
||||
<a class="menu-link active" href="{{ menu.url }}">{{ menu.title }}</a>
|
||||
{% else %}
|
||||
<a class="menu-link" href="{{ menu.url }}">{{ menu.title }}</a>
|
||||
{% endif %}
|
||||
{% if url == menu.url %}
|
||||
<a class="menu-link active" href="{{ menu.url }}">{{ menu.title }}</a>
|
||||
{% else %}
|
||||
{% if menu.external %}
|
||||
<a class="menu-link" href="{{ menu.url }}" target="_blank" rel="noopener">{{ menu.title }}</a>
|
||||
{% else %}
|
||||
<a class="menu-link" href="{{ menu.url }}">{{ menu.title }}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<a class="menu-link rss" href="/feed.xml">
|
||||
<svg xmlns='http://www.w3.org/2000/svg' width='17' height='17' viewBox='0 0 512 512' fill='#ED812E'><title>RSS</title><path d='M108.56,342.78a60.34,60.34,0,1,0,60.56,60.44A60.63,60.63,0,0,0,108.56,342.78Z'/><path d='M48,186.67v86.55c52,0,101.94,15.39,138.67,52.11s52,86.56,52,138.67h86.66C325.33,312.44,199.67,186.67,48,186.67Z'/><path d='M48,48v86.56c185.25,0,329.22,144.08,329.22,329.44H464C464,234.66,277.67,48,48,48Z'/></svg>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
16
_includes/navigation.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<nav class="post-nav">
|
||||
{% if page.previous %}
|
||||
<a
|
||||
class="post-nav-item post-nav-prev"
|
||||
href="{{ page.previous | relative_url }}"
|
||||
>
|
||||
<div class="nav-arrow">Previous</div>
|
||||
<span class="post-title">{{ page.previous.title }}</span>
|
||||
</a>
|
||||
{% endif %} {% if page.next %}
|
||||
<a class="post-nav-item post-nav-next" href="{{ page.next | relative_url }}">
|
||||
<div class="nav-arrow">Next</div>
|
||||
<span class="post-title">{{ page.next.title }}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
21
_includes/pagination.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!-- NOTE: unused file, but u can use if necessary -->
|
||||
<!-- <div class="pagination">
|
||||
{% if paginator.previous_page %}
|
||||
<a
|
||||
class="page-previous"
|
||||
href="{{ paginator.previous_page_path }}"
|
||||
class="previous"
|
||||
>
|
||||
<span aria-hidden="true">←</span> NEWER POSTS
|
||||
</a>
|
||||
{% endif %}
|
||||
<span class="page_number"
|
||||
>PAGE {{ paginator.page }} OF {{ paginator.total_pages }}</span
|
||||
>
|
||||
{% if paginator.next_page %}
|
||||
<a class="page-next" href="{{ paginator.next_page_path }}" class="next"
|
||||
>OLDER POSTS
|
||||
<span aria-hidden="true">→</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div> -->
|
||||
@@ -1,14 +0,0 @@
|
||||
<nav class="post-nav">
|
||||
{% if page.previous %}
|
||||
<a class="post-nav-item post-nav-prev" href="{{ page.previous | relative_url }}">
|
||||
<h4>Previous</h4>
|
||||
<span>{{ page.previous.title }}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if page.next %}
|
||||
<a class="post-nav-item post-nav-next" href="{{ page.next | relative_url }}">
|
||||
<h4>Next</h4>
|
||||
<span>{{ page.next.title }}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
@@ -4,60 +4,19 @@ layout: compress
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ page.lang | default: site.lang | default: " en " }}">
|
||||
{% include head.html %}
|
||||
<style>
|
||||
body {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
height: 75vh;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 5em;
|
||||
font-weight: bold;
|
||||
font-family: 'Fira Code';
|
||||
line-height: 1.1;
|
||||
color: #ff5555;
|
||||
text-shadow: 1px 0px 0px#b45151;
|
||||
}
|
||||
|
||||
.phrase {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.solution {
|
||||
border-radius: 4em 1em 2em 1em / 1em 5em 1em 3em;
|
||||
color: #0036c7;
|
||||
background: #ebebeb;
|
||||
font-family: 'Roboto';
|
||||
line-height: 1.188;
|
||||
text-decoration: none;
|
||||
padding: 5px 8px;
|
||||
border: 0;
|
||||
font-size: 15.625px;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.solution:hover {
|
||||
border: 0;
|
||||
}
|
||||
</style>
|
||||
{% include header.html %}
|
||||
<body>
|
||||
<main aria-label="Content">
|
||||
{% include navbar.html %}
|
||||
<div class="wrapper">
|
||||
<div class="wrapper not-found">
|
||||
<div class="container">
|
||||
<div class="title">404</div>
|
||||
<p class="phrase">Hmm... Seems you lost from my 🎒 journey.</p>
|
||||
<a class="solution" href="{{ site.url }}">home</a>
|
||||
<p class="phrase">😕 Hmm... Seems you lost from my journey.</p>
|
||||
<a class="solution" href="{{ site.url }}">back home</a>
|
||||
</div>
|
||||
</div>
|
||||
{% include footer.html %}
|
||||
</main>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
---
|
||||
layout: compress
|
||||
---
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ page.lang | default: site.lang | default: " en " }}">
|
||||
{% include header.html %}
|
||||
|
||||
{% include head.html %}
|
||||
|
||||
<body>
|
||||
<body data-theme="{{ site.mode }}">
|
||||
{% include navbar.html %}
|
||||
<div class="wrapper">
|
||||
{% include jumbotron.html %}
|
||||
{% include author.html %}
|
||||
<main aria-label="Content">
|
||||
{{ content }}
|
||||
</main>
|
||||
{% include footer.html %}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -3,23 +3,12 @@ layout: default
|
||||
home: true
|
||||
---
|
||||
|
||||
<h4 class="posts-item-note">Recent Posts</h4>
|
||||
{% for post in site.posts %}
|
||||
{% capture current_year %}
|
||||
{{post.date | date: "%Y"}}
|
||||
{% endcapture %}
|
||||
{% if current_year != previous_year %}
|
||||
{% assign previous_year = current_year %}
|
||||
<h4 class="post-header">
|
||||
<span role="img" aria-label="icon-book" aria-hidden="true">🎉</span>
|
||||
{{ current_year }}
|
||||
</h4>
|
||||
{% endif %}
|
||||
<article class="posts">
|
||||
<span class="posts-date">{{ post.date | date: "%b %d" }}</span>
|
||||
<header class="posts-header">
|
||||
<h4 class="posts-title">
|
||||
<a href="{{ post.url }}">{{ post.title | escape }}</a>
|
||||
</h4>
|
||||
</header>
|
||||
</article>
|
||||
<article class="post-item">
|
||||
<span class="post-item-date">{{ post.date | date: "%b %d, %Y" }}</span>
|
||||
<h4 class="post-item-title">
|
||||
<a href="{{ post.url }}">{{ post.title | escape }}</a>
|
||||
</h4>
|
||||
</article>
|
||||
{% endfor %}
|
||||
|
||||
@@ -5,16 +5,16 @@ layout: compress
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ page.lang | default: site.lang | default: " en " }}">
|
||||
|
||||
{% include head.html %}
|
||||
{% include header.html %}
|
||||
|
||||
<body>
|
||||
{% include navbar.html %}
|
||||
<div class="wrapper">
|
||||
<header class="header">
|
||||
<h1 class="header-title" itemprop="headline">{{ page.title | escape }}.</h1>
|
||||
<h1 class="header-title center" itemprop="headline">{{ page.title | escape }}.</h1>
|
||||
</header>
|
||||
<main class="page-content" aria-label="Content">
|
||||
{{ content }}
|
||||
{% include anchor_headings.html html=content anchorClass="anchor-head" beforeHeading=true h_min=4 h_max=4 %}
|
||||
</main>
|
||||
{% include footer.html %}
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@ layout: compress
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ page.lang | default: site.lang | default: "en" }}">
|
||||
|
||||
{% include head.html %}
|
||||
{% include header.html %}
|
||||
|
||||
<body>
|
||||
{% include navbar.html %}
|
||||
@@ -14,8 +14,18 @@ layout: compress
|
||||
<article itemscope itemtype="https://schema.org/BlogPosting">
|
||||
|
||||
<header class="header">
|
||||
{% if page.tags and page.tags != empty %}
|
||||
<div class="tags">
|
||||
{% assign tags = page.tags %}
|
||||
<span itemprop="keywords">
|
||||
{% for tag in tags %}
|
||||
<a class="tag"
|
||||
href="/tags/#{{tag | downcase | slugify}}">{{tag | upcase }}</a>{% unless forloop.last %},{% endunless %}
|
||||
{% endfor %}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
<h1 class="header-title" itemprop="headline">{{ page.title | escape }}</h1>
|
||||
|
||||
{% if page.date %}
|
||||
<div class="post-meta">
|
||||
<time datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">
|
||||
@@ -30,42 +40,29 @@ layout: compress
|
||||
<span hidden itemprop="publisher" itemtype="Person">{{ site.author.name }}</span>
|
||||
<span hidden itemprop="image">{{ page.image }}</span>
|
||||
<span hidden itemprop="mainEntityOfPage">{{ page.excerpt }}</span>
|
||||
|
||||
{% if page.tags and page.tags != empty %}
|
||||
<div class="tags">
|
||||
{% assign tags = page.tags %}
|
||||
<span itemprop="keywords">
|
||||
{% for tag in tags %}
|
||||
<a class="tag"
|
||||
href="/tags/#{{tag | downcase | slugify}}">{{tag | downcase }}</a>{% unless forloop.last %},{% endunless %}
|
||||
{% endfor %}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</header>
|
||||
|
||||
<div class="page-content" itemprop="articleBody">
|
||||
{{ content }}
|
||||
{% if page.modified %}
|
||||
<small>Updated at <b>{{page.modified | date: "%d %B %Y"}}</b></small>
|
||||
{% endif %}
|
||||
{% include anchor_headings.html html=content anchorClass="anchor-head" beforeHeading=true h_min=1 h_max=4 %}
|
||||
{% if page.tweet %}
|
||||
<p>Comments this article on
|
||||
<a href="https://twitter.com/{{site.username}}/status/{{page.tweet}}">Twitter</a>.
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
</article>
|
||||
{% if page.comments %}
|
||||
{% include comments.html%}
|
||||
{% endif %}
|
||||
|
||||
</main>
|
||||
{% if page.modified %}
|
||||
<small class="post-updated-at">updated_at {{page.modified | date: "%d-%m-%Y"}}</small>
|
||||
{% endif %}
|
||||
{% if page.next or page.previous %}
|
||||
{% include post-nav.html %}
|
||||
{% include navigation.html %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
121
_posts/apa-itu-shell/2020-01-25-apa-itu-shell.md
Normal file
@@ -0,0 +1,121 @@
|
||||
---
|
||||
title: What is a shell? 🐚 adalah kerang ajaib?
|
||||
date: 2020-01-25 11:58:47 +07:00
|
||||
modified: 2020-02-02 16:49:47 +07:00
|
||||
tags: [unix/linux, cli]
|
||||
description: Shell adalah sebuah command-line interpreter; program yang berperan sebagai penerjemah perintah yang diinputkan oleh User yang melalui terminal, sehingga perintah tersebut bisa dimengerti oleh si Kernel.
|
||||
image: "/apa-itu-shell/shell_evolution.png"
|
||||
---
|
||||
|
||||
<a href="http://www.youtube.com/watch?v=tc4ROCJYbm0&t=70" target="_blank" rel="noopener">Dulu</a> Sebelum adanya <abbr title="Graphical User Interface">GUI</abbr> cara user berinteraksi dengan komputer menggunakan <abbr title="Command Line Interface">CLI</abbr> yaitu mengetik baris perintah pada sebuah antarmuka dalam bentuk baris teks seperti 👇.
|
||||
|
||||
<figure>
|
||||
<img src="/apa-itu-shell/terminal_nginx.gif" alt="installing nginx in ubuntu">
|
||||
<figcaption>Fig 1. Terminal emulator, instalasi package dan check service.</figcaption>
|
||||
</figure>
|
||||
|
||||
Jika kamu pernah menggunakan unix/linux mungkin pernah menggunakan program diatas, bahkan mungkin setiap hari menggunakannya untuk mengeksekusi suatu perintah melalui <a href="http://en.wikipedia.org/wiki/List_of_terminal_emulators" target="_blank" rel="noopener">terminal emulator</a>.
|
||||
|
||||
User<sup id="user">[[1]](#user-ref)</sup> tidak bisa secara langsung berkomunikasi dengan sebuah hardware komputer, maka dari itu kita membutuhkan sebuah sistem operasi; **Kernel** adalah program yang merupakan inti utama dari sistem operasi komputer.
|
||||
|
||||
<figure>
|
||||
<img src="/apa-itu-shell/kernel.png" alt="kernel central of operating system">
|
||||
<figcaption>Fig 2. bagan kernel.</figcaption>
|
||||
</figure>
|
||||
|
||||
Kernel memfasilitasi interaksi antara komponen perangkat keras dan perangkat lunak, berperan untuk menangani permintaan input/ouput dari perangkat lunak, selanjutnya menerjemahkannya ke dalam pemrosesan data untuk diintruksikan ke CPU, sehingga Hardware(cpu, memory, devices) mengerti perintah yang dimaksud dari pengguna.
|
||||
|
||||
Ketika kita menginputkan suatu perintah pada terminal emulator, kernel tidak langsung mengerti perintah yang kita ketik, kita membutuhkan suatu interface sebagai perantara menuju kernel yaitu **Shell**.
|
||||
|
||||
<figure>
|
||||
<img src="/apa-itu-shell/shell.png" alt="shell">
|
||||
<figcaption>Fig 3. bagan komunikasi shell.</figcaption>
|
||||
</figure>
|
||||
|
||||
<mark>Shell adalah sebuah command-line interpreter; program yang berperan sebagai penerjemah perintah yang diinputkan oleh User yang melalui terminal</mark>, sehingga perintah tersebut bisa dimengerti oleh si Kernel.
|
||||
|
||||
Login shell biasanya ditetapkan oleh local System Administrator ketika pada saat pertama user kamu dibuat, kamu bisa lihat login shell yang sedang kamu gunakan dengan perintah dibawah ini.
|
||||
|
||||
```bash
|
||||
$ echo $SHELL
|
||||
# atau
|
||||
$ echo $0
|
||||
```
|
||||
|
||||
Setiap shell mempunyai default prompt. beberapa shell yang paling umum:
|
||||
|
||||
```bash
|
||||
$ (dollar sign) # sh, ksh, bash
|
||||
% (percent sign) # csh, tcsh
|
||||
```
|
||||
|
||||
##### Terminologi pada shell prompt
|
||||
|
||||
Shell prompt adalah tempat dimana kita menuliskan suatu perintah, berikut adalah terminologinya ini membantu, jika kamu ingin mengetahui bagian-bagianya.
|
||||
|
||||
<figure>
|
||||
<img src="/apa-itu-shell/term_shell_prompt.png" alt="shell">
|
||||
<figcaption>Fig 4. bagian-bagin dari shell prompt.</figcaption>
|
||||
</figure>
|
||||
|
||||
Dibawah ini salah satu contoh perintah sederhana untuk menampilkan sebuah arsitektur CPU komputer yang sedang saya gunakan.
|
||||
|
||||
<figure>
|
||||
<img src="/apa-itu-shell/terminal_lscpu.gif" alt="installing nginx in ubuntu">
|
||||
<figcaption>Fig 5. menampilkan informasi tentang arsitektur CPU.</figcaption>
|
||||
</figure>
|
||||
|
||||
Dari perintah yang contohkan, ketika user mengetikan suatu inputan perintah di terminal dan menekan <kbd>ENTER</kbd>, maka shell akan mengubah perintah user menjadi bahasa yang bisa dipahami oleh kernel, dan Kernel menerjemahkannya ke dalam pemrosesan data untuk diintruksikan ke Hardware sehingga menghasilkan output yg sesuai dengan perintah user.
|
||||
|
||||
Shell mempunyai beberapa macam dan turunan, berikut yang paling umum.
|
||||
|
||||
<figure>
|
||||
<img src="/apa-itu-shell/shell_evolution.png" alt="shell evolution">
|
||||
<figcaption>Fig 6. evaluasi shell dari tahun ke tahun.</figcaption>
|
||||
</figure>
|
||||
|
||||
Sedikit penjelasan dari gambar diatas.
|
||||
|
||||
- Bourne shell `sh`
|
||||
Dikembangkan oleh Stephen Bourne di Bell Labs, yang kala itu sebagai pengganti Thompson shell(diciptakan Ken Thompson), banyak sistem unix-like tetap memiliki `/bin/sh`—yang mana menjadi symbolic link atau hard link, bahkan ketika shell lain yang digunakan tetap `sh` adalah sebagai dasarnya, sebagai kompatibilitas perintah.
|
||||
- Korn shell `ksh` Unix shell yang dikembangkan oleh David Korn di Bell Labs,
|
||||
inisialiasi pengembangan ini berdasar pada source code Bourne shell, namun juga memiliki fitur `csh` dan `sh`, pengembanganya pun pada saat saya menulis ini pun terus <a href="http://github.com/att/ast" target="_blank" rel="noopener">terawat</a>.
|
||||
- Bourne again shell `bash`
|
||||
adalah proyek ini open source <a href="http://gnu.org/software/bash/" target="_blank" rel="noopener">GNU project</a> memilki kompatibel dengan `sh` yang menggabungkan fitur penting dari `ksh` dan `csh`, dan menjadi salah satu shell yang paling umum digunakan (umumnya menjadi default shell login Linux dan Apple's macOS Mojave).
|
||||
- Z shell `zsh` ini mempunyai wadah komunitasnya disebutnya <a href="http://ohmyz.sh/" target="_blank" rel="noopener">"Oh My Zsh"</a>, plug-in dan theme `zsh` bisa kita temukan di komunitas ini, saya saat ini menggunakan `zsh`, shell ini juga menjadi default dari sistem operasi macOS Catalina, yang menggantikan bash.
|
||||
- friendly interactive shell `fish`
|
||||
yah sesuai dengan <a href="http://fishshell.com/" target="_blank" rel="noopener">deskripsi</a> di web nya, menurut saya shell ini fun banget, fitur yang saya sukai dari shell ini autosuggestions, dan konfigurasi yang mudah melalui web based.
|
||||
|
||||
Masih banyak yang belum dijelaskan pada tulisan ini jika masih tertarik, baca lebih <a href="http://en.wikipedia.org/wiki/List_of_command-line_interpreters#Operating_system_shells" target="_blank" rel="noopener">banyak</a> dan juga <a href="http://en.wikipedia.org/wiki/Comparison_of_command_shells" target="_blank" rel="noopener">komparasinya</a> masing-masing shell.
|
||||
|
||||
Jika kamu tertarik untuk mengubah default shell login pada sistem operasi, kamu bisa menginstall dengan cara mengikuti didokumentasi/cara penginstallan dimasing-masing shell disini saya tidak membahas karena distro yang kita pakai mungkin berbeda-beda.
|
||||
|
||||
Untuk menjadikan default shell login pada OS bisa menggunakan perintah ini.
|
||||
|
||||
```bash
|
||||
# command
|
||||
$ sudo chsh [options] [LOGIN]
|
||||
|
||||
# contoh penggunaan
|
||||
$ sudo chsh -s /user/bin/zsh harpi
|
||||
# mengubah default shell user harpi menjadi zsh shell.
|
||||
$ reboot
|
||||
|
||||
# atau kamu juga bisa mengubah file /etc/passwd dan edit secara manual user shellnya.
|
||||
# jika masih bingung manfaatkan perintah man untuk melihat manual page.
|
||||
$ man chsh
|
||||
```
|
||||
|
||||
Terakhir untuk tulisan ini, shell memilki berbagai macam, pilihlah shell yang sesuai dengan keinginanmu untuk menunjang produktivitas dan sesuaikan dengan kebutuhan, terlalu banyak plugin dan kebingungan memilih tema itu buruk 😁.
|
||||
|
||||
Terimakasih sudah baca, _penulis menerima kritik dan saran._
|
||||
|
||||
##### Notes
|
||||
|
||||
<small id="user-ref"><sup>[[1]](#user)</sup> Manusia yang mengoperasikan dan mengendalikan sistem komputer.</small>
|
||||
|
||||
##### Resources
|
||||
|
||||
- [Evolution shells in Linux](http://developer.ibm.com/tutorials/l-linux-shells/)
|
||||
- [Kernel Defintion](http://www.linfo.org/kernel.html)
|
||||
- [The Shell](http://www.cis.rit.edu/class/simg211/unixintro/Shell.html)
|
||||
BIN
_posts/apa-itu-shell/kernel.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
BIN
_posts/apa-itu-shell/shell.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
_posts/apa-itu-shell/shell_evolution.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
_posts/apa-itu-shell/term_shell_prompt.png
Normal file
|
After Width: | Height: | Size: 85 KiB |
BIN
_posts/apa-itu-shell/terminal_lscpu.gif
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
_posts/apa-itu-shell/terminal_nginx.gif
Normal file
|
After Width: | Height: | Size: 266 KiB |
BIN
_posts/apa-itu-shell/weird_guyyy.gif
Normal file
|
After Width: | Height: | Size: 3.1 MiB |
@@ -0,0 +1,71 @@
|
||||
---
|
||||
layout: post
|
||||
title: Cara ribet memperbarui forked repo
|
||||
date: 2020-01-29 01:00 +0700
|
||||
modified: 2020-03-07 16:49:47 +07:00
|
||||
description: Ada dua cara untuk memperbarui forked repository menggunakan web interface yang disediakan oleh github tapi ribet, atau melalui terminal yang lebih ribet lagi.
|
||||
tag:
|
||||
- tips
|
||||
- git
|
||||
- software
|
||||
image: /cara-memperbarui-fork-repository/repo.png
|
||||
---
|
||||
|
||||
Berawal dari saya pengen memperbarui repo yang tua dari suatu organisasi, niatnya pengen rumat ulang nih, ternyata dari orginal reponya ada update, sekalian buat artikel deh, lebih kurang gambaranya seperti ini.
|
||||
|
||||
<figure>
|
||||
<img src="{{ page.image }}" alt="ilustrasi repo yang mau diupdate">
|
||||
<figcaption>Fig 1. Gambaran ribetnya.</figcaption>
|
||||
</figure>
|
||||
|
||||
Ada dua cara untuk memperbarui forked repository menggunakan web interface yang disediakan oleh github tapi ribet, atau melalui terminal yang lebih ribet lagi.
|
||||
|
||||
### Melalui Github (boring way) 💻
|
||||
|
||||
1. Buka repo yang hasil fork di Github.
|
||||
1. Klik **Pull Requests** di sebelah kanan, lalu **New Pull Request**.
|
||||
1. Akan memunculkan hasil compare antara repo upstream dengan repo kamu(forked repo), dan jika menyatakan "There isn’t anything to compare.", tekan link **switching the base**, yang mana sekarang repo kamu(forked repo) akan dibalik menjadi base repo dan repo upstream menjadi head repo.
|
||||
1. Tekan **Create Pull Request**, beri judul pull request, Tekan **Send Pull Request**.
|
||||
1. Tekan **Merge Pull Request** dan **Confirm Merge**.
|
||||
|
||||
\* _pastikan kamu tidak merubah apapun pada forked repo, supaya melakukan merge secara otomatis, kalo tidak ya paling2 konflik._
|
||||
|
||||
### Melalui terminal ⌨️
|
||||
|
||||
Tambahkan remote alamat repository yang aslinya disini tak beri nama `upstream`., ganti `ORIGINAL_OWNER` dan `ORIGINAL_REPO` dengan alamat repo aslimu.
|
||||
|
||||
```bash
|
||||
$ git add remote upstream git@github.com:ORIGINAL_OWNER/ORIGINAL_REPO.git
|
||||
$ git remote -v
|
||||
> origin git@github.com:piharpi/www.git (fetch) # forked repo
|
||||
> origin git@github.com:piharpi/www.git (push) # forked repo
|
||||
> upstream git@github.com:ORIGINAL_OWNER/ORIGINAL_REPO.git (fetch) # upstream repo / original repo
|
||||
> upstream git@github.com:ORIGINAL_OWNER/ORIGINAL_REPO.git (push) # upstream repo / original repo
|
||||
```
|
||||
|
||||
Checkout ke local branch `master`.
|
||||
|
||||
```bash
|
||||
$ git checkout master
|
||||
> Switched to branch 'master'
|
||||
```
|
||||
|
||||
Jika sudah, Merge local repo dengan remote `upstream/master`.
|
||||
|
||||
```bash
|
||||
$ git merge upstream/master
|
||||
```
|
||||
|
||||
Terakhir push local repo ke remote `origin`.
|
||||
|
||||
```bash
|
||||
$ git add -A
|
||||
$ git commit -m "updating origin repo" && git push -u origin master
|
||||
```
|
||||
|
||||
Selamat mencoba cara ribet ini, semoga bisa dipahami, saya sendiri lebih senang melalui terminal, klo ada yang ribet kenapa cari yang mudah.
|
||||
|
||||
##### Resources
|
||||
|
||||
- [Syncing a fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork)
|
||||
- [Update your fork directly on Github](https://rick.cogley.info/post/update-your-forked-repository-directly-on-github/#top)
|
||||
BIN
_posts/cara-memperbarui-fork-repository/repo.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
@@ -1,26 +1,27 @@
|
||||
---
|
||||
title: Hello World, how this site was made.
|
||||
title: How this site was born 👶
|
||||
date: 2018-09-28 09:45:47 +07:00
|
||||
modified: 2019-08-29 09:24:47 +07:00
|
||||
tags: [blog, netlify, jekyll, github]
|
||||
description: All the services are free, a source code this site placed on github repository and intergration with netlify service, another service that you can use is github page for hosting your own static site.
|
||||
# image: "/assets/img/posts/blog/frontslash.png"
|
||||
---
|
||||
|
||||
The website was made using Jekyll the one of open source static sites generator, and using my own simple theme, I called [bangsring](https://github.com/piharpi/bangsring).
|
||||
The website was made using Jekyll the one of open source static sites generator, and using my own simple theme, I called [klisé](https://github.com/piharpi/klise).
|
||||
|
||||
<hr>
|
||||
|
||||
All the services are free, source code the site was placed on my [github](https://github.com/piharpi/piharpi.com) repository and intergration with [netlify](https://netlify.com) service, another service that you can use is [github page](https://pages.github.com/) for hosting your own static site.
|
||||
All the services are free, source code the site was placed on my [github](https://github.com/piharpi/mahendrata.now.sh) repository and intergration with ~~[netlify](https://netlify.com)~~ service, another service that you can use is [github page](https://pages.github.com/) for hosting your own static site.
|
||||
|
||||
<hr>
|
||||
|
||||
##### I'm not just tell my story, <br> but i will show you how to create your own site.
|
||||
#### Let's do this
|
||||
|
||||
So, before we start create a site, you need some tools, you can self paced for how to installing each tools, on this guide i'm just want to show you how to install jekyll and deploying in netlify, but make sure you have each tools below.
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
Requirements before we doing magic show.
|
||||
|
||||
- [Ruby](https://www.ruby-lang.org/en/downloads/) programming language
|
||||
- [Git](https://git-scm.com) (version control)
|
||||
- [Netlify](https://netlify.com) and [Github](https://github.com) account
|
||||
@@ -54,9 +55,9 @@ Now check your github repository, make sure the files is uploaded correctly.
|
||||
|
||||
Go [netlify](https://netlify.com) dashboard, and following this step.
|
||||
|
||||
1. click **new site from git**, then choose **Github**.
|
||||
1. click `new site from git`, then choose `Github`.
|
||||
2. then choose your repository where is the jekyll sources uploaded.
|
||||
3. netlify smart enough to configuring, we just need to click **Deploy site** button.
|
||||
3. netlify smart enough to configuring, we just need's are hosting's are hosting's are hosting's are hosting to click `Deploy site button`.
|
||||
|
||||
Wait for moment, and voila..! your site's are hosting and using `.netlify.com` tld, if your website wants to look professional, just buy a domain from your favorite domain store. or if you the first time, I advice using namecheap.com*(isn't sponsor)* \*based on my experienced it provides good service and have various TLDs.
|
||||
|
||||
@@ -0,0 +1,539 @@
|
||||
---
|
||||
title: Python Notes from Intro to Machine Learning
|
||||
date: 2018-04-14 10:00:00 +07:00
|
||||
tags: [python, machine-learning]
|
||||
description: Notes and code snippets of Python that I've been collecting so far throughout the "Intro to Machine Learning" course.
|
||||
---
|
||||
|
||||
##### This article is for Demo purpose
|
||||
|
||||
The article was originally on [this repo](https://github.com/risan/risanb.com/blob/master/content/posts/python-notes-from-intro-to-machine-learning/index.md)
|
||||
|
||||
I rarely use Python. I only have one repository at Github that is written in Python: [iris-flower-classifier](https://github.com/risan/iris-flower-classifier). And it was written two years ago!
|
||||
|
||||
A few days ago I took this free course from Udacity: [Intro to Machine Learning](https://eu.udacity.com/course/intro-to-machine-learning--ud120). The machine learning related codes are quite easy to grasp since it simply uses the [scikit-learn](http://scikit-learn.org/) modules. But most of the supporting Python modules that are provided by this course were like a black-box to me. I had no idea how to download a file in Python or what's the difference between a list, a tuple and a dictionary.
|
||||
|
||||
That's why I decided to read all of the provided Python modules and implement it myself. I ended up refactor most of the code so it's easier to understand: [github.com/risan/intro-to-machine-learning](https://github.com/risan/intro-to-machine-learning).
|
||||
|
||||
So here are some notes and snippets of Python that I've been collecting so far (I'm not even halfway through the course 😝). Also, note that the codes here are still using Python version 2.7.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
## Modules Classes and Functions
|
||||
|
||||
### Main Entry File
|
||||
|
||||
Suppose our Python project is stored in `/foo/bar` directory. And this application has one file that serves as the single entry point. We can name this file `__main__.py` so we can run this project simply be referencing its directory path:
|
||||
|
||||
```bash
|
||||
# Referencing its directory.
|
||||
$ python /foo/bar
|
||||
|
||||
# It's equivalent to this.
|
||||
$ python /foo/bar/__main__.py
|
||||
```
|
||||
|
||||
### Import Python Module Dynamically
|
||||
|
||||
Suppose we would like to import a Python module dynamically based on a variable value. We can achieve this through the [`__import__`](https://docs.python.org/2/library/functions.html#__import__) function:
|
||||
|
||||
```py
|
||||
module_name = "numpy"
|
||||
|
||||
__import__(module_name)
|
||||
```
|
||||
|
||||
### Multiple Returns in Python
|
||||
|
||||
In Python, it's possible for a function or a method to return multiple values. We can do this simply by separating each return value by a comma:
|
||||
|
||||
```py
|
||||
def test():
|
||||
return 100, "foo"
|
||||
|
||||
someNumber, someString = test()
|
||||
```
|
||||
|
||||
### Importing Modules Outside of the Directory
|
||||
|
||||
In order to import a module from outside of the directory, we need to add that module's directory path into the current file with `sys.path.append`. Suppose we have the following directory structure:
|
||||
|
||||
```
|
||||
|--foo
|
||||
| |-- bar.py
|
||||
|
|
||||
|-- tools
|
||||
| |-- speak_yoda.py
|
||||
```
|
||||
|
||||
If we want to use the `speak_yoda.py` module within the `bar.py`, we can do the following:
|
||||
|
||||
```py
|
||||
# /foo/bar.py
|
||||
import os
|
||||
|
||||
# Use relative path to tools directory.
|
||||
sys.path.append("../tools")
|
||||
|
||||
import speak_yoda
|
||||
```
|
||||
|
||||
However, this won't work if we run the `baz.py` file from outside of its `foo` directory:
|
||||
|
||||
```bash
|
||||
# It works inside of the /foo directory.
|
||||
$ cd /foo
|
||||
$ python bar.py
|
||||
|
||||
# But it won't work if the code runs from outside of /foo directory.
|
||||
$ python foo/bar.py
|
||||
```
|
||||
|
||||
To solve this problem we can refer to the `tools` directory using its absolute path.
|
||||
|
||||
```py
|
||||
# /foo/bar.py
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Get the directory name for this file.
|
||||
current_dirname = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
# Use the absolute path to the tools directory
|
||||
tools_path = os.path.abspath(os.path.join(dirname, "../tools"))
|
||||
sys.path.append(tools_path)
|
||||
|
||||
import speak_yoda
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
### Print The Emojis
|
||||
|
||||
It turns out you can't just print an emoji or any other Unicode characters to the console. You need to specify the encoding type beforehand:
|
||||
|
||||
```py
|
||||
# coding: utf8
|
||||
|
||||
print("😅")
|
||||
```
|
||||
|
||||
### Pretty Print
|
||||
|
||||
We can use the `pprint` module to pretty-print Python data structure with a configurable indentation:
|
||||
|
||||
```py
|
||||
import pprint
|
||||
pp = pprint.PrettyPrinter(indent=2)
|
||||
|
||||
pp.pprint(people)
|
||||
```
|
||||
|
||||
## Working with Pathname
|
||||
|
||||
Read more about pathname manipulations in the [`os.path` documentation](https://docs.python.org/2/library/os.path.html).
|
||||
|
||||
### Get Filename From URL
|
||||
|
||||
Suppose the last segment of the URL contains a filename that we would like to download. We can extract this filename with the following code:
|
||||
|
||||
```py
|
||||
import os
|
||||
from urlparse import urlparse
|
||||
|
||||
url = "https://example.com/foo.txt"
|
||||
|
||||
url_components = urlparse(url)
|
||||
|
||||
filename = os.path.basename(url_components.path) # foo.txt
|
||||
```
|
||||
|
||||
### Check if File Exists
|
||||
|
||||
To check whether the given file path exists or not:
|
||||
|
||||
```py
|
||||
import os
|
||||
|
||||
is_exists = os.path.isfile("foo.txt")
|
||||
```
|
||||
|
||||
### Create a Directory if It Does Not Exists
|
||||
|
||||
To create a directory only if it does not exist:
|
||||
|
||||
```py
|
||||
import os
|
||||
import errno
|
||||
|
||||
try:
|
||||
os.makedirs(directory_path)
|
||||
except OSError, e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
```
|
||||
|
||||
## Working with Files
|
||||
|
||||
### Downloading a File
|
||||
|
||||
We can use the `urllib` module to download a file in Python. The first argument is the file URL that we would like to download. The second argument is the optional filename that will be used to store the file.
|
||||
|
||||
```py
|
||||
import urllib
|
||||
|
||||
urllib.urlretrieve("https://example.com/foo.txt", "foo.txt")
|
||||
```
|
||||
|
||||
### Extracting Tar File
|
||||
|
||||
There's a built-in `tarfile` module that we can use to work with Tar file in Python. To extract the `tar.gz` file we can use the following code:
|
||||
|
||||
```py
|
||||
import tarfile
|
||||
|
||||
# Open the file.
|
||||
tfile = tarfile.open("foo.tar.gz")
|
||||
|
||||
# Extract the file to the given path.
|
||||
tfile.extractall(path)
|
||||
```
|
||||
|
||||
We can pass the `mode` argument to the `open` method. By default, the `mode` would be `r`—reading mode with transparent compression. There are also other mode options that we can use:
|
||||
|
||||
- `r:gz`: Reading mode with gzip compression.
|
||||
- `r:`: Reading mode without compression.
|
||||
- `a`: Appending mode without compression.
|
||||
- `w`: Writting mode without compression.
|
||||
- Checkout other available options in [tarfile documentation](https://docs.python.org/2/library/tarfile.html).
|
||||
|
||||
## Working with List
|
||||
|
||||
### Generate a List of Random Numbers
|
||||
|
||||
Use the `for..in` syntax to generate a list of random numbers in a one-liner style.
|
||||
|
||||
```py
|
||||
import random
|
||||
|
||||
# Initialize internal state of random generator.
|
||||
random.seed(42)
|
||||
|
||||
# Generate random points.
|
||||
randomNumbers = [random.random() for i in range(0, 10)]
|
||||
# [0.6394267984578837, 0.025010755222666936, 0.27502931836911926, ...]
|
||||
```
|
||||
|
||||
### Pair Values from Two Lists
|
||||
|
||||
The built-in `zip` function can pair values from two lists. However, this `zip` function will return a list of tuples instead. To get a list of value pairs, we can combine it with `for..in` syntax:
|
||||
|
||||
```py
|
||||
coordinates = [[x, y] for x,y in zip([5,10,15], [0,1,0])]
|
||||
# [[5, 0], [10, 1], [15, 0]]
|
||||
```
|
||||
|
||||
### Splitting a List
|
||||
|
||||
We can easily split a list in Python by specifying the starting index and it's ending index. Note that the ending index is excluded from the result.
|
||||
|
||||
We can also specify a negative index. And also note that both of these indices are optional!
|
||||
|
||||
```py
|
||||
a = [0,1,2,3,4,5]
|
||||
|
||||
a[0:3] # 0,1,2
|
||||
a[1:3] # 1,2
|
||||
a[2:] # 2,3,4,5
|
||||
a[:3] # 0,1,2
|
||||
a[0:-2] # 0,1,2,3
|
||||
a[-2:] # 4,5
|
||||
a[:] # 0,1,2,3,4,5
|
||||
```
|
||||
|
||||
### Filtering a List In One Line
|
||||
|
||||
We can easily filter a list in Python by combining the `for..in` and the `if` syntax together:
|
||||
|
||||
```py
|
||||
numbers = range(1,11)
|
||||
|
||||
# Filter even numbers only.
|
||||
[numbers[i] for i in range(0, len(numbers)) if numbers[i] % 2 == 0]
|
||||
# [2, 4, 6, 8, 10]
|
||||
```
|
||||
|
||||
### Sorting a List in Ascending Order
|
||||
|
||||
In Python, we can sort a list in ascending order simply by calling the `sort` method like so:
|
||||
|
||||
```py
|
||||
people = ["John", "Alice", "Poe"]
|
||||
people.sort()
|
||||
print(people) # ["Alice", "John", "Poe"]
|
||||
```
|
||||
|
||||
### Using Filter Function with a List
|
||||
|
||||
Just like its name, we can use the `filter` function to filter out our list:
|
||||
|
||||
```py
|
||||
numbers = range(1, 11)
|
||||
|
||||
even_numbers = filter(lambda number: number % 2 == 0, numbers)
|
||||
# [2, 4, 6, 8, 10]
|
||||
```
|
||||
|
||||
We can break the above statement into two parts:
|
||||
|
||||
- `lambda number: statement`: The first part is the function that we would like to run to every item on the list. `number` is the variable name we'd like to use in this function to refer to a single item from the `numbers` list. The following function body must evaluate to truthy/falsy value—falsy means the current item will be removed from the final result.
|
||||
- `numbers`: The second parameter is the list that we'd like to filter.
|
||||
|
||||
### Using Reduce with a List of Dictionary
|
||||
|
||||
We can use the `reduce` function to calculate the total of a particular key in a list of a dictionary:
|
||||
|
||||
```py
|
||||
items = [{value:10}, {value:20}, {value:50}]
|
||||
|
||||
# Calculate the total of value key.
|
||||
totalValues = reduce(lambda total, item: total + item["value"], items, 0) # 80
|
||||
```
|
||||
|
||||
It can be broken down into 4 parts:
|
||||
|
||||
- `lambda total`: It's the variable name that we'd like to use in the function body to refer to the carried or the accumulative value that will finally be returned.
|
||||
- `item: statement`: `item` is the name of the variable we'd like to use within the function body to refer to the single item in the `items` list. The following function body will be executed in order to define the accumulative value of `total` for the next iteration.
|
||||
- `items`: It's the list of item that we would like to "reduce".
|
||||
- `0`: The last parameter is optional and it's the initial accumulative value for the first iteration.
|
||||
|
||||
We can also use this `reduce` function to find a single item from the list. Here's an example of code to find the person with the biggest `total_payments` within the given list of `people` dictionary.
|
||||
|
||||
```py
|
||||
people = [
|
||||
{"name": "John", "total_payments": 100},
|
||||
{"name": "Alice", "total_payments": 1000},
|
||||
{"name": "Poe", "total_payments": 800}
|
||||
]
|
||||
|
||||
person_biggest_total_payments = reduce(lambda paid_most, person: person if person["total_payments"] > paid_most["total_payments"] else paid_most, people, { "total_payments": 0 })
|
||||
# {'name': 'Alice', 'total_payments': 1000}
|
||||
```
|
||||
|
||||
## Working with Dictionary
|
||||
|
||||
### Loop Through Dictionary
|
||||
|
||||
We can use the `itervalues` method to loop through a dictionary:
|
||||
|
||||
```py
|
||||
for person in people.itervalues():
|
||||
print(person["email_address"])
|
||||
```
|
||||
|
||||
We can also use the `iteritems` method if we want to access the key too:
|
||||
|
||||
```py
|
||||
for person in people.iteritems():
|
||||
print(person[0] + ": " + person[1]["email_address"])
|
||||
```
|
||||
|
||||
### Calculate Total of Particular Dictionary Key
|
||||
|
||||
Suppose we would like to calculate the total amount of `salary` key on a `people` dictionary. We can extract the `salary` key and use the `sum` function to get the total:
|
||||
|
||||
```py
|
||||
total_salary = sum([person["salary"] for person in people.itervalues()])
|
||||
```
|
||||
|
||||
## Working with Numpy
|
||||
|
||||
### Numpy Create Range of Values with The Given Interval
|
||||
|
||||
Use the [`arange`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html) method to create an array with an evenly spaced interval.
|
||||
|
||||
```py
|
||||
import numpy as np
|
||||
|
||||
np.arange(0, 5, 1)
|
||||
# array([0,1,2,3,4])
|
||||
|
||||
np.arange(1, 4, 0.5)
|
||||
# array([1. , 1.5, 2. , 2.5, 3. , 3.5])
|
||||
```
|
||||
|
||||
### Numpy Create Coordinate Matrices from Coordinate Vectors
|
||||
|
||||
We can use the Numpy [`meshgrid`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.meshgrid.html) method to make coordinate matrices from one-dimentional coordinate arrays.
|
||||
|
||||
```py
|
||||
import numpy as np
|
||||
|
||||
np.meshgrid([1, 2, 3], [0, 7])
|
||||
# [
|
||||
# array([[1,2,3], [1,2,3]]),
|
||||
# array([[0,0,0], [7,7,7]])
|
||||
# ]
|
||||
```
|
||||
|
||||
### Flatten Numpy Array
|
||||
|
||||
When we have a multi-dimensional Numpy array, we can easily flatten it with the [`ravel`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.ravel.html) method:
|
||||
|
||||
```py
|
||||
import numpy as np
|
||||
|
||||
arr = np.array([[1,2], [3,4]])
|
||||
arr.ravel()
|
||||
# array([1, 2, 3, 4])
|
||||
```
|
||||
|
||||
### Pairing Array Values with Second Axis
|
||||
|
||||
We can use Numpy `c_` function to pair array values with another array that will be it's second axis. Read the [`numpy.c_` documentation](https://docs.scipy.org/doc/numpy/reference/generated/numpy.c_.html).
|
||||
|
||||
```py
|
||||
import numpy as np
|
||||
|
||||
x = [1,2]
|
||||
y = [10,20]
|
||||
|
||||
np.c_[x, y]
|
||||
# array([1,10], [2,20])
|
||||
```
|
||||
|
||||
### Generate Coordinates Across The Grid
|
||||
|
||||
With the knowledge of Numpy [`arange`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html), [`meshgrid`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.meshgrid.html), [`ravel`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.ravel.html) and [`c_`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.c_.html) methods, we can easily generate an evenly spaced coordinates across the grid so we can pass it to the classifier and plot the decision surface.
|
||||
|
||||
```py
|
||||
import numpy as np
|
||||
|
||||
# Generate an evenly spaced coordinates.
|
||||
x_points, y_points = np.meshgrid(np.arange(x_min, x_max, step), np.arange(y_min, y_max, step))
|
||||
|
||||
# Pair the x and y points.
|
||||
test_coordinates = np.c_[x_points.ravel(), y_points.ravel()]
|
||||
```
|
||||
|
||||
## Plotting the Data
|
||||
|
||||
### Plot The Surface Decision
|
||||
|
||||
We can pass an evenly spaced coordinates across the grid to the classifier to predict the output on each of that coordinate. We can then use [`matplotlib.pyplot`](https://matplotlib.org/api/pyplot_api.html) to plot the surface decision.
|
||||
|
||||
```py
|
||||
import matplotlib.pyplot as plt
|
||||
import pylab as pl
|
||||
|
||||
# Pass coordinates across the grid.
|
||||
predicted_labels = classifier.predict(test_coordinates)
|
||||
|
||||
# Don't forget to reshape the output array dimension.
|
||||
predicted_labels = predicted_labels.reshape(x_points.shape)
|
||||
|
||||
# Set the axes limit.
|
||||
plt.xlim(x_points.min(), x_points.max())
|
||||
plt.ylim(y_points.min(), y_points.max())
|
||||
|
||||
# Plot the decision boundary with seismic color map.
|
||||
plt.pcolormesh(x_points, y_points, predicted_labels, cmap = pl.cm.seismic)
|
||||
```
|
||||
|
||||
The classifier output would be a one-dimensional array, so don't forget to [`reshape`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.reshape.html) it back into a two-dimensional array before plotting. The `cmap` is an optional parameter for the color map. Here we use the `seismic` color map from `pylab` module. It has the red-blue colors.
|
||||
|
||||
### Scatter Plot
|
||||
|
||||
We need to separate the test points based on its predicted label (the speed). So we can plot the test points with two different colors.
|
||||
|
||||
```py
|
||||
# Separate fast (label = 0) & slow (label = 1) test points.
|
||||
grade_fast = [features_test[i][0] for i in range(0, len(features_test)) if labels_test[i] == 0]
|
||||
bumpy_fast = [features_test[i][1] for i in range(0, len(features_test)) if labels_test[i] == 0]
|
||||
grade_slow = [features_test[i][0] for i in range(0, len(features_test)) if labels_test[i] == 1]
|
||||
bumpy_slow = [features_test[i][1] for i in range(0, len(features_test)) if labels_test[i] == 1]
|
||||
|
||||
# Plot the test points based on its speed.
|
||||
plt.scatter(grade_fast, bumpy_fast, color = "b", label = "fast")
|
||||
plt.scatter(grade_slow, bumpy_slow, color = "r", label = "slow")
|
||||
|
||||
# Show the plot legend.
|
||||
plt.legend()
|
||||
|
||||
# Add the axis labels.
|
||||
plt.xlabel("grade")
|
||||
plt.ylabel("bumpiness")
|
||||
|
||||
# Show the plot.
|
||||
plt.show()
|
||||
```
|
||||
|
||||
If we want to save the plot into an image, we can use the `savefig` method instead:
|
||||
|
||||
```py
|
||||
plt.savefig('scatter_plot.png')
|
||||
```
|
||||
|
||||
## Dealing with Data
|
||||
|
||||
### Deserializing Python Object
|
||||
|
||||
We can use [`pickle`](https://docs.python.org/2/library/pickle.html) module for serializing and deserializing Python object. There's also the `cPickle`—the faster C implementation. We use both of these modules to deserialize the email text and author list.
|
||||
|
||||
```py
|
||||
import pickle
|
||||
import cPickle
|
||||
|
||||
# Unpickling or deserializing the texts.
|
||||
texts_file_handler = open(texts_file, "r")
|
||||
texts = cPickle.load(texts_file_handler)
|
||||
texts_file_handler.close()
|
||||
|
||||
# Unpickling or deserializing the authors.
|
||||
authors_file_handler = open(authors_file, "r")
|
||||
authors = pickle.load(authors_file_handler)
|
||||
authors_file_handler.close()
|
||||
```
|
||||
|
||||
### Split Data for Training and Testing
|
||||
|
||||
We can use the built-in [`train_test_split`](http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html) function from scikit-learn to split the data both for training and testing.
|
||||
|
||||
```py
|
||||
from sklearn.model_selection import train_test_split
|
||||
|
||||
features_train, features_test, labels_train, labels_test = train_test_split(texts, authors, test_size = 0.1, random_state = 42)
|
||||
```
|
||||
|
||||
The `test_size` argument is the proportion of data to split into the test, in our case we split 10% for testing.
|
||||
|
||||
### Vectorized the Strings
|
||||
|
||||
When working with a text document, we need to vectorize the strings into a list of numbers so it's easier and more efficient to process. We can use the [`TfidfVectorizer`](http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.TfidfVectorizer.html) class to vectorize the strings into a matrix of TF-IDF features.
|
||||
|
||||
```py
|
||||
from sklearn.feature_extraction.text import TfidfVectorizer
|
||||
|
||||
vectorizer = TfidfVectorizer(sublinear_tf = True, max_df = 0.5, stop_words = "english")
|
||||
features_train_transformed = vectorizer.fit_transform(features_train)
|
||||
features_test_transformed = vectorizer.transform(features_test)
|
||||
```
|
||||
|
||||
Word with a frequency higher than the `max_df` will be ignored. Stop words are also ignored—stop words are the most common words in a language (e.g. a, the, has).
|
||||
|
||||
### Feature Selection
|
||||
|
||||
Text can have a lot of features thus it may slow to compute. We can use scikit [`SelectPercentile`](http://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.SelectPercentile.html) class to select only the important features.
|
||||
|
||||
```py
|
||||
selector = SelectPercentile(f_classif, percentile = 10)
|
||||
selector.fit(features_train_transformed, labels_train)
|
||||
selected_features_train_transformed = selector.transform(features_train_transformed).toarray()
|
||||
selected_features_test_transformed = selector.transform(features_test_transformed).toarray()
|
||||
```
|
||||
|
||||
The `percentile` is the percentage of features that we'd like to select based on its highest score.
|
||||
|
||||
##### This article is for Demo purpose
|
||||
|
||||
The article was originally on [this repo](https://github.com/risan/risanb.com/blob/master/content/posts/python-notes-from-intro-to-machine-learning/index.md)
|
||||
@@ -0,0 +1,112 @@
|
||||
---
|
||||
title: React Component with Dot Notation
|
||||
date: 2018-04-07 23:04:00 +07:00
|
||||
tags: [javascript, react]
|
||||
description: Learn how to define a React component that is accessible through the dot notation. A common component pattern to show a parent-child relation.
|
||||
---
|
||||
|
||||
##### This article is for Demo purpose
|
||||
|
||||
The article was originally on [this repo](https://github.com/risan/risanb.com/blob/master/content/posts/react-component-with-dot-notation/index.md)
|
||||
|
||||
This is my answer to someone's question on [StackOverflow](https://stackoverflow.com/questions/49256472/react-how-to-extend-a-component-that-has-child-components-and-keep-them/49258038#answer-49258038). How can we define a React component that is accessible through the dot notation?
|
||||
|
||||
Take a look at the following code. We have the `Menu` component and its three children `Menu.Item`:
|
||||
|
||||
```jsx
|
||||
const App = () => (
|
||||
<Menu>
|
||||
<Menu.Item>Home</Menu.Item>
|
||||
<Menu.Item>Blog</Menu.Item>
|
||||
<Menu.Item>About</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
```
|
||||
|
||||
How can we define a component like `Menu`? Where it has some kind of "sub-component" that is accessible through a dot notation.
|
||||
|
||||
Well, it's actually a pretty common pattern. And it's not really a sub-component, it's just another component being attached to another one.
|
||||
|
||||
Let's use the above `Menu` component for example. We'll put this component to its own dedicated file: `menu.js`. First, let's define these two components separately on this module file:
|
||||
|
||||
```jsx
|
||||
// menu.js
|
||||
import React from 'react';
|
||||
|
||||
export const MenuItem = ({ children }) => <li>{children}</li>;
|
||||
|
||||
export default const Menu = ({ children }) => <ul>{children}</ul>;
|
||||
```
|
||||
|
||||
It's just a simple functional component. The `Menu` is the parent with `ul` tag. And the `MenuItem` will act as its children. Now we can use these two components like so:
|
||||
|
||||
```jsx
|
||||
import React from "react";
|
||||
import { render } from "react-dom";
|
||||
import Menu, { MenuItem } from "./menu";
|
||||
|
||||
const App = () => (
|
||||
<Menu>
|
||||
<MenuItem>Home</MenuItem>
|
||||
<MenuItem>Blog</MenuItem>
|
||||
<MenuItem>About</MenuItem>
|
||||
</Menu>
|
||||
);
|
||||
|
||||
render(<App />, document.getElementById("root"));
|
||||
```
|
||||
|
||||
Where's the dot notation? To make our `MenuItem` component accessible through the dot nation, we can simply attach it to the `Menu` component as a static property. To do so, we can no longer use the functional component for `Menu` and switch to the class component instead:
|
||||
|
||||
```jsx
|
||||
// menu.js
|
||||
import React, { Component } from 'react';
|
||||
|
||||
export default const MenuItem = ({ children }) => <li>{children}</li>;
|
||||
|
||||
export default class Menu extends Component {
|
||||
static Item = MenuItem;
|
||||
|
||||
render() {
|
||||
return (
|
||||
<ul>{this.props.children}</ul>
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Now we can use the dot notation to declare the `MenuItem` component:
|
||||
|
||||
```jsx
|
||||
import React from "react";
|
||||
import { render } from "react-dom";
|
||||
import Menu from "./menu";
|
||||
|
||||
const App = () => (
|
||||
<Menu>
|
||||
<Menu.Item>Home</Menu.Item>
|
||||
<Menu.Item>Blog</Menu.Item>
|
||||
<Menu.Item>About</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
|
||||
render(<App />, document.getElementById("root"));
|
||||
```
|
||||
|
||||
You can also put the `MenuItem` component definition directly within the `Menu` class. But this way you can no longer import `MenuItem` individually.
|
||||
|
||||
```jsx
|
||||
import React, { Component } from "react";
|
||||
|
||||
export default class Menu extends Component {
|
||||
static Item = ({ children }) => <li>{children}</li>;
|
||||
|
||||
render() {
|
||||
return <ul>{this.props.children}</ul>;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### This article is for Demo purpose
|
||||
|
||||
The article was originally on [this repo](https://github.com/risan/risanb.com/blob/master/content/posts/react-component-with-dot-notation/index.md)
|
||||
@@ -1,318 +0,0 @@
|
||||
/**
|
||||
* Reset some basic elements
|
||||
*/
|
||||
html {
|
||||
overflow-x: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
body,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
p,
|
||||
blockquote,
|
||||
pre,
|
||||
hr,
|
||||
dl,
|
||||
dd,
|
||||
ol,
|
||||
ul,
|
||||
figure {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic styling
|
||||
*/
|
||||
body {
|
||||
min-height: 100vh;
|
||||
overflow-x: hidden;
|
||||
position: relative;
|
||||
background: $base;
|
||||
font: $base-font-weight #{$base-font-size}/#{$base-line-height} $second-font-family;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-webkit-font-feature-settings: "kern"1;
|
||||
-moz-font-feature-settings: "kern"1;
|
||||
-o-font-feature-settings: "kern"1;
|
||||
font-feature-settings: "kern"1;
|
||||
font-kerning: normal;
|
||||
border-top: 5px solid $black;
|
||||
box-sizing: border-box;
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
$base-font-size: 18px;
|
||||
font: $base-font-weight #{$base-font-size}/#{$base-line-height} $second-font-family;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set `margin-bottom` to maintain vertical rhythm
|
||||
*/
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
p,
|
||||
blockquote,
|
||||
pre,
|
||||
ul,
|
||||
ol,
|
||||
dl,
|
||||
figure,
|
||||
%vertical-rhythm {
|
||||
margin-top: $spacing-unit - 20;
|
||||
margin-bottom: $spacing-unit - 20;
|
||||
}
|
||||
|
||||
kbd {
|
||||
-moz-border-radius: 3px;
|
||||
-moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px $white inset;
|
||||
-webkit-border-radius: 3px;
|
||||
-webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px $white inset;
|
||||
background-color: #f7f7f7;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px $white inset;
|
||||
color: #333;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
line-height: 1.4;
|
||||
font-family: $syntax-font-family;
|
||||
margin: 0 .1em;
|
||||
padding: .1em .6em;
|
||||
text-shadow: 0 1px 0 $white;
|
||||
}
|
||||
|
||||
/**
|
||||
* Images
|
||||
*/
|
||||
img {
|
||||
max-width: 100%;
|
||||
vertical-align: middle;
|
||||
-webkit-user-drag: none;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/**
|
||||
* Figures
|
||||
*/
|
||||
figure {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Images
|
||||
*/
|
||||
figure>img {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Caption Image
|
||||
*/
|
||||
figcaption {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists
|
||||
*/
|
||||
ul,
|
||||
ol {
|
||||
margin-left: $spacing-unit - 10;
|
||||
}
|
||||
|
||||
li {
|
||||
padding-bottom: 1px;
|
||||
padding-top: 1px;
|
||||
|
||||
>ul,
|
||||
>ol {
|
||||
margin-bottom: 2px;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Headings
|
||||
*/
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-weight: $base-font-weight;
|
||||
}
|
||||
|
||||
h1>a,
|
||||
h2>a,
|
||||
h3>a,
|
||||
h4>a,
|
||||
h5>a,
|
||||
h6>a {
|
||||
text-decoration: none;
|
||||
border: none;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Links
|
||||
*/
|
||||
a {
|
||||
color: $black;
|
||||
border-bottom: 1px solid $smoke;
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
color: $black;
|
||||
border-bottom: 2px solid $blue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Del
|
||||
*/
|
||||
del {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Em
|
||||
*/
|
||||
em {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Blockquotes
|
||||
*/
|
||||
blockquote {
|
||||
color: $gray;
|
||||
font-style: italic;
|
||||
text-align: center;
|
||||
opacity: .9;
|
||||
border-top: 1px solid $light;
|
||||
border-bottom: 1px solid $light;
|
||||
padding: 10px;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
font-size: 1em;
|
||||
|
||||
> :last-child {
|
||||
margin-bottom: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper
|
||||
*/
|
||||
.wrapper {
|
||||
max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit} * 2));
|
||||
max-width: calc(#{$content-width} - (#{$spacing-unit} * 2));
|
||||
position: relative;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
padding-right: $spacing-unit;
|
||||
padding-left: $spacing-unit;
|
||||
@extend %clearfix;
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit}));
|
||||
max-width: calc(#{$content-width} - (#{$spacing-unit}));
|
||||
padding-right: $spacing-unit - 10;
|
||||
padding-left: $spacing-unit - 10;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Small
|
||||
*/
|
||||
small {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Superscript
|
||||
*/
|
||||
sup {
|
||||
padding: 0px 4px;
|
||||
border-radius: 10%;
|
||||
top: -3px;
|
||||
left: 2px;
|
||||
font-size: small;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Table
|
||||
*/
|
||||
table {
|
||||
margin: 0 auto;
|
||||
border-collapse: collapse;
|
||||
background: $white;
|
||||
font-family: $first-font-family;
|
||||
font-size: $small-font-size;
|
||||
|
||||
th {
|
||||
font-weight: 700;
|
||||
background: #f5f5f5;
|
||||
text-align: left;
|
||||
border-bottom: 2px solid #f5f5f5;
|
||||
}
|
||||
|
||||
th,
|
||||
td,
|
||||
tr {
|
||||
border: 1px solid $light;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clearfix
|
||||
*/
|
||||
%clearfix:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/**
|
||||
* When mouse block a text set this color
|
||||
*/
|
||||
::selection {
|
||||
// background: transparent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Github Gist clear border
|
||||
*/
|
||||
.gist {
|
||||
table {
|
||||
border: 0;
|
||||
|
||||
tr,
|
||||
td {
|
||||
border: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,458 +0,0 @@
|
||||
@charset "utf-8";
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu72xKOzY.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu5mxKOzY.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7mxKOzY.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4WxKOzY.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7WxKOzY.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7GxKOzY.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxK.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfBBc4.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fBBc4.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7qsDJT9g.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7jsDJT9g.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7rsDJT9g.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7ksDJT9g.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7osDJT9g.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7psDJT9g.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7nsDI.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold Italic'), local('SourceSansPro-BoldItalic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZclSdh18Smxg.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold Italic'), local('SourceSansPro-BoldItalic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZclSdo18Smxg.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold Italic'), local('SourceSansPro-BoldItalic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZclSdg18Smxg.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold Italic'), local('SourceSansPro-BoldItalic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZclSdv18Smxg.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold Italic'), local('SourceSansPro-BoldItalic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZclSdj18Smxg.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold Italic'), local('SourceSansPro-BoldItalic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZclSdi18Smxg.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold Italic'), local('SourceSansPro-BoldItalic'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZclSds18Q.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNa7lqDY.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qPK7lqDY.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNK7lqDY.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qO67lqDY.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qN67lqDY.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNq7lqDY.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7l.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmhduz8A.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwkxduz8A.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmxduz8A.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlBduz8A.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmBduz8A.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmRduz8A.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlxdu.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
@import url(https://cdn.jsdelivr.net/gh/tonsky/FiraCode@1.207/distr/fira_code.css);
|
||||
@@ -1,307 +0,0 @@
|
||||
/**
|
||||
* Site intro
|
||||
*/
|
||||
|
||||
.introduction {
|
||||
margin-top: 5em;
|
||||
margin-bottom: 4em;
|
||||
text-align: center;
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
margin-bottom: 3em;
|
||||
}
|
||||
|
||||
.introduction-image {
|
||||
width: 103px;
|
||||
height: 103px;
|
||||
user-select: none;
|
||||
border-radius: 100%;
|
||||
-ms-user-select: none;
|
||||
background: #d8deff;
|
||||
-webkit-user-select: none;
|
||||
border: 6px solid #eef1ff;
|
||||
animation: 0.5s ease-in forwards weeng;
|
||||
box-shadow: 0px 0px 2px 9px #f6f6fa;
|
||||
|
||||
&::after {
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
content: "";
|
||||
position: absolute;
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.introduction-name {
|
||||
margin-top: 8px;
|
||||
font-size: 1.5em;
|
||||
font-weight: 600;
|
||||
font-family: $first-font-family;
|
||||
}
|
||||
|
||||
.introduction-description {
|
||||
padding: 10px;
|
||||
margin: 0 auto;
|
||||
font-size: 16px;
|
||||
color: $gray;
|
||||
opacity: 0.9;
|
||||
max-width: 393px;
|
||||
font-family: $first-font-family;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Site navbar
|
||||
*/
|
||||
|
||||
.navbar {
|
||||
height: auto;
|
||||
max-width: -webkit-calc(890px - (#{$spacing-unit} * 2));
|
||||
max-width: calc(890px - (#{$spacing-unit} * 2));
|
||||
position: relative;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
border-bottom: 1px solid $light;
|
||||
padding: $spacing-unit - 15px $spacing-unit;
|
||||
@extend %clearfix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Site nav
|
||||
*/
|
||||
|
||||
.menu {
|
||||
.trigger {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.menu-trigger {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.menu-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.menu-link {
|
||||
color: $black;
|
||||
font-family: $first-font-family;
|
||||
line-height: $base-line-height - 0.5;
|
||||
text-decoration: none;
|
||||
border-radius: 2px;
|
||||
padding: 5px 8px;
|
||||
border: 0;
|
||||
font-size: $small-font-size - 1;
|
||||
opacity: 0.7;
|
||||
letter-spacing: 0.5px;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&:not(:last-child) {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
opacity: .8;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-link.active {
|
||||
opacity: 1;
|
||||
border-radius: 4em 1em 2em 1em / 1em 5em 1em 3em;
|
||||
color: $blue;
|
||||
background-color: $light;
|
||||
}
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 2;
|
||||
text-align: center;
|
||||
height: 50px;
|
||||
background: $white;
|
||||
border-bottom: 1px solid $light;
|
||||
|
||||
label[for="nav-trigger"] {
|
||||
display: block;
|
||||
float: right;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
z-index: 2;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.menu-icon {
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
width: 50px;
|
||||
height: 20px;
|
||||
line-height: 0;
|
||||
padding-top: 15px;
|
||||
text-align: center;
|
||||
z-index: 10;
|
||||
|
||||
>svg path {
|
||||
fill: $black;
|
||||
}
|
||||
}
|
||||
|
||||
input[type="checkbox"]:not(:checked)~.trigger {
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
input[type="checkbox"]:checked~.trigger {
|
||||
position: fixed;
|
||||
animation: 0.2s ease-in forwards weeng;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: rgba(255, 255, 255, 0.97);
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.menu-link {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
font-size: 1em;
|
||||
|
||||
&:not(:last-child) {
|
||||
margin-right: 0;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.post-header {
|
||||
font-size: 1.2em;
|
||||
font-family: $first-font-family;
|
||||
text-transform: capitalize;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.posts {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 6px;
|
||||
display: flex;
|
||||
@extend %clearfix;
|
||||
|
||||
&:not(:first-child) {
|
||||
border-top: 1px solid $light;
|
||||
}
|
||||
|
||||
.posts-header {
|
||||
display: inline;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.posts-date {
|
||||
font-family: $first-font-family;
|
||||
font-size: 17px;
|
||||
min-width: 55px;
|
||||
color: $gray;
|
||||
padding-right: 10px;
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.posts-title {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 0;
|
||||
font-family: $second-font-family;
|
||||
font-weight: normal;
|
||||
font-size: 1em;
|
||||
display: inherit;
|
||||
|
||||
a {
|
||||
color: $blue;
|
||||
text-decoration: none;
|
||||
line-height: 22px;
|
||||
|
||||
&:hover,
|
||||
&focus {
|
||||
color: $black;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Animation
|
||||
*/
|
||||
|
||||
@keyframes weeng {
|
||||
0% {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Responsive Embed : vidio
|
||||
*/
|
||||
|
||||
.embed-responsive {
|
||||
height: 0;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
padding-bottom: 56.25%;
|
||||
margin-top: 20px;
|
||||
|
||||
iframe,
|
||||
object,
|
||||
embed {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Site footer
|
||||
*/
|
||||
.footer {
|
||||
color: $gray;
|
||||
margin-top: 8em;
|
||||
margin-bottom: 2em;
|
||||
text-align: center;
|
||||
font-size: $small-font-size;
|
||||
font-family: $first-font-family;
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
margin-top: 3em;
|
||||
}
|
||||
|
||||
b:not(:last-child) {
|
||||
color: $black;
|
||||
}
|
||||
|
||||
a {
|
||||
border: 0;
|
||||
color: $gray;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
border-bottom: 2px solid $blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
339
_sass/klise/_base.scss
Normal file
@@ -0,0 +1,339 @@
|
||||
// Reset some basic elements
|
||||
html {
|
||||
overflow-x: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
body,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
p,
|
||||
blockquote,
|
||||
pre,
|
||||
hr,
|
||||
dl,
|
||||
dd,
|
||||
ol,
|
||||
ul,
|
||||
figure {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
// Basic styling
|
||||
body {
|
||||
min-height: 100vh;
|
||||
overflow-x: hidden;
|
||||
position: relative;
|
||||
color: $text-base-color;
|
||||
background-color: $white;
|
||||
font: $normal-weight #{$base-font-size}/#{$base-line-height} $sans-family;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-webkit-font-feature-settings: "kern" 1;
|
||||
-moz-font-feature-settings: "kern" 1;
|
||||
-o-font-feature-settings: "kern" 1;
|
||||
font-feature-settings: "kern" 1;
|
||||
font-kerning: normal;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
// Set `margin-bottom` to maintain vertical rhythm
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
p,
|
||||
blockquote,
|
||||
pre,
|
||||
ul,
|
||||
ol,
|
||||
dl,
|
||||
figure,
|
||||
%vertical-rhythm {
|
||||
margin-top: $spacing-full - 20;
|
||||
margin-bottom: $spacing-full - 20;
|
||||
}
|
||||
|
||||
// strong | bold
|
||||
strong,
|
||||
b {
|
||||
font-weight: $bold-weight;
|
||||
color: $black;
|
||||
}
|
||||
|
||||
// horizontal rule
|
||||
hr {
|
||||
border-bottom: 0;
|
||||
border-style: solid;
|
||||
border-color: $light;
|
||||
}
|
||||
|
||||
// kbd tag
|
||||
kbd {
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border: 1px solid $light;
|
||||
border-radius: 2px;
|
||||
color: $black;
|
||||
display: inline-block;
|
||||
font-size: $small-font-size;
|
||||
line-height: 1.4;
|
||||
font-family: $mono-family;
|
||||
margin: 0 0.1em;
|
||||
font-weight: $bold-weight;
|
||||
padding: 0.01em 0.4em;
|
||||
text-shadow: 0 1px 0 $white;
|
||||
}
|
||||
|
||||
// Image
|
||||
img {
|
||||
max-width: 100%;
|
||||
vertical-align: middle;
|
||||
-webkit-user-drag: none;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
// Figure
|
||||
figure {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
// Image inside Figure tag
|
||||
figure > img {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
// Image caption
|
||||
figcaption {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
// List
|
||||
ul {
|
||||
list-style: none;
|
||||
li {
|
||||
display: list-item;
|
||||
text-align: -webkit-match-parent;
|
||||
}
|
||||
li::before {
|
||||
content: "\03BB";
|
||||
display: inline-block;
|
||||
width: 1em;
|
||||
position: relative;
|
||||
margin-left: -1em;
|
||||
font-weight: $bold-weight;
|
||||
}
|
||||
}
|
||||
|
||||
ol {
|
||||
list-style: none;
|
||||
counter-reset: li;
|
||||
li {
|
||||
position: relative;
|
||||
counter-increment: li;
|
||||
&::before {
|
||||
content: counter(li);
|
||||
display: inline-block;
|
||||
width: 1em;
|
||||
margin-right: 0.5em;
|
||||
margin-left: -1.6em;
|
||||
text-align: right;
|
||||
direction: rtl;
|
||||
font-weight: $bold-weight;
|
||||
font-size: $small-font-size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul,
|
||||
ol {
|
||||
margin-top: 0;
|
||||
margin-left: $spacing-full;
|
||||
}
|
||||
|
||||
li {
|
||||
padding-bottom: 1px;
|
||||
padding-top: 1px;
|
||||
|
||||
&:before {
|
||||
color: $black;
|
||||
}
|
||||
|
||||
> ul,
|
||||
> ol {
|
||||
margin-bottom: 2px;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Headings
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
color: $black;
|
||||
font-weight: $bold-weight;
|
||||
& + ul,
|
||||
& + ol {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
// Headings with link
|
||||
h1 > a,
|
||||
h2 > a,
|
||||
h3 > a,
|
||||
h4 > a,
|
||||
h5 > a,
|
||||
h6 > a {
|
||||
text-decoration: none;
|
||||
border: none;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
// Link
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration-color: $smoke;
|
||||
|
||||
&:hover {
|
||||
color: $text-link-blue;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: 3px solid rgba(0, 54, 199, 0.6);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
// Del
|
||||
del {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
// Em
|
||||
em {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
// Blockquotes
|
||||
blockquote {
|
||||
color: $gray;
|
||||
font-style: italic;
|
||||
text-align: center;
|
||||
opacity: 0.9;
|
||||
border-top: 1px solid $light;
|
||||
border-bottom: 1px solid $light;
|
||||
padding: 10px;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
font-size: 1em;
|
||||
|
||||
> :last-child {
|
||||
margin-bottom: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Wrapper
|
||||
.wrapper {
|
||||
max-width: -webkit-calc(#{$narrow-size} - (#{$spacing-full} * 2));
|
||||
max-width: calc(#{$narrow-size} - (#{$spacing-full} * 2));
|
||||
position: relative;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
padding-right: $spacing-full;
|
||||
padding-left: $spacing-full;
|
||||
@extend %clearfix;
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
max-width: -webkit-calc(#{$narrow-size} - (#{$spacing-full}));
|
||||
max-width: calc(#{$narrow-size} - (#{$spacing-full}));
|
||||
padding-right: $spacing-full - 10;
|
||||
padding-left: $spacing-full - 10;
|
||||
}
|
||||
}
|
||||
|
||||
// Underline
|
||||
u {
|
||||
text-decoration-color: #d2c7c7;
|
||||
}
|
||||
|
||||
// Small
|
||||
small {
|
||||
font-size: $small-font-size;
|
||||
}
|
||||
|
||||
// Superscript
|
||||
sup {
|
||||
border-radius: 10%;
|
||||
top: -3px;
|
||||
left: 2px;
|
||||
font-size: small;
|
||||
position: relative;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
// Table
|
||||
table {
|
||||
margin: 0 auto;
|
||||
border-collapse: collapse;
|
||||
background: $white;
|
||||
font-size: $small-font-size;
|
||||
|
||||
th {
|
||||
font-weight: $bold-weight;
|
||||
background: #f5f5f5;
|
||||
text-align: left;
|
||||
border-bottom: 2px solid #f5f5f5;
|
||||
}
|
||||
|
||||
th,
|
||||
td,
|
||||
tr {
|
||||
border: 1px solid $light;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
}
|
||||
|
||||
// Clearfix
|
||||
%clearfix:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
// When mouse block a text set this color
|
||||
mark,
|
||||
::selection {
|
||||
background: #fffba0;
|
||||
color: $black;
|
||||
}
|
||||
|
||||
// Github Gist clear border
|
||||
.gist {
|
||||
table {
|
||||
border: 0;
|
||||
|
||||
tr,
|
||||
td {
|
||||
border: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
218
_sass/klise/_dark.scss
Normal file
@@ -0,0 +1,218 @@
|
||||
body[data-theme="dark"] {
|
||||
color: $dark-text-base-color;
|
||||
background-color: $dark-black;
|
||||
|
||||
// Heading
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
color: $dark-white;
|
||||
}
|
||||
|
||||
// Post
|
||||
.page-content {
|
||||
a {
|
||||
color: $dark-text-link-blue;
|
||||
|
||||
&:hover,
|
||||
&:active,
|
||||
&:focus {
|
||||
color: $dark-text-link-blue-active;
|
||||
}
|
||||
}
|
||||
|
||||
h3 {
|
||||
border-color: $dark-light;
|
||||
}
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
.anchor-head {
|
||||
color: $dark-text-link-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Syntax
|
||||
code {
|
||||
&.highlighter-rouge {
|
||||
background-color: $dark-light;
|
||||
}
|
||||
}
|
||||
|
||||
// kbd tag
|
||||
kbd {
|
||||
border-color: $dark-light;
|
||||
color: $dark-white;
|
||||
text-shadow: 0 1px 0 $dark-black;
|
||||
}
|
||||
|
||||
// horizontal rule
|
||||
hr {
|
||||
border-color: $dark-light;
|
||||
}
|
||||
|
||||
// Post Meta
|
||||
.post-meta {
|
||||
color: $dark-gray;
|
||||
|
||||
time {
|
||||
&::after {
|
||||
background-color: $dark-light;
|
||||
}
|
||||
}
|
||||
|
||||
span[itemprop="author"] {
|
||||
border-color: $dark-light;
|
||||
}
|
||||
}
|
||||
|
||||
// Link
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration-color: $dark-smoke;
|
||||
|
||||
&:hover {
|
||||
color: $dark-text-link-blue;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline-color: rgba(255, 82, 119, 0.6);
|
||||
}
|
||||
}
|
||||
|
||||
// List
|
||||
li {
|
||||
&:before {
|
||||
color: $dark-white;
|
||||
}
|
||||
}
|
||||
|
||||
// Strong, Bold
|
||||
strong,
|
||||
b {
|
||||
color: $dark-white;
|
||||
}
|
||||
|
||||
// Navbar
|
||||
.navbar {
|
||||
border-color: $dark-light;
|
||||
.menu {
|
||||
a#mood {
|
||||
.mood-sunny {
|
||||
display: block;
|
||||
}
|
||||
.mood-moon {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-link {
|
||||
color: $dark-white;
|
||||
}
|
||||
@include media-query($on-mobile) {
|
||||
background-color: $dark-black;
|
||||
border-color: $dark-light;
|
||||
|
||||
.menu-icon {
|
||||
> svg {
|
||||
fill: $dark-white;
|
||||
}
|
||||
}
|
||||
|
||||
input[type="checkbox"]:checked ~ .trigger {
|
||||
background: $dark-black;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Post Item
|
||||
.post-item {
|
||||
&:not(:first-child) {
|
||||
border-color: $dark-light;
|
||||
}
|
||||
|
||||
.post-item-date {
|
||||
color: $dark-white;
|
||||
}
|
||||
.post-item-title {
|
||||
a {
|
||||
color: $dark-text-base-color;
|
||||
|
||||
&:hover,
|
||||
&focus {
|
||||
color: $dark-white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Post Navigation
|
||||
.post-nav {
|
||||
border-color: $dark-light;
|
||||
|
||||
.post-nav-item {
|
||||
font-weight: $bold-weight;
|
||||
|
||||
.post-title {
|
||||
color: $dark-white;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
.post-title {
|
||||
color: $dark-text-link-blue-active;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-arrow {
|
||||
color: $dark-gray;
|
||||
}
|
||||
}
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
.post-nav-item:nth-child(even) {
|
||||
border-color: $dark-light;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Footer
|
||||
.footer {
|
||||
span.footer_item {
|
||||
color: $dark-white;
|
||||
}
|
||||
a.footer_item:not(:last-child) {
|
||||
color: $dark-white;
|
||||
}
|
||||
.footer_theme-copyright {
|
||||
color: $dark-gray;
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
// 404 Page
|
||||
.wrapper.not-found {
|
||||
.title {
|
||||
color: $dark-white;
|
||||
text-shadow: 1px 0px 0px $dark-text-link-blue;
|
||||
}
|
||||
.phrase {
|
||||
color: $dark-text-base-color;
|
||||
}
|
||||
.solution {
|
||||
color: $dark-text-link-blue;
|
||||
}
|
||||
.solution:hover {
|
||||
color: $dark-text-link-blue-active;
|
||||
}
|
||||
}
|
||||
}
|
||||
712
_sass/klise/_fonts.scss
Normal file
@@ -0,0 +1,712 @@
|
||||
@charset "utf-8";
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local("Roboto"), local("Roboto-Regular"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu72xKOzY.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
||||
U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local("Roboto"), local("Roboto-Regular"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu5mxKOzY.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local("Roboto"), local("Roboto-Regular"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7mxKOzY.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local("Roboto"), local("Roboto-Regular"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4WxKOzY.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local("Roboto"), local("Roboto-Regular"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7WxKOzY.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local("Roboto"), local("Roboto-Regular"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7GxKOzY.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local("Roboto"), local("Roboto-Regular"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxK.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local("Roboto Bold"), local("Roboto-Bold"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
||||
U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local("Roboto Bold"), local("Roboto-Bold"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local("Roboto Bold"), local("Roboto-Bold"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local("Roboto Bold"), local("Roboto-Bold"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local("Roboto Bold"), local("Roboto-Bold"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local("Roboto Bold"), local("Roboto-Bold"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local("Roboto Bold"), local("Roboto-Bold"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfBBc4.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local("Roboto Light"), local("Roboto-Light"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
||||
U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local("Roboto Light"), local("Roboto-Light"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local("Roboto Light"), local("Roboto-Light"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local("Roboto Light"), local("Roboto-Light"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local("Roboto Light"), local("Roboto-Light"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local("Roboto Light"), local("Roboto-Light"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local("Roboto Light"), local("Roboto-Light"),
|
||||
url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fBBc4.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Italic"), local("SourceSansPro-Italic"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7qsDJT9g.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
||||
U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Italic"), local("SourceSansPro-Italic"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7jsDJT9g.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Italic"), local("SourceSansPro-Italic"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7rsDJT9g.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Italic"), local("SourceSansPro-Italic"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7ksDJT9g.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Italic"), local("SourceSansPro-Italic"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7osDJT9g.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Italic"), local("SourceSansPro-Italic"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7psDJT9g.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Italic"), local("SourceSansPro-Italic"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7nsDI.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Regular"), local("SourceSansPro-Regular"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNa7lqDY.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
||||
U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Regular"), local("SourceSansPro-Regular"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qPK7lqDY.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Regular"), local("SourceSansPro-Regular"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNK7lqDY.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Regular"), local("SourceSansPro-Regular"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qO67lqDY.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Regular"), local("SourceSansPro-Regular"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qN67lqDY.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Regular"), local("SourceSansPro-Regular"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNq7lqDY.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Source Sans Pro Regular"), local("SourceSansPro-Regular"),
|
||||
url(https://fonts.gstatic.com/s/sourcesanspro/v13/6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7l.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
// UBUNTU MONO
|
||||
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Italic"), local("UbuntuMono-Italic"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFOhCneDtsqEr0keqCMhbCc_OsvSkLBP.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
||||
U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Italic"), local("UbuntuMono-Italic"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFOhCneDtsqEr0keqCMhbCc_OsLSkLBP.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Italic"), local("UbuntuMono-Italic"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFOhCneDtsqEr0keqCMhbCc_OsrSkLBP.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Italic"), local("UbuntuMono-Italic"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFOhCneDtsqEr0keqCMhbCc_OsXSkLBP.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Italic"), local("UbuntuMono-Italic"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFOhCneDtsqEr0keqCMhbCc_OsjSkLBP.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Italic"), local("UbuntuMono-Italic"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFOhCneDtsqEr0keqCMhbCc_OsbSkA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Bold Italic"), local("UbuntuMono-BoldItalic"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFO8CneDtsqEr0keqCMhbCc_Mn33hYJufkO1.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
||||
U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Bold Italic"), local("UbuntuMono-BoldItalic"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFO8CneDtsqEr0keqCMhbCc_Mn33hYtufkO1.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Bold Italic"), local("UbuntuMono-BoldItalic"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFO8CneDtsqEr0keqCMhbCc_Mn33hYNufkO1.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Bold Italic"), local("UbuntuMono-BoldItalic"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFO8CneDtsqEr0keqCMhbCc_Mn33hYxufkO1.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Bold Italic"), local("UbuntuMono-BoldItalic"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFO8CneDtsqEr0keqCMhbCc_Mn33hYFufkO1.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Bold Italic"), local("UbuntuMono-BoldItalic"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFO8CneDtsqEr0keqCMhbCc_Mn33hY9ufg.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono"), local("UbuntuMono-Regular"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFOjCneDtsqEr0keqCMhbCc3CsTKlA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
||||
U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono"), local("UbuntuMono-Regular"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFOjCneDtsqEr0keqCMhbCc-CsTKlA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono"), local("UbuntuMono-Regular"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFOjCneDtsqEr0keqCMhbCc2CsTKlA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono"), local("UbuntuMono-Regular"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFOjCneDtsqEr0keqCMhbCc5CsTKlA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono"), local("UbuntuMono-Regular"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFOjCneDtsqEr0keqCMhbCc0CsTKlA.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono"), local("UbuntuMono-Regular"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFOjCneDtsqEr0keqCMhbCc6CsQ.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Bold"), local("UbuntuMono-Bold"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFO-CneDtsqEr0keqCMhbC-BL9H4tY12eg.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
||||
U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Bold"), local("UbuntuMono-Bold"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFO-CneDtsqEr0keqCMhbC-BL9HxtY12eg.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Bold"), local("UbuntuMono-Bold"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFO-CneDtsqEr0keqCMhbC-BL9H5tY12eg.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Bold"), local("UbuntuMono-Bold"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFO-CneDtsqEr0keqCMhbC-BL9H2tY12eg.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Bold"), local("UbuntuMono-Bold"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFO-CneDtsqEr0keqCMhbC-BL9H7tY12eg.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: "Ubuntu Mono";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local("Ubuntu Mono Bold"), local("UbuntuMono-Bold"),
|
||||
url(https://fonts.gstatic.com/s/ubuntumono/v9/KFO-CneDtsqEr0keqCMhbC-BL9H1tY0.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
321
_sass/klise/_layout.scss
Normal file
@@ -0,0 +1,321 @@
|
||||
// Navbar
|
||||
.navbar {
|
||||
height: auto;
|
||||
max-width: calc(#{$wide-size} - (#{$spacing-full} * 2));
|
||||
max-width: -webkit-calc(#{$wide-size} - (#{$spacing-full} * 2));
|
||||
position: relative;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
border-bottom: 1px solid $light;
|
||||
padding: $spacing-full - 15px $spacing-full;
|
||||
@extend %clearfix;
|
||||
}
|
||||
|
||||
// Navigation
|
||||
.menu {
|
||||
user-select: none;
|
||||
-ms-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
|
||||
a#mood {
|
||||
float: left;
|
||||
left: 8px;
|
||||
top: 6px;
|
||||
position: relative;
|
||||
clear: both;
|
||||
-webkit-transform: scale(1, 1);
|
||||
transform: scale(1, 1);
|
||||
opacity: 0.7;
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
opacity: 1;
|
||||
}
|
||||
&:active {
|
||||
-webkit-transform: scale(0.9, 0.9);
|
||||
transform: scale(0.9, 0.9);
|
||||
}
|
||||
.mood-moon {
|
||||
display: block;
|
||||
line {
|
||||
stroke: $black;
|
||||
fill: none;
|
||||
}
|
||||
|
||||
circle {
|
||||
fill: $black;
|
||||
stroke: $black;
|
||||
}
|
||||
}
|
||||
.mood-sunny {
|
||||
display: none;
|
||||
line {
|
||||
stroke: $dark-white;
|
||||
fill: none;
|
||||
}
|
||||
circle {
|
||||
fill: none;
|
||||
stroke: $dark-white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.trigger {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.menu-trigger {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.menu-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.menu-link {
|
||||
color: $black;
|
||||
line-height: $base-line-height + 0.4;
|
||||
text-decoration: none;
|
||||
padding: 5px 8px;
|
||||
opacity: 0.7;
|
||||
letter-spacing: 0.3px;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&:not(:last-child) {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
&.rss {
|
||||
position: relative;
|
||||
bottom: -3px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-link.active {
|
||||
opacity: 1;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 2;
|
||||
text-align: center;
|
||||
height: 50px;
|
||||
background-color: $white;
|
||||
border-bottom: 1px solid $light;
|
||||
|
||||
a#mood {
|
||||
left: 10px;
|
||||
top: 12px;
|
||||
}
|
||||
|
||||
.menu-icon {
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
width: 50px;
|
||||
height: 23px;
|
||||
line-height: 0;
|
||||
padding-top: 13px;
|
||||
padding-bottom: 15px;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
z-index: 10;
|
||||
> svg {
|
||||
fill: $black;
|
||||
opacity: 0.7;
|
||||
}
|
||||
&:hover {
|
||||
> svg {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
&:active {
|
||||
-webkit-transform: scale(0.9, 0.9);
|
||||
transform: scale(0.9, 0.9);
|
||||
}
|
||||
}
|
||||
|
||||
input[type="checkbox"]:not(:checked) ~ .trigger {
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
input[type="checkbox"]:checked ~ .trigger {
|
||||
position: fixed;
|
||||
animation: 0.2s ease-in forwards fadein;
|
||||
-webkit-animation: 0.2s ease-in forwards fadein;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: $white;
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.menu-link {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
font-size: 1.1em;
|
||||
|
||||
&:not(:last-child) {
|
||||
margin: 0;
|
||||
padding: 2px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Author
|
||||
.author {
|
||||
margin-top: 6.3rem;
|
||||
margin-bottom: 7.2rem;
|
||||
text-align: center;
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
margin-bottom: 3em;
|
||||
}
|
||||
|
||||
.author-avatar {
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
border-radius: 100%;
|
||||
user-select: none;
|
||||
background-color: $black;
|
||||
-ms-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-webkit-animation: 0.5s ease-in forwards fadein;
|
||||
animation: 0.5s ease-in forwards fadein;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.author-name {
|
||||
font-size: 1.7em;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.author-bio {
|
||||
margin: 0 auto;
|
||||
opacity: 0.9;
|
||||
max-width: 393px;
|
||||
line-height: 1.688;
|
||||
}
|
||||
}
|
||||
|
||||
// Content
|
||||
.posts-item-note {
|
||||
font-weight: 700;
|
||||
margin-bottom: 5px;
|
||||
color: $black;
|
||||
}
|
||||
|
||||
// List of posts
|
||||
.post-item {
|
||||
display: flex;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 6px;
|
||||
@extend %clearfix;
|
||||
|
||||
&:not(:first-child) {
|
||||
border-top: 1px solid $light;
|
||||
}
|
||||
|
||||
.post-item-date {
|
||||
min-width: 96px;
|
||||
color: $black;
|
||||
font-weight: 700;
|
||||
padding-right: 10px;
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.post-item-title {
|
||||
margin: 0;
|
||||
color: $text-base-color;
|
||||
font-weight: normal;
|
||||
letter-spacing: 0.1px;
|
||||
|
||||
a {
|
||||
&:hover,
|
||||
&focus {
|
||||
color: $black;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Footer
|
||||
.footer {
|
||||
margin-top: 8em;
|
||||
margin-bottom: 2em;
|
||||
text-align: center;
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
margin-top: 3em;
|
||||
}
|
||||
span.footer_item {
|
||||
color: $black;
|
||||
opacity: 0.8;
|
||||
font-weight: $bold-weight;
|
||||
font-size: $small-font-size;
|
||||
}
|
||||
a.footer_item {
|
||||
color: $black;
|
||||
opacity: 0.8;
|
||||
text-decoration: none;
|
||||
|
||||
&:not(:last-child) {
|
||||
margin-right: 10px;
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.footer_theme-copyright {
|
||||
font-size: $small-font-size - 1;
|
||||
margin-top: 3px;
|
||||
display: block;
|
||||
color: $gray;
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
.wrapper.not-found {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
height: 75vh;
|
||||
.title {
|
||||
font-size: 5em;
|
||||
font-weight: $bold-weight;
|
||||
line-height: 1.1;
|
||||
color: $black;
|
||||
text-shadow: 1px 0px 0px $text-link-blue;
|
||||
}
|
||||
.phrase {
|
||||
color: $text-base-color;
|
||||
}
|
||||
.solution {
|
||||
color: $text-link-blue;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
.solution:hover {
|
||||
color: $text-link-blue-active;
|
||||
}
|
||||
}
|
||||
30
_sass/klise/_miscellaneous.scss
Normal file
@@ -0,0 +1,30 @@
|
||||
// Animation fade-in
|
||||
@keyframes fadein {
|
||||
0% {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0.99;
|
||||
}
|
||||
}
|
||||
|
||||
// Responsive embed video
|
||||
.embed-responsive {
|
||||
height: 0;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
padding-bottom: 56.25%;
|
||||
margin-top: 20px;
|
||||
|
||||
iframe,
|
||||
object,
|
||||
embed {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
@@ -1,55 +1,60 @@
|
||||
// Post wrapper
|
||||
.wrapper.post {
|
||||
max-width: -webkit-calc(#{660px} - (#{$spacing-unit} * 2));
|
||||
max-width: calc(#{660px} - (#{$spacing-unit} * 2));
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
padding-left: $spacing-unit - 10;
|
||||
padding-right: $spacing-unit - 10;
|
||||
padding-left: $spacing-half;
|
||||
padding-right: $spacing-half;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post title
|
||||
*/
|
||||
// Post title
|
||||
.header {
|
||||
margin-top: 125px;
|
||||
margin-top: 7.8em;
|
||||
margin-bottom: 3em;
|
||||
|
||||
.tags {
|
||||
margin-left: 3px;
|
||||
letter-spacing: 0.5px;
|
||||
|
||||
.tag {
|
||||
font-weight: $bold-weight;
|
||||
font-size: $small-font-size - 2;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.header-title {
|
||||
text-align: center;
|
||||
font-size: 2em;
|
||||
font-family: $first-font-family;
|
||||
line-height: 1.2;
|
||||
font-weight: 700;
|
||||
color: $black;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
&.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@include media-query($on-mobile) {
|
||||
font-size: 1.9em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post meta
|
||||
*/
|
||||
// Post meta
|
||||
.post-meta {
|
||||
font-family: $first-font-family;
|
||||
text-align: center;
|
||||
font-size: $small-font-size;
|
||||
margin-bottom: 5em;
|
||||
padding-top: 3px;
|
||||
line-height: 1.3;
|
||||
color: $gray;
|
||||
|
||||
time {
|
||||
color: $gray;
|
||||
position: relative;
|
||||
margin-right: 24px;
|
||||
margin-right: 1.5em;
|
||||
|
||||
&::after {
|
||||
background: $light;
|
||||
bottom: 1px;
|
||||
content: " ";
|
||||
display: block;
|
||||
height: 2px;
|
||||
position: absolute;
|
||||
right: -20px;
|
||||
@@ -58,35 +63,12 @@
|
||||
}
|
||||
|
||||
span[itemprop="author"] {
|
||||
color: $gray;
|
||||
border-bottom: 1px dotted $light;
|
||||
}
|
||||
|
||||
.tags {
|
||||
max-width: 200px;
|
||||
margin: 27px auto 0 auto;
|
||||
|
||||
.tag {
|
||||
color: $gray;
|
||||
line-height: 1;
|
||||
font-weight: 800;
|
||||
display: inline-block;
|
||||
font-size: $small-font-size - 2;
|
||||
border-bottom: 2px solid $light;
|
||||
|
||||
&:hover {
|
||||
color: $black;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post content
|
||||
*/
|
||||
// Post content
|
||||
.page-content {
|
||||
font-size: 1em;
|
||||
color: $gray;
|
||||
padding-top: 8px;
|
||||
|
||||
iframe {
|
||||
@@ -94,8 +76,6 @@
|
||||
}
|
||||
|
||||
figure {
|
||||
margin: auto -2em;
|
||||
|
||||
img {
|
||||
border-radius: 2px;
|
||||
}
|
||||
@@ -103,14 +83,35 @@
|
||||
figcaption {
|
||||
margin-top: 5px;
|
||||
font-style: italic;
|
||||
font-size: 15px;
|
||||
font-size: $small-font-size;
|
||||
}
|
||||
}
|
||||
|
||||
>p {
|
||||
a {
|
||||
color: $text-link-blue;
|
||||
text-decoration: none;
|
||||
&[target="_blank"]::after {
|
||||
content: " \2197";
|
||||
font-size: $small-font-size;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
bottom: 5px;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: $text-link-blue-active;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
color: $text-link-blue;
|
||||
}
|
||||
}
|
||||
|
||||
> p {
|
||||
margin: 0;
|
||||
padding-top: $spacing-unit - 15;
|
||||
padding-bottom: $spacing-unit - 15;
|
||||
padding-top: $spacing-full - 15;
|
||||
padding-bottom: $spacing-full - 15;
|
||||
}
|
||||
|
||||
ul.task-list {
|
||||
@@ -123,7 +124,7 @@
|
||||
}
|
||||
|
||||
dl dt {
|
||||
font-weight: 700;
|
||||
font-weight: $bold-weight;
|
||||
}
|
||||
|
||||
h1,
|
||||
@@ -132,29 +133,49 @@
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-family: $first-font-family;
|
||||
color: $black;
|
||||
font-weight: 700;
|
||||
margin-top: $spacing-unit;
|
||||
font-weight: $bold-weight;
|
||||
margin-top: $spacing-full;
|
||||
margin-bottom: 0;
|
||||
|
||||
&:hover {
|
||||
.anchor-head {
|
||||
color: $text-link-blue;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.anchor-head {
|
||||
position: relative;
|
||||
opacity: 0;
|
||||
outline: none;
|
||||
|
||||
&::before {
|
||||
content: "#";
|
||||
position: absolute;
|
||||
right: -3px;
|
||||
width: 1em;
|
||||
font-weight: $bold-weight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
h1 {
|
||||
@include relative-font-size(1.75);
|
||||
@include relative-font-size(1.5);
|
||||
}
|
||||
|
||||
h2 {
|
||||
@include relative-font-size(1.563);
|
||||
@include relative-font-size(1.375);
|
||||
}
|
||||
|
||||
h3 {
|
||||
@include relative-font-size(1.438);
|
||||
@include relative-font-size(1.25);
|
||||
border-bottom: 1px solid $light;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
@include relative-font-size(1.188);
|
||||
@include relative-font-size(1.25);
|
||||
}
|
||||
|
||||
h5 {
|
||||
@@ -166,15 +187,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
hr {
|
||||
border-bottom: 0;
|
||||
border-style: solid;
|
||||
border-color: $light;
|
||||
}
|
||||
|
||||
.post-nav {
|
||||
font-family: $first-font-family;
|
||||
font-size: $small-font-size;
|
||||
display: flex;
|
||||
position: relative;
|
||||
margin-top: 5em;
|
||||
@@ -183,20 +196,26 @@ hr {
|
||||
|
||||
.post-nav-item {
|
||||
border-bottom: 0;
|
||||
font-weight: 800;
|
||||
font-weight: $bold-weight;
|
||||
padding-bottom: 10px;
|
||||
|
||||
.post-title {
|
||||
color: $black;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
h4 {
|
||||
color: $blue;
|
||||
.post-title {
|
||||
color: $text-link-blue-active;
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
|
||||
h4 {
|
||||
color: $gray;
|
||||
.nav-arrow {
|
||||
font-weight: $normal-weight;
|
||||
font-size: $small-font-size;
|
||||
margin: 0;
|
||||
color: $gray;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
width: 50%;
|
||||
@@ -232,3 +251,7 @@ hr {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.post-updated-at {
|
||||
font-family: "Ubuntu mono", "monospace";
|
||||
}
|
||||
@@ -1,44 +1,43 @@
|
||||
/**
|
||||
* Code formatting
|
||||
*/
|
||||
|
||||
// Code
|
||||
code {
|
||||
font-family: $mono-family;
|
||||
text-rendering: optimizeLegibility;
|
||||
font-feature-settings: "calt"1;
|
||||
font-feature-settings: "calt" 1;
|
||||
font-variant-ligatures: normal;
|
||||
white-space: pre;
|
||||
word-spacing: normal;
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
font-size: 15px;
|
||||
padding: 1px 4px;
|
||||
position: relative;
|
||||
top: -1px;
|
||||
border: 1px solid #d8d8d8;
|
||||
background-color: #f6f6f6;
|
||||
border-radius: 2px;
|
||||
font-family: $syntax-font-family;
|
||||
font-size: 16px;
|
||||
&.highlighter-rouge {
|
||||
padding: 1px 4px;
|
||||
position: relative;
|
||||
top: -1px;
|
||||
background-color: #f6f6f6;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
// Codeblock Theme
|
||||
pre.highlight {
|
||||
margin: 0 calc(51% - 50vw);
|
||||
padding: 25px;
|
||||
line-height: 1;
|
||||
font-family: $syntax-font-family;
|
||||
margin: 0 -27px;
|
||||
@include media-query($on-mobile) {
|
||||
margin: 0 calc(51% - 51vw);
|
||||
padding-left: 20px;
|
||||
}
|
||||
border-radius: 2px;
|
||||
padding: 10px;
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
|
||||
>code {
|
||||
> code {
|
||||
width: 100%;
|
||||
max-width: 37rem;
|
||||
max-width: 50rem;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
line-height: 1.5;
|
||||
display: block;
|
||||
border: 0;
|
||||
font-variant-ligatures: normal;
|
||||
background-color: transparent;
|
||||
font-feature-settings: "calt"1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,12 +52,12 @@ pre.highlight {
|
||||
.highlight,
|
||||
.highlight .w {
|
||||
color: #fbf1c7;
|
||||
background-color: #282828;
|
||||
background-color: #1a1b21;
|
||||
}
|
||||
|
||||
.highlight .err {
|
||||
color: #fb4934;
|
||||
background-color: #282828;
|
||||
background-color: #1a1b21;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -1,30 +1,48 @@
|
||||
// Define defaults for each variable.
|
||||
$first-font-family: "Roboto",
|
||||
sans-serif !default;
|
||||
$second-font-family: "Source Sans Pro",
|
||||
sans-serif !default;
|
||||
$syntax-font-family: "Fira Code",
|
||||
monospace !default;
|
||||
$base-font-size: 19px !default;
|
||||
$medium-font-size: $base-font-size * 0.938 !default;
|
||||
$small-font-size: $base-font-size * 0.875 !default;
|
||||
$base-font-weight: 400 !default;
|
||||
$base-line-height: 1.688 !default;
|
||||
$spacing-unit: 30px !default;
|
||||
// Fonts preferences
|
||||
$sans-family: Roboto, sans-serif;
|
||||
$mono-family: Consolas, monospace;
|
||||
$base-font-size: 16px;
|
||||
$medium-font-size: $base-font-size * 0.938;
|
||||
$small-font-size: $base-font-size * 0.875;
|
||||
$base-line-height: 1.85;
|
||||
|
||||
// Light Element Color
|
||||
$black: #141414 !default;
|
||||
$white: #fff !default;
|
||||
$base: #f9f9f9 !default;
|
||||
$gray: #283c46 !default;
|
||||
$blue: #0036c7 !default;
|
||||
$light: #ececec !default;
|
||||
$smoke: #d2c7c7 !default;
|
||||
// Font weight
|
||||
// $light-weight: 300; // uncomment if necessary
|
||||
$normal-weight: 400;
|
||||
$bold-weight: 700;
|
||||
// $black-weight: 900; // uncomment if necessary
|
||||
|
||||
//Light Colors
|
||||
$text-base-color: #434648;
|
||||
$text-link-blue: #003fff;
|
||||
$text-link-blue-active: #0036c7;
|
||||
|
||||
$black: #0d122b;
|
||||
$light: #ececec;
|
||||
$smoke: #d2c7c7;
|
||||
$gray: #6b7886;
|
||||
$white: #fff;
|
||||
|
||||
// Dark Colors
|
||||
$dark-text-base-color: #d9d7e0;
|
||||
$dark-text-link-blue: #ff5277;
|
||||
$dark-text-link-blue-active: #ff2957;
|
||||
|
||||
$dark-black: #131418;
|
||||
$dark-white: #f0f8ff;
|
||||
$dark-light: #1b1d25;
|
||||
$dark-smoke: #4a4d56;
|
||||
$dark-gray: #767f87;
|
||||
|
||||
// Width of the content area
|
||||
$content-width: 750px !default;
|
||||
$wide-size: 890px;
|
||||
$narrow-size: 720px;
|
||||
|
||||
// State of device
|
||||
// Padding unit
|
||||
$spacing-full: 30px;
|
||||
$spacing-half: $spacing-full / 2;
|
||||
|
||||
// State of devices
|
||||
$on-mobile: 768px;
|
||||
$on-tablet: 769px;
|
||||
$on-desktop: 1024px;
|
||||
@@ -40,9 +58,6 @@ $on-widescreen: 1152px;
|
||||
font-size: $base-font-size * $ratio;
|
||||
}
|
||||
|
||||
// Import Sass partials
|
||||
@import "bangsring/fonts",
|
||||
"bangsring/base",
|
||||
"bangsring/layout",
|
||||
"bangsring/page",
|
||||
"bangsring/syntax";
|
||||
// Import sass files
|
||||
@import "klise/fonts", "klise/base", "klise/layout", "klise/post",
|
||||
"klise/miscellaneous", "klise/syntax", "klise/dark";
|
||||
|
||||
1
_site/404.html
Normal file
1
_site/about/index.html
Normal file
17
_site/apa-itu-shell/index.html
Normal file
BIN
_site/apa-itu-shell/kernel.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 121 KiB |
BIN
_site/apa-itu-shell/shell.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
_site/apa-itu-shell/shell_evolution.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
_site/apa-itu-shell/term_shell_prompt.png
Normal file
|
After Width: | Height: | Size: 85 KiB |
BIN
_site/apa-itu-shell/terminal_lscpu.gif
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
_site/apa-itu-shell/terminal_nginx.gif
Normal file
|
After Width: | Height: | Size: 266 KiB |
BIN
_site/apa-itu-shell/weird_guyyy.gif
Normal file
|
After Width: | Height: | Size: 3.1 MiB |
1
_site/assets/css/style.css
Normal file
BIN
_site/assets/favicons/android-chrome-96x96.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
_site/assets/favicons/apple-touch-icon.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
_site/assets/favicons/favicon-16x16.png
Normal file
|
After Width: | Height: | Size: 774 B |
BIN
_site/assets/favicons/favicon-32x32.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
_site/assets/favicons/favicon.ico
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
_site/assets/favicons/mstile-150x150.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
27
_site/assets/favicons/safari-pinned-tab.svg
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="640.000000pt" height="640.000000pt" viewBox="0 0 640.000000 640.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.11, written by Peter Selinger 2001-2013
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,640.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M2914 6389 c-433 -38 -901 -183 -1286 -399 -85 -48 -308 -191 -334
|
||||
-215 -7 -5 -26 -21 -44 -35 -245 -190 -456 -407 -634 -650 -31 -41 -59 -79
|
||||
-64 -85 -25 -30 -172 -285 -217 -376 -175 -355 -289 -759 -324 -1144 -14 -152
|
||||
-6 -560 14 -695 39 -271 108 -542 195 -762 49 -122 165 -366 188 -390 8 -10
|
||||
12 -18 9 -18 -7 0 97 -167 162 -260 137 -196 330 -411 485 -543 27 -23 56 -49
|
||||
65 -58 130 -127 455 -337 698 -450 60 -28 122 -56 138 -64 33 -16 72 -30 220
|
||||
-80 173 -58 280 -85 450 -115 33 -5 69 -12 80 -14 186 -36 671 -43 885 -12
|
||||
475 68 870 203 1245 429 98 59 271 175 297 199 7 7 31 26 53 42 22 17 42 33
|
||||
45 36 3 4 43 40 90 81 47 41 100 90 119 109 166 173 260 281 331 382 71 100
|
||||
130 187 130 192 0 3 12 24 28 48 43 68 48 77 106 188 106 206 205 467 261 688
|
||||
31 123 73 373 84 500 9 101 6 534 -4 612 -54 425 -143 732 -312 1080 -36 74
|
||||
-72 143 -81 153 -8 9 -12 17 -9 17 7 0 -96 167 -162 260 -167 238 -419 506
|
||||
-636 673 -5 4 -21 17 -35 28 -93 77 -340 233 -489 308 -223 113 -519 222 -724
|
||||
267 -74 16 -281 53 -332 59 -33 4 -73 9 -90 12 -56 8 -510 10 -601 2z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
14
_site/assets/favicons/site.webmanifest
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "Mahendrata",
|
||||
"short_name": "Mahendrata",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/assets/favicons/android-chrome-96x96.png",
|
||||
"sizes": "96x96",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
||||
BIN
_site/assets/img/avatar.jpg
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
_site/assets/img/ogp.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
1
_site/assets/js/disqus.js
Normal file
@@ -0,0 +1 @@
|
||||
!function(t,e,n){"use strict";var o=function(t,e){var n,o;return function(){var i=this,r=arguments,d=+new Date;n&&d<n+t?(clearTimeout(o),o=setTimeout(function(){n=d,e.apply(i,r)},t)):(n=d,e.apply(i,r))}},i=!1,r=!1,d=!1,s=!1,a="unloaded",u=!1,l=function(){if(!u||!e.body.contains(u)||"loaded"==u.disqusLoaderStatus)return!0;var n,o,i=t.pageYOffset,l=(n=u,o=n.getBoundingClientRect(),{top:o.top+e.body.scrollTop,left:o.left+e.body.scrollLeft}).top;if(l-i>t.innerHeight*r||i-l-u.offsetHeight-t.innerHeight*r>0)return!0;var c,f,p,y=e.getElementById("disqus_thread");y&&y.removeAttribute("id"),u.setAttribute("id","disqus_thread"),u.disqusLoaderStatus="loaded","loaded"==a?DISQUS.reset({reload:!0,config:d}):(t.disqus_config=d,"unloaded"==a&&(a="loading",c=s,f=function(){a="loaded"},(p=e.createElement("script")).src=c,p.async=!0,p.setAttribute("data-timestamp",+new Date),p.addEventListener("load",function(){"function"==typeof f&&f()}),(e.head||e.body).appendChild(p)))};t.addEventListener("scroll",o(i,l)),t.addEventListener("resize",o(i,l)),t.disqusLoader=function(t,n){n=function(t,e){var n,o={};for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n]);for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n]);return o}({laziness:1,throttle:250,scriptUrl:!1,disqusConfig:!1},n),r=n.laziness+1,i=n.throttle,d=n.disqusConfig,s=!1===s?n.scriptUrl:s,(u="string"==typeof t?e.querySelector(t):"number"==typeof t.length?t[0]:t)&&(u.disqusLoaderStatus="unloaded"),l()}}(window,document);
|
||||
1
_site/assets/js/galite.js
Normal file
@@ -0,0 +1 @@
|
||||
(function(b,l,e,g,h,f){1!==parseInt(e.msDoNotTrack||b.doNotTrack||e.doNotTrack,10)&&b.addEventListener("load",function(){var r=(new Date).getTime();b.galite=b.galite||{};var m=new XMLHttpRequest,n="https://www.google-analytics.com/collect?cid="+(l.uid=l.uid||Math.random()+"."+Math.random())+"&v=1&tid="+galite.UA+"&dl="+f(h.location.href)+"&ul=en-us&de=UTF-8",a=function(b){var d="",c;for(c in b){if(void 0===b[c])return!1;d+=f(b[c])}return d},p={dt:[h.title],sd:[g.colorDepth,"-bit"],sr:[g.availHeight,"x",g.availWidth],vp:[innerWidth,"x",innerHeight],dr:[h.referrer]},k;for(k in p){var q=k+"="+a(p[k]);q&&(n+="&"+q)}a=function(b,d){var c="",a;for(a in d)c+="&"+a+"="+f(d[a]);return function(){var a=n+c+(galite.anonymizeIp?"&aip=1":"")+"&t="+f(b)+"&z="+(new Date).getTime();if(e.sendBeacon)e.sendBeacon(a);else try{m.open("GET",a,!1),m.send()}catch(t){(new Image).src=a}}};setTimeout(a("pageview",null),100);b.addEventListener("unload",a("timing",{utc:"JS Dependencies",utv:"unload",utt:(new Date).getTime()-r}))})})(window,localStorage,navigator,screen,document,encodeURIComponent)
|
||||
35
_site/assets/js/main.js
Normal file
@@ -0,0 +1,35 @@
|
||||
(() => {
|
||||
// Theme switch
|
||||
const root = document.body;
|
||||
const themeSwitch = document.getElementById("mood");
|
||||
const themeData = root.getAttribute("data-theme");
|
||||
|
||||
if (themeSwitch) {
|
||||
initTheme(localStorage.getItem("theme"));
|
||||
themeSwitch.addEventListener("click", () =>
|
||||
toggleTheme(localStorage.getItem("theme"))
|
||||
);
|
||||
|
||||
function toggleTheme(state) {
|
||||
if (state === "dark") {
|
||||
localStorage.setItem("theme", "light");
|
||||
root.removeAttribute("data-theme");
|
||||
} else if (state === "light") {
|
||||
localStorage.setItem("theme", "dark");
|
||||
document.body.setAttribute("data-theme", "dark");
|
||||
} else {
|
||||
initTheme(state);
|
||||
}
|
||||
}
|
||||
|
||||
function initTheme(state) {
|
||||
if (state === "dark") {
|
||||
document.body.setAttribute("data-theme", "dark");
|
||||
} else if (state === "light") {
|
||||
root.removeAttribute("data-theme");
|
||||
} else {
|
||||
localStorage.setItem("theme", themeData);
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
9
_site/browserconfig.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/assets/favicons/mstile-150x150.png"/>
|
||||
<TileColor>#2c2c2c</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
||||
12
_site/cara-memperbarui-fork-repository/index.html
Normal file
BIN
_site/cara-memperbarui-fork-repository/repo.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
825
_site/feed.xml
Normal file
@@ -0,0 +1,825 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><generator uri="https://jekyllrb.com/" version="3.8.6">Jekyll</generator><link href="http://localhost:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/" rel="alternate" type="text/html" hreflang="en-US" /><updated>2020-03-09T22:32:09+07:00</updated><id>http://localhost:4000/feed.xml</id><title type="html">Klise Theme</title><subtitle>He's writing in Bahasa about web technology and experience as a journal for documentation things that he learned, meet him <a href="https://github.com/piharpi" target="_blank" rel="noopener">@github</a>.</subtitle><author><name>Klisé Theme</name><email>your-email@email.com</email></author><entry><title type="html">Cara ribet memperbarui forked repo</title><link href="http://localhost:4000/cara-memperbarui-fork-repository/" rel="alternate" type="text/html" title="Cara ribet memperbarui forked repo" /><published>2020-01-29T01:00:00+07:00</published><updated>2020-01-29T01:00:00+07:00</updated><id>http://localhost:4000/cara-memperbarui-fork-repository</id><content type="html" xml:base="http://localhost:4000/cara-memperbarui-fork-repository/"><p>Berawal dari saya pengen memperbarui repo yang tua dari suatu organisasi, niatnya pengen rumat ulang nih, ternyata dari orginal reponya ada update, sekalian buat artikel deh, lebih kurang gambaranya seperti ini.</p>
|
||||
|
||||
<figure>
|
||||
<img src="/cara-memperbarui-fork-repository/repo.png" alt="ilustrasi repo yang mau diupdate" />
|
||||
<figcaption>Fig 1. Gambaran ribetnya.</figcaption>
|
||||
</figure>
|
||||
|
||||
<p>Ada dua cara untuk memperbarui forked repository menggunakan web interface yang disediakan oleh github tapi ribet, atau melalui terminal yang lebih ribet lagi.</p>
|
||||
|
||||
<h3 id="melalui-github-boring-way-">Melalui Github (boring way) 💻</h3>
|
||||
|
||||
<ol>
|
||||
<li>Buka repo yang hasil fork di Github.</li>
|
||||
<li>Klik <strong>Pull Requests</strong> di sebelah kanan, lalu <strong>New Pull Request</strong>.</li>
|
||||
<li>Akan memunculkan hasil compare antara repo upstream dengan repo kamu(forked repo), dan jika menyatakan “There isn’t anything to compare.”, tekan link <strong>switching the base</strong>, yang mana sekarang repo kamu(forked repo) akan dibalik menjadi base repo dan repo upstream menjadi head repo.</li>
|
||||
<li>Tekan <strong>Create Pull Request</strong>, beri judul pull request, Tekan <strong>Send Pull Request</strong>.</li>
|
||||
<li>Tekan <strong>Merge Pull Request</strong> dan <strong>Confirm Merge</strong>.</li>
|
||||
</ol>
|
||||
|
||||
<p>* <em>pastikan kamu tidak merubah apapun pada forked repo, supaya melakukan merge secara otomatis, kalo tidak ya paling2 konflik.</em></p>
|
||||
|
||||
<h3 id="melalui-terminal-️">Melalui terminal ⌨️</h3>
|
||||
|
||||
<p>Tambahkan remote alamat repository yang aslinya disini tak beri nama <code class="highlighter-rouge">upstream</code>., ganti <code class="highlighter-rouge">ORIGINAL_OWNER</code> dan <code class="highlighter-rouge">ORIGINAL_REPO</code> dengan alamat repo aslimu.</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>git add remote upstream git@github.com:ORIGINAL_OWNER/ORIGINAL_REPO.git
|
||||
<span class="nv">$ </span>git remote <span class="nt">-v</span>
|
||||
<span class="o">&gt;</span> origin git@github.com:piharpi/www.git <span class="o">(</span>fetch<span class="o">)</span> <span class="c"># forked repo</span>
|
||||
<span class="o">&gt;</span> origin git@github.com:piharpi/www.git <span class="o">(</span>push<span class="o">)</span> <span class="c"># forked repo</span>
|
||||
<span class="o">&gt;</span> upstream git@github.com:ORIGINAL_OWNER/ORIGINAL_REPO.git <span class="o">(</span>fetch<span class="o">)</span> <span class="c"># upstream repo / original repo</span>
|
||||
<span class="o">&gt;</span> upstream git@github.com:ORIGINAL_OWNER/ORIGINAL_REPO.git <span class="o">(</span>push<span class="o">)</span> <span class="c"># upstream repo / original repo</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Checkout ke local branch <code class="highlighter-rouge">master</code>.</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>git checkout master
|
||||
<span class="o">&gt;</span> Switched to branch <span class="s1">'master'</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Jika sudah, Merge local repo dengan remote <code class="highlighter-rouge">upstream/master</code>.</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>git merge upstream/master
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Terakhir push local repo ke remote <code class="highlighter-rouge">origin</code>.</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>git add <span class="nt">-A</span>
|
||||
<span class="nv">$ </span>git commit <span class="nt">-m</span> <span class="s2">"updating origin repo"</span> <span class="o">&amp;&amp;</span> git push <span class="nt">-u</span> origin master
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Selamat mencoba cara ribet ini, semoga bisa dipahami, saya sendiri lebih senang melalui terminal, klo ada yang ribet kenapa cari yang mudah.</p>
|
||||
|
||||
<h5 id="resources">Resources</h5>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork">Syncing a fork</a></li>
|
||||
<li><a href="https://rick.cogley.info/post/update-your-forked-repository-directly-on-github/#top">Update your fork directly on Github</a></li>
|
||||
</ul></content><author><name>Klisé Theme</name><email>your-email@email.com</email></author><category term="tips" /><category term="git" /><category term="software" /><summary type="html">Berawal dari saya pengen memperbarui repo yang tua dari suatu organisasi, niatnya pengen rumat ulang nih, ternyata dari orginal reponya ada update, sekalian buat artikel deh, lebih kurang gambaranya seperti ini.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://localhost:4000/cara-memperbarui-fork-repository/repo.png" /></entry><entry><title type="html">What is a shell? 🐚 adalah kerang ajaib?</title><link href="http://localhost:4000/apa-itu-shell/" rel="alternate" type="text/html" title="What is a shell? 🐚 adalah kerang ajaib?" /><published>2020-01-25T11:58:47+07:00</published><updated>2020-01-25T11:58:47+07:00</updated><id>http://localhost:4000/apa-itu-shell</id><content type="html" xml:base="http://localhost:4000/apa-itu-shell/"><p><a href="http://www.youtube.com/watch?v=tc4ROCJYbm0&amp;t=70" target="_blank" rel="noopener">Dulu</a> Sebelum adanya <abbr title="Graphical User Interface">GUI</abbr> cara user berinteraksi dengan komputer menggunakan <abbr title="Command Line Interface">CLI</abbr> yaitu mengetik baris perintah pada sebuah antarmuka dalam bentuk baris teks seperti 👇.</p>
|
||||
|
||||
<figure>
|
||||
<img src="/apa-itu-shell/terminal_nginx.gif" alt="installing nginx in ubuntu" />
|
||||
<figcaption>Fig 1. Terminal emulator, instalasi package dan check service.</figcaption>
|
||||
</figure>
|
||||
|
||||
<p>Jika kamu pernah menggunakan unix/linux mungkin pernah menggunakan program diatas, bahkan mungkin setiap hari menggunakannya untuk mengeksekusi suatu perintah melalui <a href="http://en.wikipedia.org/wiki/List_of_terminal_emulators" target="_blank" rel="noopener">terminal emulator</a>.</p>
|
||||
|
||||
<p>User<sup id="user"><a href="#user-ref">[1]</a></sup> tidak bisa secara langsung berkomunikasi dengan sebuah hardware komputer, maka dari itu kita membutuhkan sebuah sistem operasi; <strong>Kernel</strong> adalah program yang merupakan inti utama dari sistem operasi komputer.</p>
|
||||
|
||||
<figure>
|
||||
<img src="/apa-itu-shell/kernel.png" alt="kernel central of operating system" />
|
||||
<figcaption>Fig 2. bagan kernel.</figcaption>
|
||||
</figure>
|
||||
|
||||
<p>Kernel memfasilitasi interaksi antara komponen perangkat keras dan perangkat lunak, berperan untuk menangani permintaan input/ouput dari perangkat lunak, selanjutnya menerjemahkannya ke dalam pemrosesan data untuk diintruksikan ke CPU, sehingga Hardware(cpu, memory, devices) mengerti perintah yang dimaksud dari pengguna.</p>
|
||||
|
||||
<p>Ketika kita menginputkan suatu perintah pada terminal emulator, kernel tidak langsung mengerti perintah yang kita ketik, kita membutuhkan suatu interface sebagai perantara menuju kernel yaitu <strong>Shell</strong>.</p>
|
||||
|
||||
<figure>
|
||||
<img src="/apa-itu-shell/shell.png" alt="shell" />
|
||||
<figcaption>Fig 3. bagan komunikasi shell.</figcaption>
|
||||
</figure>
|
||||
|
||||
<p><mark>Shell adalah sebuah command-line interpreter; program yang berperan sebagai penerjemah perintah yang diinputkan oleh User yang melalui terminal</mark>, sehingga perintah tersebut bisa dimengerti oleh si Kernel.</p>
|
||||
|
||||
<p>Login shell biasanya ditetapkan oleh local System Administrator ketika pada saat pertama user kamu dibuat, kamu bisa lihat login shell yang sedang kamu gunakan dengan perintah dibawah ini.</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">echo</span> <span class="nv">$SHELL</span>
|
||||
<span class="c"># atau</span>
|
||||
<span class="nv">$ </span><span class="nb">echo</span> <span class="nv">$0</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Setiap shell mempunyai default prompt. beberapa shell yang paling umum:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="o">(</span>dollar sign<span class="o">)</span> <span class="c"># sh, ksh, bash</span>
|
||||
% <span class="o">(</span>percent sign<span class="o">)</span> <span class="c"># csh, tcsh</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h5 id="terminologi-pada-shell-prompt">Terminologi pada shell prompt</h5>
|
||||
|
||||
<p>Shell prompt adalah tempat dimana kita menuliskan suatu perintah, berikut adalah terminologinya ini membantu, jika kamu ingin mengetahui bagian-bagianya.</p>
|
||||
|
||||
<figure>
|
||||
<img src="/apa-itu-shell/term_shell_prompt.png" alt="shell" />
|
||||
<figcaption>Fig 4. bagian-bagin dari shell prompt.</figcaption>
|
||||
</figure>
|
||||
|
||||
<p>Dibawah ini salah satu contoh perintah sederhana untuk menampilkan sebuah arsitektur CPU komputer yang sedang saya gunakan.</p>
|
||||
|
||||
<figure>
|
||||
<img src="/apa-itu-shell/terminal_lscpu.gif" alt="installing nginx in ubuntu" />
|
||||
<figcaption>Fig 5. menampilkan informasi tentang arsitektur CPU.</figcaption>
|
||||
</figure>
|
||||
|
||||
<p>Dari perintah yang contohkan, ketika user mengetikan suatu inputan perintah di terminal dan menekan <kbd>ENTER</kbd>, maka shell akan mengubah perintah user menjadi bahasa yang bisa dipahami oleh kernel, dan Kernel menerjemahkannya ke dalam pemrosesan data untuk diintruksikan ke Hardware sehingga menghasilkan output yg sesuai dengan perintah user.</p>
|
||||
|
||||
<p>Shell mempunyai beberapa macam dan turunan, berikut yang paling umum.</p>
|
||||
|
||||
<figure>
|
||||
<img src="/apa-itu-shell/shell_evolution.png" alt="shell evolution" />
|
||||
<figcaption>Fig 6. evaluasi shell dari tahun ke tahun.</figcaption>
|
||||
</figure>
|
||||
|
||||
<p>Sedikit penjelasan dari gambar diatas.</p>
|
||||
|
||||
<ul>
|
||||
<li>Bourne shell <code class="highlighter-rouge">sh</code>
|
||||
Dikembangkan oleh Stephen Bourne di Bell Labs, yang kala itu sebagai pengganti Thompson shell(diciptakan Ken Thompson), banyak sistem unix-like tetap memiliki <code class="highlighter-rouge">/bin/sh</code>—yang mana menjadi symbolic link atau hard link, bahkan ketika shell lain yang digunakan tetap <code class="highlighter-rouge">sh</code> adalah sebagai dasarnya, sebagai kompatibilitas perintah.</li>
|
||||
<li>Korn shell <code class="highlighter-rouge">ksh</code> Unix shell yang dikembangkan oleh David Korn di Bell Labs,
|
||||
inisialiasi pengembangan ini berdasar pada source code Bourne shell, namun juga memiliki fitur <code class="highlighter-rouge">csh</code> dan <code class="highlighter-rouge">sh</code>, pengembanganya pun pada saat saya menulis ini pun terus <a href="http://github.com/att/ast" target="_blank" rel="noopener">terawat</a>.</li>
|
||||
<li>Bourne again shell <code class="highlighter-rouge">bash</code>
|
||||
adalah proyek ini open source <a href="http://gnu.org/software/bash/" target="_blank" rel="noopener">GNU project</a> memilki kompatibel dengan <code class="highlighter-rouge">sh</code> yang menggabungkan fitur penting dari <code class="highlighter-rouge">ksh</code> dan <code class="highlighter-rouge">csh</code>, dan menjadi salah satu shell yang paling umum digunakan (umumnya menjadi default shell login Linux dan Apple’s macOS Mojave).</li>
|
||||
<li>Z shell <code class="highlighter-rouge">zsh</code> ini mempunyai wadah komunitasnya disebutnya <a href="http://ohmyz.sh/" target="_blank" rel="noopener">“Oh My Zsh”</a>, plug-in dan theme <code class="highlighter-rouge">zsh</code> bisa kita temukan di komunitas ini, saya saat ini menggunakan <code class="highlighter-rouge">zsh</code>, shell ini juga menjadi default dari sistem operasi macOS Catalina, yang menggantikan bash.</li>
|
||||
<li>friendly interactive shell <code class="highlighter-rouge">fish</code>
|
||||
yah sesuai dengan <a href="http://fishshell.com/" target="_blank" rel="noopener">deskripsi</a> di web nya, menurut saya shell ini fun banget, fitur yang saya sukai dari shell ini autosuggestions, dan konfigurasi yang mudah melalui web based.</li>
|
||||
</ul>
|
||||
|
||||
<p>Masih banyak yang belum dijelaskan pada tulisan ini jika masih tertarik, baca lebih <a href="http://en.wikipedia.org/wiki/List_of_command-line_interpreters#Operating_system_shells" target="_blank" rel="noopener">banyak</a> dan juga <a href="http://en.wikipedia.org/wiki/Comparison_of_command_shells" target="_blank" rel="noopener">komparasinya</a> masing-masing shell.</p>
|
||||
|
||||
<p>Jika kamu tertarik untuk mengubah default shell login pada sistem operasi, kamu bisa menginstall dengan cara mengikuti didokumentasi/cara penginstallan dimasing-masing shell disini saya tidak membahas karena distro yang kita pakai mungkin berbeda-beda.</p>
|
||||
|
||||
<p>Untuk menjadikan default shell login pada OS bisa menggunakan perintah ini.</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># command</span>
|
||||
<span class="nv">$ </span><span class="nb">sudo </span>chsh <span class="o">[</span>options] <span class="o">[</span>LOGIN]
|
||||
|
||||
<span class="c"># contoh penggunaan</span>
|
||||
<span class="nv">$ </span><span class="nb">sudo </span>chsh <span class="nt">-s</span> /user/bin/zsh harpi
|
||||
<span class="c"># mengubah default shell user harpi menjadi zsh shell.</span>
|
||||
<span class="nv">$ </span>reboot
|
||||
|
||||
<span class="c"># atau kamu juga bisa mengubah file /etc/passwd dan edit secara manual user shellnya.</span>
|
||||
<span class="c"># jika masih bingung manfaatkan perintah man untuk melihat manual page.</span>
|
||||
<span class="nv">$ </span>man chsh
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Terakhir untuk tulisan ini, shell memilki berbagai macam, pilihlah shell yang sesuai dengan keinginanmu untuk menunjang produktivitas dan sesuaikan dengan kebutuhan, terlalu banyak plugin dan kebingungan memilih tema itu buruk 😁.</p>
|
||||
|
||||
<p>Terimakasih sudah baca, <em>penulis menerima kritik dan saran.</em></p>
|
||||
|
||||
<h5 id="notes">Notes</h5>
|
||||
|
||||
<p><small id="user-ref"><sup><a href="#user">[1]</a></sup> Manusia yang mengoperasikan dan mengendalikan sistem komputer.</small></p>
|
||||
|
||||
<h5 id="resources">Resources</h5>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://developer.ibm.com/tutorials/l-linux-shells/">Evolution shells in Linux</a></li>
|
||||
<li><a href="http://www.linfo.org/kernel.html">Kernel Defintion</a></li>
|
||||
<li><a href="http://www.cis.rit.edu/class/simg211/unixintro/Shell.html">The Shell</a></li>
|
||||
</ul></content><author><name>Klisé Theme</name><email>your-email@email.com</email></author><category term="unix/linux" /><category term="cli" /><summary type="html">Dulu Sebelum adanya GUI cara user berinteraksi dengan komputer menggunakan CLI yaitu mengetik baris perintah pada sebuah antarmuka dalam bentuk baris teks seperti 👇.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://localhost:4000/apa-itu-shell/shell_evolution.png" /></entry><entry><title type="html">How this site was born 👶</title><link href="http://localhost:4000/how-this-site-was-made/" rel="alternate" type="text/html" title="How this site was born 👶" /><published>2018-09-28T09:45:47+07:00</published><updated>2018-09-28T09:45:47+07:00</updated><id>http://localhost:4000/how-this-site-was-made</id><content type="html" xml:base="http://localhost:4000/how-this-site-was-made/"><p>The website was made using Jekyll the one of open source static sites generator, and using my own simple theme, I called <a href="https://github.com/piharpi/klise">klisé</a>.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>All the services are free, source code the site was placed on my <a href="https://github.com/piharpi/mahendrata.now.sh">github</a> repository and intergration with <del><a href="https://netlify.com">netlify</a></del> service, another service that you can use is <a href="https://pages.github.com/">github page</a> for hosting your own static site.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<h4 id="lets-do-this">Let’s do this</h4>
|
||||
|
||||
<p>So, before we start create a site, you need some tools, you can self paced for how to installing each tools, on this guide i’m just want to show you how to install jekyll and deploying in netlify, but make sure you have each tools below.</p>
|
||||
|
||||
<h4 id="prerequisites">Prerequisites</h4>
|
||||
|
||||
<p>Requirements before we doing magic show.</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://www.ruby-lang.org/en/downloads/">Ruby</a> programming language</li>
|
||||
<li><a href="https://git-scm.com">Git</a> (version control)</li>
|
||||
<li><a href="https://netlify.com">Netlify</a> and <a href="https://github.com">Github</a> account</li>
|
||||
<li><a href="https://bundler.io">Bundler</a></li>
|
||||
</ul>
|
||||
|
||||
<h4 id="installation">Installation</h4>
|
||||
|
||||
<p>First, you need some <a href="https://www.staticgen.com/">SSG</a>, there are many kind ssg, but in case i’m using Jekyll cause i’m already familiar with it, open your terminal and type command on below</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>bundle <span class="nb">install </span>jekyll <span class="c"># installing jekyll in your machine</span>
|
||||
<span class="nv">$ </span>jekyll new my-site <span class="o">&amp;&amp;</span> <span class="nb">cd </span>my-site <span class="c"># create new jekyll project</span>
|
||||
<span class="nv">$ </span>jekyll s <span class="c"># run jekyll server</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Now, jekyll is running on your local machine, open your browser and go to <code class="highlighter-rouge">localhost:4000</code> is default address from jekyll, press <kbd>CTRL</kbd> + <kbd>C</kbd> to stop the jekyll server.</p>
|
||||
|
||||
<h4 id="adding-remote-repository">Adding remote repository</h4>
|
||||
|
||||
<p>Before we adding remote repository, you must have <a href="https://github.com/new">github</a> repository, if already have repository, just add github remote address to your local folder, with the following commands</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>git init <span class="c"># initializing project folder</span>
|
||||
<span class="nv">$ </span>git remote add origin https://github.com/YOUR-USERNAME/YOUR-REPO.git <span class="c"># change UPPERCASE with your own!</span>
|
||||
<span class="nv">$ </span>git add <span class="nt">-A</span> <span class="o">&amp;&amp;</span> git commit <span class="nt">-m</span> <span class="s2">"Initialize"</span> <span class="o">&amp;&amp;</span> git push <span class="nt">-u</span> origin master <span class="c"># push code to github</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Now check your github repository, make sure the files is uploaded correctly.</p>
|
||||
|
||||
<h4 id="deploying-to-netlify">Deploying to netlify</h4>
|
||||
|
||||
<p>Go <a href="https://netlify.com">netlify</a> dashboard, and following this step.</p>
|
||||
|
||||
<ol>
|
||||
<li>click <code class="highlighter-rouge">new site from git</code>, then choose <code class="highlighter-rouge">Github</code>.</li>
|
||||
<li>then choose your repository where is the jekyll sources uploaded.</li>
|
||||
<li>netlify smart enough to configuring, we just need’s are hosting’s are hosting’s are hosting’s are hosting to click <code class="highlighter-rouge">Deploy site button</code>.</li>
|
||||
</ol>
|
||||
|
||||
<p>Wait for moment, and voila..! your site’s are hosting and using <code class="highlighter-rouge">.netlify.com</code> tld, if your website wants to look professional, just buy a domain from your favorite domain store. or if you the first time, I advice using namecheap.com<em>(isn’t sponsor)</em> *based on my experienced it provides good service and have various TLDs.</p>
|
||||
|
||||
<p>So, what you waiting for, just create your own website for free.</p></content><author><name>Klisé Theme</name><email>your-email@email.com</email></author><category term="blog" /><category term="netlify" /><category term="jekyll" /><category term="github" /><summary type="html">The website was made using Jekyll the one of open source static sites generator, and using my own simple theme, I called klisé.</summary></entry><entry><title type="html">Python Notes from Intro to Machine Learning</title><link href="http://localhost:4000/python-notes-from-Intro-to-machine-learning/" rel="alternate" type="text/html" title="Python Notes from Intro to Machine Learning" /><published>2018-04-14T10:00:00+07:00</published><updated>2018-04-14T10:00:00+07:00</updated><id>http://localhost:4000/python-notes-from-Intro-to-machine-learning</id><content type="html" xml:base="http://localhost:4000/python-notes-from-Intro-to-machine-learning/"><h5 id="this-article-is-for-demo-purpose">This article is for Demo purpose</h5>
|
||||
|
||||
<p>The article was originally on <a href="https://github.com/risan/risanb.com/blob/master/content/posts/python-notes-from-intro-to-machine-learning/index.md">this repo</a></p>
|
||||
|
||||
<p>I rarely use Python. I only have one repository at Github that is written in Python: <a href="https://github.com/risan/iris-flower-classifier">iris-flower-classifier</a>. And it was written two years ago!</p>
|
||||
|
||||
<p>A few days ago I took this free course from Udacity: <a href="https://eu.udacity.com/course/intro-to-machine-learning--ud120">Intro to Machine Learning</a>. The machine learning related codes are quite easy to grasp since it simply uses the <a href="http://scikit-learn.org/">scikit-learn</a> modules. But most of the supporting Python modules that are provided by this course were like a black-box to me. I had no idea how to download a file in Python or what’s the difference between a list, a tuple and a dictionary.</p>
|
||||
|
||||
<p>That’s why I decided to read all of the provided Python modules and implement it myself. I ended up refactor most of the code so it’s easier to understand: <a href="https://github.com/risan/intro-to-machine-learning">github.com/risan/intro-to-machine-learning</a>.</p>
|
||||
|
||||
<p>So here are some notes and snippets of Python that I’ve been collecting so far (I’m not even halfway through the course 😝). Also, note that the codes here are still using Python version 2.7.</p>
|
||||
|
||||
<h2 id="table-of-contents">Table of Contents</h2>
|
||||
|
||||
<h2 id="modules-classes-and-functions">Modules Classes and Functions</h2>
|
||||
|
||||
<h3 id="main-entry-file">Main Entry File</h3>
|
||||
|
||||
<p>Suppose our Python project is stored in <code class="highlighter-rouge">/foo/bar</code> directory. And this application has one file that serves as the single entry point. We can name this file <code class="highlighter-rouge">__main__.py</code> so we can run this project simply be referencing its directory path:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Referencing its directory.</span>
|
||||
<span class="nv">$ </span>python /foo/bar
|
||||
|
||||
<span class="c"># It's equivalent to this.</span>
|
||||
<span class="nv">$ </span>python /foo/bar/__main__.py
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="import-python-module-dynamically">Import Python Module Dynamically</h3>
|
||||
|
||||
<p>Suppose we would like to import a Python module dynamically based on a variable value. We can achieve this through the <a href="https://docs.python.org/2/library/functions.html#__import__"><code class="highlighter-rouge">__import__</code></a> function:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">module_name</span> <span class="o">=</span> <span class="s">"numpy"</span>
|
||||
|
||||
<span class="nb">__import__</span><span class="p">(</span><span class="n">module_name</span><span class="p">)</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="multiple-returns-in-python">Multiple Returns in Python</h3>
|
||||
|
||||
<p>In Python, it’s possible for a function or a method to return multiple values. We can do this simply by separating each return value by a comma:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">def</span> <span class="nf">test</span><span class="p">():</span>
|
||||
<span class="k">return</span> <span class="mi">100</span><span class="p">,</span> <span class="s">"foo"</span>
|
||||
|
||||
<span class="n">someNumber</span><span class="p">,</span> <span class="n">someString</span> <span class="o">=</span> <span class="n">test</span><span class="p">()</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="importing-modules-outside-of-the-directory">Importing Modules Outside of the Directory</h3>
|
||||
|
||||
<p>In order to import a module from outside of the directory, we need to add that module’s directory path into the current file with <code class="highlighter-rouge">sys.path.append</code>. Suppose we have the following directory structure:</p>
|
||||
|
||||
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>|--foo
|
||||
| |-- bar.py
|
||||
|
|
||||
|-- tools
|
||||
| |-- speak_yoda.py
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>If we want to use the <code class="highlighter-rouge">speak_yoda.py</code> module within the <code class="highlighter-rouge">bar.py</code>, we can do the following:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># /foo/bar.py
|
||||
</span><span class="kn">import</span> <span class="nn">os</span>
|
||||
|
||||
<span class="c1"># Use relative path to tools directory.
|
||||
</span><span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">"../tools"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">speak_yoda</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>However, this won’t work if we run the <code class="highlighter-rouge">baz.py</code> file from outside of its <code class="highlighter-rouge">foo</code> directory:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># It works inside of the /foo directory.</span>
|
||||
<span class="nv">$ </span><span class="nb">cd</span> /foo
|
||||
<span class="nv">$ </span>python bar.py
|
||||
|
||||
<span class="c"># But it won't work if the code runs from outside of /foo directory.</span>
|
||||
<span class="nv">$ </span>python foo/bar.py
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>To solve this problem we can refer to the <code class="highlighter-rouge">tools</code> directory using its absolute path.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># /foo/bar.py
|
||||
</span><span class="kn">import</span> <span class="nn">os</span>
|
||||
<span class="kn">import</span> <span class="nn">sys</span>
|
||||
|
||||
<span class="c1"># Get the directory name for this file.
|
||||
</span><span class="n">current_dirname</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">__file__</span><span class="p">))</span>
|
||||
|
||||
<span class="c1"># Use the absolute path to the tools directory
|
||||
</span><span class="n">tools_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">dirname</span><span class="p">,</span> <span class="s">"../tools"</span><span class="p">))</span>
|
||||
<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">tools_path</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">speak_yoda</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="output">Output</h2>
|
||||
|
||||
<h3 id="print-the-emojis">Print The Emojis</h3>
|
||||
|
||||
<p>It turns out you can’t just print an emoji or any other Unicode characters to the console. You need to specify the encoding type beforehand:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># coding: utf8
|
||||
</span>
|
||||
<span class="k">print</span><span class="p">(</span><span class="s">"😅"</span><span class="p">)</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="pretty-print">Pretty Print</h3>
|
||||
|
||||
<p>We can use the <code class="highlighter-rouge">pprint</code> module to pretty-print Python data structure with a configurable indentation:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">pprint</span>
|
||||
<span class="n">pp</span> <span class="o">=</span> <span class="n">pprint</span><span class="o">.</span><span class="n">PrettyPrinter</span><span class="p">(</span><span class="n">indent</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
|
||||
|
||||
<span class="n">pp</span><span class="o">.</span><span class="n">pprint</span><span class="p">(</span><span class="n">people</span><span class="p">)</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="working-with-pathname">Working with Pathname</h2>
|
||||
|
||||
<p>Read more about pathname manipulations in the <a href="https://docs.python.org/2/library/os.path.html"><code class="highlighter-rouge">os.path</code> documentation</a>.</p>
|
||||
|
||||
<h3 id="get-filename-from-url">Get Filename From URL</h3>
|
||||
|
||||
<p>Suppose the last segment of the URL contains a filename that we would like to download. We can extract this filename with the following code:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">os</span>
|
||||
<span class="kn">from</span> <span class="nn">urlparse</span> <span class="kn">import</span> <span class="n">urlparse</span>
|
||||
|
||||
<span class="n">url</span> <span class="o">=</span> <span class="s">"https://example.com/foo.txt"</span>
|
||||
|
||||
<span class="n">url_components</span> <span class="o">=</span> <span class="n">urlparse</span><span class="p">(</span><span class="n">url</span><span class="p">)</span>
|
||||
|
||||
<span class="n">filename</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">url_components</span><span class="o">.</span><span class="n">path</span><span class="p">)</span> <span class="c1"># foo.txt
|
||||
</span></code></pre></div></div>
|
||||
|
||||
<h3 id="check-if-file-exists">Check if File Exists</h3>
|
||||
|
||||
<p>To check whether the given file path exists or not:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">os</span>
|
||||
|
||||
<span class="n">is_exists</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="s">"foo.txt"</span><span class="p">)</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="create-a-directory-if-it-does-not-exists">Create a Directory if It Does Not Exists</h3>
|
||||
|
||||
<p>To create a directory only if it does not exist:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">os</span>
|
||||
<span class="kn">import</span> <span class="nn">errno</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">directory_path</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="nb">OSError</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">errno</span> <span class="o">!=</span> <span class="n">errno</span><span class="o">.</span><span class="n">EEXIST</span><span class="p">:</span>
|
||||
<span class="k">raise</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="working-with-files">Working with Files</h2>
|
||||
|
||||
<h3 id="downloading-a-file">Downloading a File</h3>
|
||||
|
||||
<p>We can use the <code class="highlighter-rouge">urllib</code> module to download a file in Python. The first argument is the file URL that we would like to download. The second argument is the optional filename that will be used to store the file.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">urllib</span>
|
||||
|
||||
<span class="n">urllib</span><span class="o">.</span><span class="n">urlretrieve</span><span class="p">(</span><span class="s">"https://example.com/foo.txt"</span><span class="p">,</span> <span class="s">"foo.txt"</span><span class="p">)</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="extracting-tar-file">Extracting Tar File</h3>
|
||||
|
||||
<p>There’s a built-in <code class="highlighter-rouge">tarfile</code> module that we can use to work with Tar file in Python. To extract the <code class="highlighter-rouge">tar.gz</code> file we can use the following code:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">tarfile</span>
|
||||
|
||||
<span class="c1"># Open the file.
|
||||
</span><span class="n">tfile</span> <span class="o">=</span> <span class="n">tarfile</span><span class="o">.</span><span class="nb">open</span><span class="p">(</span><span class="s">"foo.tar.gz"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Extract the file to the given path.
|
||||
</span><span class="n">tfile</span><span class="o">.</span><span class="n">extractall</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>We can pass the <code class="highlighter-rouge">mode</code> argument to the <code class="highlighter-rouge">open</code> method. By default, the <code class="highlighter-rouge">mode</code> would be <code class="highlighter-rouge">r</code>—reading mode with transparent compression. There are also other mode options that we can use:</p>
|
||||
|
||||
<ul>
|
||||
<li><code class="highlighter-rouge">r:gz</code>: Reading mode with gzip compression.</li>
|
||||
<li><code class="highlighter-rouge">r:</code>: Reading mode without compression.</li>
|
||||
<li><code class="highlighter-rouge">a</code>: Appending mode without compression.</li>
|
||||
<li><code class="highlighter-rouge">w</code>: Writting mode without compression.</li>
|
||||
<li>Checkout other available options in <a href="https://docs.python.org/2/library/tarfile.html">tarfile documentation</a>.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="working-with-list">Working with List</h2>
|
||||
|
||||
<h3 id="generate-a-list-of-random-numbers">Generate a List of Random Numbers</h3>
|
||||
|
||||
<p>Use the <code class="highlighter-rouge">for..in</code> syntax to generate a list of random numbers in a one-liner style.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">random</span>
|
||||
|
||||
<span class="c1"># Initialize internal state of random generator.
|
||||
</span><span class="n">random</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="mi">42</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Generate random points.
|
||||
</span><span class="n">randomNumbers</span> <span class="o">=</span> <span class="p">[</span><span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">10</span><span class="p">)]</span>
|
||||
<span class="c1"># [0.6394267984578837, 0.025010755222666936, 0.27502931836911926, ...]
|
||||
</span></code></pre></div></div>
|
||||
|
||||
<h3 id="pair-values-from-two-lists">Pair Values from Two Lists</h3>
|
||||
|
||||
<p>The built-in <code class="highlighter-rouge">zip</code> function can pair values from two lists. However, this <code class="highlighter-rouge">zip</code> function will return a list of tuples instead. To get a list of value pairs, we can combine it with <code class="highlighter-rouge">for..in</code> syntax:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">coordinates</span> <span class="o">=</span> <span class="p">[[</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">]</span> <span class="k">for</span> <span class="n">x</span><span class="p">,</span><span class="n">y</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">([</span><span class="mi">5</span><span class="p">,</span><span class="mi">10</span><span class="p">,</span><span class="mi">15</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">])]</span>
|
||||
<span class="c1"># [[5, 0], [10, 1], [15, 0]]
|
||||
</span></code></pre></div></div>
|
||||
|
||||
<h3 id="splitting-a-list">Splitting a List</h3>
|
||||
|
||||
<p>We can easily split a list in Python by specifying the starting index and it’s ending index. Note that the ending index is excluded from the result.</p>
|
||||
|
||||
<p>We can also specify a negative index. And also note that both of these indices are optional!</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">a</span> <span class="o">=</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">]</span>
|
||||
|
||||
<span class="n">a</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">3</span><span class="p">]</span> <span class="c1"># 0,1,2
|
||||
</span><span class="n">a</span><span class="p">[</span><span class="mi">1</span><span class="p">:</span><span class="mi">3</span><span class="p">]</span> <span class="c1"># 1,2
|
||||
</span><span class="n">a</span><span class="p">[</span><span class="mi">2</span><span class="p">:]</span> <span class="c1"># 2,3,4,5
|
||||
</span><span class="n">a</span><span class="p">[:</span><span class="mi">3</span><span class="p">]</span> <span class="c1"># 0,1,2
|
||||
</span><span class="n">a</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="o">-</span><span class="mi">2</span><span class="p">]</span> <span class="c1"># 0,1,2,3
|
||||
</span><span class="n">a</span><span class="p">[</span><span class="o">-</span><span class="mi">2</span><span class="p">:]</span> <span class="c1"># 4,5
|
||||
</span><span class="n">a</span><span class="p">[:]</span> <span class="c1"># 0,1,2,3,4,5
|
||||
</span></code></pre></div></div>
|
||||
|
||||
<h3 id="filtering-a-list-in-one-line">Filtering a List In One Line</h3>
|
||||
|
||||
<p>We can easily filter a list in Python by combining the <code class="highlighter-rouge">for..in</code> and the <code class="highlighter-rouge">if</code> syntax together:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">numbers</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">11</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Filter even numbers only.
|
||||
</span><span class="p">[</span><span class="n">numbers</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">numbers</span><span class="p">))</span> <span class="k">if</span> <span class="n">numbers</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">0</span><span class="p">]</span>
|
||||
<span class="c1"># [2, 4, 6, 8, 10]
|
||||
</span></code></pre></div></div>
|
||||
|
||||
<h3 id="sorting-a-list-in-ascending-order">Sorting a List in Ascending Order</h3>
|
||||
|
||||
<p>In Python, we can sort a list in ascending order simply by calling the <code class="highlighter-rouge">sort</code> method like so:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">people</span> <span class="o">=</span> <span class="p">[</span><span class="s">"John"</span><span class="p">,</span> <span class="s">"Alice"</span><span class="p">,</span> <span class="s">"Poe"</span><span class="p">]</span>
|
||||
<span class="n">people</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
|
||||
<span class="k">print</span><span class="p">(</span><span class="n">people</span><span class="p">)</span> <span class="c1"># ["Alice", "John", "Poe"]
|
||||
</span></code></pre></div></div>
|
||||
|
||||
<h3 id="using-filter-function-with-a-list">Using Filter Function with a List</h3>
|
||||
|
||||
<p>Just like its name, we can use the <code class="highlighter-rouge">filter</code> function to filter out our list:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">numbers</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">11</span><span class="p">)</span>
|
||||
|
||||
<span class="n">even_numbers</span> <span class="o">=</span> <span class="nb">filter</span><span class="p">(</span><span class="k">lambda</span> <span class="n">number</span><span class="p">:</span> <span class="n">number</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">0</span><span class="p">,</span> <span class="n">numbers</span><span class="p">)</span>
|
||||
<span class="c1"># [2, 4, 6, 8, 10]
|
||||
</span></code></pre></div></div>
|
||||
|
||||
<p>We can break the above statement into two parts:</p>
|
||||
|
||||
<ul>
|
||||
<li><code class="highlighter-rouge">lambda number: statement</code>: The first part is the function that we would like to run to every item on the list. <code class="highlighter-rouge">number</code> is the variable name we’d like to use in this function to refer to a single item from the <code class="highlighter-rouge">numbers</code> list. The following function body must evaluate to truthy/falsy value—falsy means the current item will be removed from the final result.</li>
|
||||
<li><code class="highlighter-rouge">numbers</code>: The second parameter is the list that we’d like to filter.</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="using-reduce-with-a-list-of-dictionary">Using Reduce with a List of Dictionary</h3>
|
||||
|
||||
<p>We can use the <code class="highlighter-rouge">reduce</code> function to calculate the total of a particular key in a list of a dictionary:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">items</span> <span class="o">=</span> <span class="p">[{</span><span class="n">value</span><span class="p">:</span><span class="mi">10</span><span class="p">},</span> <span class="p">{</span><span class="n">value</span><span class="p">:</span><span class="mi">20</span><span class="p">},</span> <span class="p">{</span><span class="n">value</span><span class="p">:</span><span class="mi">50</span><span class="p">}]</span>
|
||||
|
||||
<span class="c1"># Calculate the total of value key.
|
||||
</span><span class="n">totalValues</span> <span class="o">=</span> <span class="nb">reduce</span><span class="p">(</span><span class="k">lambda</span> <span class="n">total</span><span class="p">,</span> <span class="n">item</span><span class="p">:</span> <span class="n">total</span> <span class="o">+</span> <span class="n">item</span><span class="p">[</span><span class="s">"value"</span><span class="p">],</span> <span class="n">items</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="c1"># 80
|
||||
</span></code></pre></div></div>
|
||||
|
||||
<p>It can be broken down into 4 parts:</p>
|
||||
|
||||
<ul>
|
||||
<li><code class="highlighter-rouge">lambda total</code>: It’s the variable name that we’d like to use in the function body to refer to the carried or the accumulative value that will finally be returned.</li>
|
||||
<li><code class="highlighter-rouge">item: statement</code>: <code class="highlighter-rouge">item</code> is the name of the variable we’d like to use within the function body to refer to the single item in the <code class="highlighter-rouge">items</code> list. The following function body will be executed in order to define the accumulative value of <code class="highlighter-rouge">total</code> for the next iteration.</li>
|
||||
<li><code class="highlighter-rouge">items</code>: It’s the list of item that we would like to “reduce”.</li>
|
||||
<li><code class="highlighter-rouge">0</code>: The last parameter is optional and it’s the initial accumulative value for the first iteration.</li>
|
||||
</ul>
|
||||
|
||||
<p>We can also use this <code class="highlighter-rouge">reduce</code> function to find a single item from the list. Here’s an example of code to find the person with the biggest <code class="highlighter-rouge">total_payments</code> within the given list of <code class="highlighter-rouge">people</code> dictionary.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">people</span> <span class="o">=</span> <span class="p">[</span>
|
||||
<span class="p">{</span><span class="s">"name"</span><span class="p">:</span> <span class="s">"John"</span><span class="p">,</span> <span class="s">"total_payments"</span><span class="p">:</span> <span class="mi">100</span><span class="p">},</span>
|
||||
<span class="p">{</span><span class="s">"name"</span><span class="p">:</span> <span class="s">"Alice"</span><span class="p">,</span> <span class="s">"total_payments"</span><span class="p">:</span> <span class="mi">1000</span><span class="p">},</span>
|
||||
<span class="p">{</span><span class="s">"name"</span><span class="p">:</span> <span class="s">"Poe"</span><span class="p">,</span> <span class="s">"total_payments"</span><span class="p">:</span> <span class="mi">800</span><span class="p">}</span>
|
||||
<span class="p">]</span>
|
||||
|
||||
<span class="n">person_biggest_total_payments</span> <span class="o">=</span> <span class="nb">reduce</span><span class="p">(</span><span class="k">lambda</span> <span class="n">paid_most</span><span class="p">,</span> <span class="n">person</span><span class="p">:</span> <span class="n">person</span> <span class="k">if</span> <span class="n">person</span><span class="p">[</span><span class="s">"total_payments"</span><span class="p">]</span> <span class="o">&gt;</span> <span class="n">paid_most</span><span class="p">[</span><span class="s">"total_payments"</span><span class="p">]</span> <span class="k">else</span> <span class="n">paid_most</span><span class="p">,</span> <span class="n">people</span><span class="p">,</span> <span class="p">{</span> <span class="s">"total_payments"</span><span class="p">:</span> <span class="mi">0</span> <span class="p">})</span>
|
||||
<span class="c1"># {'name': 'Alice', 'total_payments': 1000}
|
||||
</span></code></pre></div></div>
|
||||
|
||||
<h2 id="working-with-dictionary">Working with Dictionary</h2>
|
||||
|
||||
<h3 id="loop-through-dictionary">Loop Through Dictionary</h3>
|
||||
|
||||
<p>We can use the <code class="highlighter-rouge">itervalues</code> method to loop through a dictionary:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">for</span> <span class="n">person</span> <span class="ow">in</span> <span class="n">people</span><span class="o">.</span><span class="n">itervalues</span><span class="p">():</span>
|
||||
<span class="k">print</span><span class="p">(</span><span class="n">person</span><span class="p">[</span><span class="s">"email_address"</span><span class="p">])</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>We can also use the <code class="highlighter-rouge">iteritems</code> method if we want to access the key too:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">for</span> <span class="n">person</span> <span class="ow">in</span> <span class="n">people</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
|
||||
<span class="k">print</span><span class="p">(</span><span class="n">person</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="s">": "</span> <span class="o">+</span> <span class="n">person</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="s">"email_address"</span><span class="p">])</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="calculate-total-of-particular-dictionary-key">Calculate Total of Particular Dictionary Key</h3>
|
||||
|
||||
<p>Suppose we would like to calculate the total amount of <code class="highlighter-rouge">salary</code> key on a <code class="highlighter-rouge">people</code> dictionary. We can extract the <code class="highlighter-rouge">salary</code> key and use the <code class="highlighter-rouge">sum</code> function to get the total:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">total_salary</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">([</span><span class="n">person</span><span class="p">[</span><span class="s">"salary"</span><span class="p">]</span> <span class="k">for</span> <span class="n">person</span> <span class="ow">in</span> <span class="n">people</span><span class="o">.</span><span class="n">itervalues</span><span class="p">()])</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="working-with-numpy">Working with Numpy</h2>
|
||||
|
||||
<h3 id="numpy-create-range-of-values-with-the-given-interval">Numpy Create Range of Values with The Given Interval</h3>
|
||||
|
||||
<p>Use the <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html"><code class="highlighter-rouge">arange</code></a> method to create an array with an evenly spaced interval.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="n">np</span>
|
||||
|
||||
<span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="c1"># array([0,1,2,3,4])
|
||||
</span>
|
||||
<span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">)</span>
|
||||
<span class="c1"># array([1. , 1.5, 2. , 2.5, 3. , 3.5])
|
||||
</span></code></pre></div></div>
|
||||
|
||||
<h3 id="numpy-create-coordinate-matrices-from-coordinate-vectors">Numpy Create Coordinate Matrices from Coordinate Vectors</h3>
|
||||
|
||||
<p>We can use the Numpy <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.meshgrid.html"><code class="highlighter-rouge">meshgrid</code></a> method to make coordinate matrices from one-dimentional coordinate arrays.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="n">np</span>
|
||||
|
||||
<span class="n">np</span><span class="o">.</span><span class="n">meshgrid</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">7</span><span class="p">])</span>
|
||||
<span class="c1"># [
|
||||
# array([[1,2,3], [1,2,3]]),
|
||||
# array([[0,0,0], [7,7,7]])
|
||||
# ]
|
||||
</span></code></pre></div></div>
|
||||
|
||||
<h3 id="flatten-numpy-array">Flatten Numpy Array</h3>
|
||||
|
||||
<p>When we have a multi-dimensional Numpy array, we can easily flatten it with the <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ravel.html"><code class="highlighter-rouge">ravel</code></a> method:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="n">np</span>
|
||||
|
||||
<span class="n">arr</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">]])</span>
|
||||
<span class="n">arr</span><span class="o">.</span><span class="n">ravel</span><span class="p">()</span>
|
||||
<span class="c1"># array([1, 2, 3, 4])
|
||||
</span></code></pre></div></div>
|
||||
|
||||
<h3 id="pairing-array-values-with-second-axis">Pairing Array Values with Second Axis</h3>
|
||||
|
||||
<p>We can use Numpy <code class="highlighter-rouge">c_</code> function to pair array values with another array that will be it’s second axis. Read the <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.c_.html"><code class="highlighter-rouge">numpy.c_</code> documentation</a>.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="n">np</span>
|
||||
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">]</span>
|
||||
<span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mi">20</span><span class="p">]</span>
|
||||
|
||||
<span class="n">np</span><span class="o">.</span><span class="n">c_</span><span class="p">[</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">]</span>
|
||||
<span class="c1"># array([1,10], [2,20])
|
||||
</span></code></pre></div></div>
|
||||
|
||||
<h3 id="generate-coordinates-across-the-grid">Generate Coordinates Across The Grid</h3>
|
||||
|
||||
<p>With the knowledge of Numpy <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html"><code class="highlighter-rouge">arange</code></a>, <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.meshgrid.html"><code class="highlighter-rouge">meshgrid</code></a>, <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ravel.html"><code class="highlighter-rouge">ravel</code></a> and <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.c_.html"><code class="highlighter-rouge">c_</code></a> methods, we can easily generate an evenly spaced coordinates across the grid so we can pass it to the classifier and plot the decision surface.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="n">np</span>
|
||||
|
||||
<span class="c1"># Generate an evenly spaced coordinates.
|
||||
</span><span class="n">x_points</span><span class="p">,</span> <span class="n">y_points</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">meshgrid</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="n">x_min</span><span class="p">,</span> <span class="n">x_max</span><span class="p">,</span> <span class="n">step</span><span class="p">),</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="n">y_min</span><span class="p">,</span> <span class="n">y_max</span><span class="p">,</span> <span class="n">step</span><span class="p">))</span>
|
||||
|
||||
<span class="c1"># Pair the x and y points.
|
||||
</span><span class="n">test_coordinates</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">c_</span><span class="p">[</span><span class="n">x_points</span><span class="o">.</span><span class="n">ravel</span><span class="p">(),</span> <span class="n">y_points</span><span class="o">.</span><span class="n">ravel</span><span class="p">()]</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="plotting-the-data">Plotting the Data</h2>
|
||||
|
||||
<h3 id="plot-the-surface-decision">Plot The Surface Decision</h3>
|
||||
|
||||
<p>We can pass an evenly spaced coordinates across the grid to the classifier to predict the output on each of that coordinate. We can then use <a href="https://matplotlib.org/api/pyplot_api.html"><code class="highlighter-rouge">matplotlib.pyplot</code></a> to plot the surface decision.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="n">plt</span>
|
||||
<span class="kn">import</span> <span class="nn">pylab</span> <span class="k">as</span> <span class="n">pl</span>
|
||||
|
||||
<span class="c1"># Pass coordinates across the grid.
|
||||
</span><span class="n">predicted_labels</span> <span class="o">=</span> <span class="n">classifier</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">test_coordinates</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Don't forget to reshape the output array dimension.
|
||||
</span><span class="n">predicted_labels</span> <span class="o">=</span> <span class="n">predicted_labels</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="n">x_points</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Set the axes limit.
|
||||
</span><span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="n">x_points</span><span class="o">.</span><span class="nb">min</span><span class="p">(),</span> <span class="n">x_points</span><span class="o">.</span><span class="nb">max</span><span class="p">())</span>
|
||||
<span class="n">plt</span><span class="o">.</span><span class="n">ylim</span><span class="p">(</span><span class="n">y_points</span><span class="o">.</span><span class="nb">min</span><span class="p">(),</span> <span class="n">y_points</span><span class="o">.</span><span class="nb">max</span><span class="p">())</span>
|
||||
|
||||
<span class="c1"># Plot the decision boundary with seismic color map.
|
||||
</span><span class="n">plt</span><span class="o">.</span><span class="n">pcolormesh</span><span class="p">(</span><span class="n">x_points</span><span class="p">,</span> <span class="n">y_points</span><span class="p">,</span> <span class="n">predicted_labels</span><span class="p">,</span> <span class="n">cmap</span> <span class="o">=</span> <span class="n">pl</span><span class="o">.</span><span class="n">cm</span><span class="o">.</span><span class="n">seismic</span><span class="p">)</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>The classifier output would be a one-dimensional array, so don’t forget to <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.reshape.html"><code class="highlighter-rouge">reshape</code></a> it back into a two-dimensional array before plotting. The <code class="highlighter-rouge">cmap</code> is an optional parameter for the color map. Here we use the <code class="highlighter-rouge">seismic</code> color map from <code class="highlighter-rouge">pylab</code> module. It has the red-blue colors.</p>
|
||||
|
||||
<h3 id="scatter-plot">Scatter Plot</h3>
|
||||
|
||||
<p>We need to separate the test points based on its predicted label (the speed). So we can plot the test points with two different colors.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Separate fast (label = 0) &amp; slow (label = 1) test points.
|
||||
</span><span class="n">grade_fast</span> <span class="o">=</span> <span class="p">[</span><span class="n">features_test</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">features_test</span><span class="p">))</span> <span class="k">if</span> <span class="n">labels_test</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="mi">0</span><span class="p">]</span>
|
||||
<span class="n">bumpy_fast</span> <span class="o">=</span> <span class="p">[</span><span class="n">features_test</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">features_test</span><span class="p">))</span> <span class="k">if</span> <span class="n">labels_test</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="mi">0</span><span class="p">]</span>
|
||||
<span class="n">grade_slow</span> <span class="o">=</span> <span class="p">[</span><span class="n">features_test</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">features_test</span><span class="p">))</span> <span class="k">if</span> <span class="n">labels_test</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span><span class="p">]</span>
|
||||
<span class="n">bumpy_slow</span> <span class="o">=</span> <span class="p">[</span><span class="n">features_test</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">features_test</span><span class="p">))</span> <span class="k">if</span> <span class="n">labels_test</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span><span class="p">]</span>
|
||||
|
||||
<span class="c1"># Plot the test points based on its speed.
|
||||
</span><span class="n">plt</span><span class="o">.</span><span class="n">scatter</span><span class="p">(</span><span class="n">grade_fast</span><span class="p">,</span> <span class="n">bumpy_fast</span><span class="p">,</span> <span class="n">color</span> <span class="o">=</span> <span class="s">"b"</span><span class="p">,</span> <span class="n">label</span> <span class="o">=</span> <span class="s">"fast"</span><span class="p">)</span>
|
||||
<span class="n">plt</span><span class="o">.</span><span class="n">scatter</span><span class="p">(</span><span class="n">grade_slow</span><span class="p">,</span> <span class="n">bumpy_slow</span><span class="p">,</span> <span class="n">color</span> <span class="o">=</span> <span class="s">"r"</span><span class="p">,</span> <span class="n">label</span> <span class="o">=</span> <span class="s">"slow"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Show the plot legend.
|
||||
</span><span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>
|
||||
|
||||
<span class="c1"># Add the axis labels.
|
||||
</span><span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s">"grade"</span><span class="p">)</span>
|
||||
<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s">"bumpiness"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Show the plot.
|
||||
</span><span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>If we want to save the plot into an image, we can use the <code class="highlighter-rouge">savefig</code> method instead:</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">plt</span><span class="o">.</span><span class="n">savefig</span><span class="p">(</span><span class="s">'scatter_plot.png'</span><span class="p">)</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="dealing-with-data">Dealing with Data</h2>
|
||||
|
||||
<h3 id="deserializing-python-object">Deserializing Python Object</h3>
|
||||
|
||||
<p>We can use <a href="https://docs.python.org/2/library/pickle.html"><code class="highlighter-rouge">pickle</code></a> module for serializing and deserializing Python object. There’s also the <code class="highlighter-rouge">cPickle</code>—the faster C implementation. We use both of these modules to deserialize the email text and author list.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">pickle</span>
|
||||
<span class="kn">import</span> <span class="nn">cPickle</span>
|
||||
|
||||
<span class="c1"># Unpickling or deserializing the texts.
|
||||
</span><span class="n">texts_file_handler</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">texts_file</span><span class="p">,</span> <span class="s">"r"</span><span class="p">)</span>
|
||||
<span class="n">texts</span> <span class="o">=</span> <span class="n">cPickle</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">texts_file_handler</span><span class="p">)</span>
|
||||
<span class="n">texts_file_handler</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
|
||||
|
||||
<span class="c1"># Unpickling or deserializing the authors.
|
||||
</span><span class="n">authors_file_handler</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">authors_file</span><span class="p">,</span> <span class="s">"r"</span><span class="p">)</span>
|
||||
<span class="n">authors</span> <span class="o">=</span> <span class="n">pickle</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">authors_file_handler</span><span class="p">)</span>
|
||||
<span class="n">authors_file_handler</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="split-data-for-training-and-testing">Split Data for Training and Testing</h3>
|
||||
|
||||
<p>We can use the built-in <a href="http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html"><code class="highlighter-rouge">train_test_split</code></a> function from scikit-learn to split the data both for training and testing.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">sklearn.model_selection</span> <span class="kn">import</span> <span class="n">train_test_split</span>
|
||||
|
||||
<span class="n">features_train</span><span class="p">,</span> <span class="n">features_test</span><span class="p">,</span> <span class="n">labels_train</span><span class="p">,</span> <span class="n">labels_test</span> <span class="o">=</span> <span class="n">train_test_split</span><span class="p">(</span><span class="n">texts</span><span class="p">,</span> <span class="n">authors</span><span class="p">,</span> <span class="n">test_size</span> <span class="o">=</span> <span class="mf">0.1</span><span class="p">,</span> <span class="n">random_state</span> <span class="o">=</span> <span class="mi">42</span><span class="p">)</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>The <code class="highlighter-rouge">test_size</code> argument is the proportion of data to split into the test, in our case we split 10% for testing.</p>
|
||||
|
||||
<h3 id="vectorized-the-strings">Vectorized the Strings</h3>
|
||||
|
||||
<p>When working with a text document, we need to vectorize the strings into a list of numbers so it’s easier and more efficient to process. We can use the <a href="http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.TfidfVectorizer.html"><code class="highlighter-rouge">TfidfVectorizer</code></a> class to vectorize the strings into a matrix of TF-IDF features.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">sklearn.feature_extraction.text</span> <span class="kn">import</span> <span class="n">TfidfVectorizer</span>
|
||||
|
||||
<span class="n">vectorizer</span> <span class="o">=</span> <span class="n">TfidfVectorizer</span><span class="p">(</span><span class="n">sublinear_tf</span> <span class="o">=</span> <span class="bp">True</span><span class="p">,</span> <span class="n">max_df</span> <span class="o">=</span> <span class="mf">0.5</span><span class="p">,</span> <span class="n">stop_words</span> <span class="o">=</span> <span class="s">"english"</span><span class="p">)</span>
|
||||
<span class="n">features_train_transformed</span> <span class="o">=</span> <span class="n">vectorizer</span><span class="o">.</span><span class="n">fit_transform</span><span class="p">(</span><span class="n">features_train</span><span class="p">)</span>
|
||||
<span class="n">features_test_transformed</span> <span class="o">=</span> <span class="n">vectorizer</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">features_test</span><span class="p">)</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Word with a frequency higher than the <code class="highlighter-rouge">max_df</code> will be ignored. Stop words are also ignored—stop words are the most common words in a language (e.g. a, the, has).</p>
|
||||
|
||||
<h3 id="feature-selection">Feature Selection</h3>
|
||||
|
||||
<p>Text can have a lot of features thus it may slow to compute. We can use scikit <a href="http://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.SelectPercentile.html"><code class="highlighter-rouge">SelectPercentile</code></a> class to select only the important features.</p>
|
||||
|
||||
<div class="language-py highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">selector</span> <span class="o">=</span> <span class="n">SelectPercentile</span><span class="p">(</span><span class="n">f_classif</span><span class="p">,</span> <span class="n">percentile</span> <span class="o">=</span> <span class="mi">10</span><span class="p">)</span>
|
||||
<span class="n">selector</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">features_train_transformed</span><span class="p">,</span> <span class="n">labels_train</span><span class="p">)</span>
|
||||
<span class="n">selected_features_train_transformed</span> <span class="o">=</span> <span class="n">selector</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">features_train_transformed</span><span class="p">)</span><span class="o">.</span><span class="n">toarray</span><span class="p">()</span>
|
||||
<span class="n">selected_features_test_transformed</span> <span class="o">=</span> <span class="n">selector</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">features_test_transformed</span><span class="p">)</span><span class="o">.</span><span class="n">toarray</span><span class="p">()</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>The <code class="highlighter-rouge">percentile</code> is the percentage of features that we’d like to select based on its highest score.</p>
|
||||
|
||||
<h5 id="this-article-is-for-demo-purpose-1">This article is for Demo purpose</h5>
|
||||
|
||||
<p>The article was originally on <a href="https://github.com/risan/risanb.com/blob/master/content/posts/python-notes-from-intro-to-machine-learning/index.md">this repo</a></p></content><author><name>Klisé Theme</name><email>your-email@email.com</email></author><category term="python" /><category term="machine-learning" /><summary type="html">This article is for Demo purpose</summary></entry><entry><title type="html">React Component with Dot Notation</title><link href="http://localhost:4000/react-component-with-dot-notation/" rel="alternate" type="text/html" title="React Component with Dot Notation" /><published>2018-04-07T23:04:00+07:00</published><updated>2018-04-07T23:04:00+07:00</updated><id>http://localhost:4000/react-component-with-dot-notation</id><content type="html" xml:base="http://localhost:4000/react-component-with-dot-notation/"><h5 id="this-article-is-for-demo-purpose">This article is for Demo purpose</h5>
|
||||
|
||||
<p>The article was originally on <a href="https://github.com/risan/risanb.com/blob/master/content/posts/react-component-with-dot-notation/index.md">this repo</a></p>
|
||||
|
||||
<p>This is my answer to someone’s question on <a href="https://stackoverflow.com/questions/49256472/react-how-to-extend-a-component-that-has-child-components-and-keep-them/49258038#answer-49258038">StackOverflow</a>. How can we define a React component that is accessible through the dot notation?</p>
|
||||
|
||||
<p>Take a look at the following code. We have the <code class="highlighter-rouge">Menu</code> component and its three children <code class="highlighter-rouge">Menu.Item</code>:</p>
|
||||
|
||||
<div class="language-jsx highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">const</span> <span class="nx">App</span> <span class="o">=</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">(</span>
|
||||
<span class="p">&lt;</span><span class="nc">Menu</span><span class="p">&gt;</span>
|
||||
<span class="p">&lt;</span><span class="nc">Menu</span><span class="p">.</span><span class="nc">Item</span><span class="p">&gt;</span>Home<span class="p">&lt;/</span><span class="nc">Menu</span><span class="p">.</span><span class="nc">Item</span><span class="p">&gt;</span>
|
||||
<span class="p">&lt;</span><span class="nc">Menu</span><span class="p">.</span><span class="nc">Item</span><span class="p">&gt;</span>Blog<span class="p">&lt;/</span><span class="nc">Menu</span><span class="p">.</span><span class="nc">Item</span><span class="p">&gt;</span>
|
||||
<span class="p">&lt;</span><span class="nc">Menu</span><span class="p">.</span><span class="nc">Item</span><span class="p">&gt;</span>About<span class="p">&lt;/</span><span class="nc">Menu</span><span class="p">.</span><span class="nc">Item</span><span class="p">&gt;</span>
|
||||
<span class="p">&lt;/</span><span class="nc">Menu</span><span class="p">&gt;</span>
|
||||
<span class="p">);</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>How can we define a component like <code class="highlighter-rouge">Menu</code>? Where it has some kind of “sub-component” that is accessible through a dot notation.</p>
|
||||
|
||||
<p>Well, it’s actually a pretty common pattern. And it’s not really a sub-component, it’s just another component being attached to another one.</p>
|
||||
|
||||
<p>Let’s use the above <code class="highlighter-rouge">Menu</code> component for example. We’ll put this component to its own dedicated file: <code class="highlighter-rouge">menu.js</code>. First, let’s define these two components separately on this module file:</p>
|
||||
|
||||
<div class="language-jsx highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// menu.js</span>
|
||||
<span class="k">import</span> <span class="nx">React</span> <span class="k">from</span> <span class="s1">'react'</span><span class="p">;</span>
|
||||
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">MenuItem</span> <span class="o">=</span> <span class="p">({</span> <span class="nx">children</span> <span class="p">})</span> <span class="o">=&gt;</span> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="si">{</span><span class="nx">children</span><span class="si">}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;;</span>
|
||||
|
||||
<span class="k">export</span> <span class="k">default</span> <span class="kd">const</span> <span class="nx">Menu</span> <span class="o">=</span> <span class="p">({</span> <span class="nx">children</span> <span class="p">})</span> <span class="o">=&gt;</span> <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span><span class="si">{</span><span class="nx">children</span><span class="si">}</span><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;;</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>It’s just a simple functional component. The <code class="highlighter-rouge">Menu</code> is the parent with <code class="highlighter-rouge">ul</code> tag. And the <code class="highlighter-rouge">MenuItem</code> will act as its children. Now we can use these two components like so:</p>
|
||||
|
||||
<div class="language-jsx highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">import</span> <span class="nx">React</span> <span class="k">from</span> <span class="s2">"react"</span><span class="p">;</span>
|
||||
<span class="k">import</span> <span class="p">{</span> <span class="nx">render</span> <span class="p">}</span> <span class="k">from</span> <span class="s2">"react-dom"</span><span class="p">;</span>
|
||||
<span class="k">import</span> <span class="nx">Menu</span><span class="p">,</span> <span class="p">{</span> <span class="nx">MenuItem</span> <span class="p">}</span> <span class="k">from</span> <span class="s2">"./menu"</span><span class="p">;</span>
|
||||
|
||||
<span class="kd">const</span> <span class="nx">App</span> <span class="o">=</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">(</span>
|
||||
<span class="p">&lt;</span><span class="nc">Menu</span><span class="p">&gt;</span>
|
||||
<span class="p">&lt;</span><span class="nc">MenuItem</span><span class="p">&gt;</span>Home<span class="p">&lt;/</span><span class="nc">MenuItem</span><span class="p">&gt;</span>
|
||||
<span class="p">&lt;</span><span class="nc">MenuItem</span><span class="p">&gt;</span>Blog<span class="p">&lt;/</span><span class="nc">MenuItem</span><span class="p">&gt;</span>
|
||||
<span class="p">&lt;</span><span class="nc">MenuItem</span><span class="p">&gt;</span>About<span class="p">&lt;/</span><span class="nc">MenuItem</span><span class="p">&gt;</span>
|
||||
<span class="p">&lt;/</span><span class="nc">Menu</span><span class="p">&gt;</span>
|
||||
<span class="p">);</span>
|
||||
|
||||
<span class="nx">render</span><span class="p">(&lt;</span><span class="nc">App</span> <span class="p">/&gt;,</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s2">"root"</span><span class="p">));</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Where’s the dot notation? To make our <code class="highlighter-rouge">MenuItem</code> component accessible through the dot nation, we can simply attach it to the <code class="highlighter-rouge">Menu</code> component as a static property. To do so, we can no longer use the functional component for <code class="highlighter-rouge">Menu</code> and switch to the class component instead:</p>
|
||||
|
||||
<div class="language-jsx highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// menu.js</span>
|
||||
<span class="k">import</span> <span class="nx">React</span><span class="p">,</span> <span class="p">{</span> <span class="nx">Component</span> <span class="p">}</span> <span class="k">from</span> <span class="s1">'react'</span><span class="p">;</span>
|
||||
|
||||
<span class="k">export</span> <span class="k">default</span> <span class="kd">const</span> <span class="nx">MenuItem</span> <span class="o">=</span> <span class="p">({</span> <span class="nx">children</span> <span class="p">})</span> <span class="o">=&gt;</span> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="si">{</span><span class="nx">children</span><span class="si">}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;;</span>
|
||||
|
||||
<span class="k">export</span> <span class="k">default</span> <span class="kd">class</span> <span class="nx">Menu</span> <span class="kd">extends</span> <span class="nx">Component</span> <span class="p">{</span>
|
||||
<span class="kr">static</span> <span class="nx">Item</span> <span class="o">=</span> <span class="nx">MenuItem</span><span class="p">;</span>
|
||||
|
||||
<span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="p">(</span>
|
||||
<span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span><span class="si">{</span><span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">.</span><span class="nx">children</span><span class="si">}</span><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span>
|
||||
<span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Now we can use the dot notation to declare the <code class="highlighter-rouge">MenuItem</code> component:</p>
|
||||
|
||||
<div class="language-jsx highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">import</span> <span class="nx">React</span> <span class="k">from</span> <span class="s2">"react"</span><span class="p">;</span>
|
||||
<span class="k">import</span> <span class="p">{</span> <span class="nx">render</span> <span class="p">}</span> <span class="k">from</span> <span class="s2">"react-dom"</span><span class="p">;</span>
|
||||
<span class="k">import</span> <span class="nx">Menu</span> <span class="k">from</span> <span class="s2">"./menu"</span><span class="p">;</span>
|
||||
|
||||
<span class="kd">const</span> <span class="nx">App</span> <span class="o">=</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">(</span>
|
||||
<span class="p">&lt;</span><span class="nc">Menu</span><span class="p">&gt;</span>
|
||||
<span class="p">&lt;</span><span class="nc">Menu</span><span class="p">.</span><span class="nc">Item</span><span class="p">&gt;</span>Home<span class="p">&lt;/</span><span class="nc">Menu</span><span class="p">.</span><span class="nc">Item</span><span class="p">&gt;</span>
|
||||
<span class="p">&lt;</span><span class="nc">Menu</span><span class="p">.</span><span class="nc">Item</span><span class="p">&gt;</span>Blog<span class="p">&lt;/</span><span class="nc">Menu</span><span class="p">.</span><span class="nc">Item</span><span class="p">&gt;</span>
|
||||
<span class="p">&lt;</span><span class="nc">Menu</span><span class="p">.</span><span class="nc">Item</span><span class="p">&gt;</span>About<span class="p">&lt;/</span><span class="nc">Menu</span><span class="p">.</span><span class="nc">Item</span><span class="p">&gt;</span>
|
||||
<span class="p">&lt;/</span><span class="nc">Menu</span><span class="p">&gt;</span>
|
||||
<span class="p">);</span>
|
||||
|
||||
<span class="nx">render</span><span class="p">(&lt;</span><span class="nc">App</span> <span class="p">/&gt;,</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s2">"root"</span><span class="p">));</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>You can also put the <code class="highlighter-rouge">MenuItem</code> component definition directly within the <code class="highlighter-rouge">Menu</code> class. But this way you can no longer import <code class="highlighter-rouge">MenuItem</code> individually.</p>
|
||||
|
||||
<div class="language-jsx highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">import</span> <span class="nx">React</span><span class="p">,</span> <span class="p">{</span> <span class="nx">Component</span> <span class="p">}</span> <span class="k">from</span> <span class="s2">"react"</span><span class="p">;</span>
|
||||
|
||||
<span class="k">export</span> <span class="k">default</span> <span class="kd">class</span> <span class="nx">Menu</span> <span class="kd">extends</span> <span class="nx">Component</span> <span class="p">{</span>
|
||||
<span class="kr">static</span> <span class="nx">Item</span> <span class="o">=</span> <span class="p">({</span> <span class="nx">children</span> <span class="p">})</span> <span class="o">=&gt;</span> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="si">{</span><span class="nx">children</span><span class="si">}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;;</span>
|
||||
|
||||
<span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span><span class="si">{</span><span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">.</span><span class="nx">children</span><span class="si">}</span><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;;</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h5 id="this-article-is-for-demo-purpose-1">This article is for Demo purpose</h5>
|
||||
|
||||
<p>The article was originally on <a href="https://github.com/risan/risanb.com/blob/master/content/posts/react-component-with-dot-notation/index.md">this repo</a></p></content><author><name>Klisé Theme</name><email>your-email@email.com</email></author><category term="javascript" /><category term="react" /><summary type="html">This article is for Demo purpose</summary></entry></feed>
|
||||
7
_site/how-this-site-was-made/index.html
Normal file
1
_site/index.html
Normal file
5
_site/notes/index.html
Normal file
7
_site/now.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 2,
|
||||
"routes": [
|
||||
{ "handle": "filesystem" },
|
||||
{ "src": "/.*", "status": 404, "dest": "404.html" }
|
||||
]
|
||||
}
|
||||
219
_site/python-notes-from-Intro-to-machine-learning/index.html
Normal file
63
_site/react-component-with-dot-notation/index.html
Normal file
1
_site/resume/index.html
Normal file
1
_site/robots.txt
Normal file
@@ -0,0 +1 @@
|
||||
Sitemap: http://localhost:4000/sitemap.xml
|
||||
41
_site/sitemap.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>http://localhost:4000/react-component-with-dot-notation/</loc>
|
||||
<lastmod>2018-04-07T23:04:00+07:00</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://localhost:4000/python-notes-from-Intro-to-machine-learning/</loc>
|
||||
<lastmod>2018-04-14T10:00:00+07:00</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://localhost:4000/how-this-site-was-made/</loc>
|
||||
<lastmod>2018-09-28T09:45:47+07:00</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://localhost:4000/apa-itu-shell/</loc>
|
||||
<lastmod>2020-01-25T11:58:47+07:00</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://localhost:4000/cara-memperbarui-fork-repository/</loc>
|
||||
<lastmod>2020-01-29T01:00:00+07:00</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://localhost:4000/about/</loc>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://localhost:4000/</loc>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://localhost:4000/notes/</loc>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://localhost:4000/resume/</loc>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://localhost:4000/tags/</loc>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://localhost:4000/thanks/</loc>
|
||||
</url>
|
||||
</urlset>
|
||||