Skip to content

Commit

Permalink
Merge pull request #1 from cinhtau/feature/2019-01
Browse files Browse the repository at this point in the history
Feature/2019 01
  • Loading branch information
cinhtau authored Feb 2, 2019
2 parents 4488dcb + 58a8fe5 commit c67a0ef
Show file tree
Hide file tree
Showing 34 changed files with 673 additions and 78 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ Gemfile.lock
_site

# fortune strfile
*.dat
*.dat

# sensitive security data
GH_TOKEN

# apple
.DS_Store
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cookie.cinhtau.net
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

gem "github-pages", group: :jekyll_plugins
gem "jekyll-github-metadata"
79 changes: 4 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# geek-fortune-cookies

Fortune cookies for Geeks
## About fortune

[MIT License](LICENSE)
License: [MIT](LICENSE)

![Fortune Cookie](https://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Fortune_cookies.jpg/320px-Fortune_cookies.jpg)


## About fortune

[fortune](https://en.wikipedia.org/wiki/Fortune_(Unix)) is a program from BSD that picks a random message from a database.

This projects contribution is a database for Geeks.
Expand Down Expand Up @@ -85,7 +81,7 @@ Examples of unacceptable behavior by participants include:
### Format
fortune uses database
Check what kind of database sources `fortune` uses:
```bash
fortune -f
Expand All @@ -95,74 +91,7 @@ fortune -f
31.91% literature
```
The database will be named after the sources.
### Sources
* Programming Wisdom (Twitter Account)
* I Am Devloper (Twitter Account)
### Data
Find first examples in the fortune directory. In order to use the fortune databases, create a random access file for storing strings with `strfile`.
```bash
for db in databases/*; do strfile $db;done
```
Output
```text
"databases/i-am-developer.dat" created
There was 1 string
Longest string: 91 bytes
Shortest string: 91 bytes
"databases/i-am-developer.dat.dat" created
There was 1 string
Longest string: 32 bytes
Shortest string: 32 bytes
"databases/programming-wisdom.dat" created
There were 2 strings
Longest string: 123 bytes
Shortest string: 114 bytes
"databases/programming-wisdom.dat.dat" created
There was 1 string
Longest string: 36 bytes
Shortest string: 36 bytes
```
### Format
* Each entry starts with `%`
* Each entry must end with a newline.
### Usage
To use fortune with the databases, we pass the directory.
```bash
fortune databases
We build our computers the way we build our cities:
over time, without a plan, on top of ruins.
-- Ellen Ullman
```
Use it with `cowsay`
```
fortune databases | cowsay
_________________________________________
/ We build our computers the way we build \
| our cities: |
| |
| over time, without a plan, on top of |
| ruins. |
| |
\ -- Ellen Ullman /
-----------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
```
* I Am Devleoper (Twitter Account)
65 changes: 64 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1 +1,64 @@
theme: jekyll-theme-minimal
theme: jekyll-theme-minimal
logo: /assets/images/avatar.png
description: Fortune cookies for geeks.
show_downloads: true

author: cinhtau
date_format: "%F"
future: true

# Build settings
markdown: kramdown
highlighter: rouge

lang: en

kramdown:
toc_levels: 2..6

plugins:
- "jekyll-github-metadata"
- jekyll-archives
- jekyll-sitemap
- jekyll-feed
- jekyll-email-protect
- jekyll-gist
- jemoji

# Google Analytics
google_analytics: UA-98721919-2

permalink: /:year/:month/:day/:title/

favicon_dir: "https://cookie.cinhtau.net/assets/favicon"

exclude:
- Gemfile
- Gemfile.lock
- .gitignore
- gulpfile.js
- node_modules
- drafts
- .idea
- .sass-cache
- geek-fortune-cookies.iml
- docs.ipr
- confidential
- package.json
- package-lock.json
- vendor
- '_assets'
- buildspec.yml
- yarn.lock
- serve.sh
- install.sh

compress_html:
clippings: all
comments: ["<!-- ", " -->"]
endings: []
ignore:
envs: []
blanklines: false
profile: false
startings: []
7 changes: 7 additions & 0 deletions _includes/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

<footer>
{% if site.github.is_project_page %}
<p>This project is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a></p>
{% endif %}
<p><small>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
</footer>
29 changes: 29 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- open graph -->
<meta property="og:image" content="{{ site.favicon_dir }}/og-image.jpg">
<meta property="og:image:width" content="256">
<meta property="og:image:height" content="256">
<meta property="og:title" content="Fortune Cookies for Geeks">
<meta property="og:description" content="Random wisdom from popular Twitter accounts about Software Development">
<meta property="og:url" content="https://cookie.cinhtau.net">

<!-- favicon -->
<link rel="apple-touch-icon" sizes="180x180" href="{{ site.favicon_dir }}/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="{{ site.favicon_dir }}/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="{{ site.favicon_dir }}/favicon-16x16.png">
<link rel="manifest" href="{{ site.favicon_dir }}/site.webmanifest">
<link rel="mask-icon" href="{{ site.favicon_dir }}/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">

{% seo %}
<link rel="stylesheet" href="{{ "/assets/css/style.css?v=" | append: site.github.build_revision | relative_url }}">

<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->
</head>
16 changes: 16 additions & 0 deletions _includes/postlist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{%- if site.posts.size > 0 -%}
<h2>{{ page.list_title | default: "Latest News" }}</h2>
<p class="view">
{%- for post in site.posts -%}

{%- assign date_format = site.date_format | default: "%b %-d, %Y" -%}
<p>{{ post.date | date: date_format }}</span> -

<a class="post-link" href="{{ post.url | relative_url }}">
{{ post.title }}
</a>
</p>

{%- endfor -%}
</ul></p>
{%- endif -%}
11 changes: 11 additions & 0 deletions _includes/script.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script src="{{ "/assets/js/scale.fix.js" | relative_url }}"></script>
{% if site.google_analytics %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>
{% endif %}
10 changes: 10 additions & 0 deletions _layouts/compress.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# Jekyll layout that compresses HTML
# v3.0.4
# http://jch.penibelst.de/
# © 2014–2015 Anatol Broder
# MIT License
---

{% capture _LINE_FEED %}
{% endcapture %}{% if site.compress_html.ignore.envs contains jekyll.environment %}{{ content }}{% else %}{% capture _content %}{{ content }}{% endcapture %}{% assign _profile = site.compress_html.profile %}{% if site.compress_html.endings == "all" %}{% assign _endings = "html head body li dt dd optgroup option colgroup caption thead tbody tfoot tr td th" | split: " " %}{% else %}{% assign _endings = site.compress_html.endings %}{% endif %}{% for _element in _endings %}{% capture _end %}</{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _end %}{% endfor %}{% if _profile and _endings %}{% assign _profile_endings = _content | size | plus: 1 %}{% endif %}{% for _element in site.compress_html.startings %}{% capture _start %}<{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _start %}{% endfor %}{% if _profile and site.compress_html.startings %}{% assign _profile_startings = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.comments == "all" %}{% assign _comments = "<!-- -->" | split: " " %}{% else %}{% assign _comments = site.compress_html.comments %}{% endif %}{% if _comments.size == 2 %}{% capture _comment_befores %}.{{ _content }}{% endcapture %}{% assign _comment_befores = _comment_befores | split: _comments.first %}{% for _comment_before in _comment_befores %}{% if forloop.first %}{% continue %}{% endif %}{% capture _comment_outside %}{% if _carry %}{{ _comments.first }}{% endif %}{{ _comment_before }}{% endcapture %}{% capture _comment %}{% unless _carry %}{{ _comments.first }}{% endunless %}{{ _comment_outside | split: _comments.last | first }}{% if _comment_outside contains _comments.last %}{{ _comments.last }}{% assign _carry = false %}{% else %}{% assign _carry = true %}{% endif %}{% endcapture %}{% assign _content = _content | remove_first: _comment %}{% endfor %}{% if _profile %}{% assign _profile_comments = _content | size | plus: 1 %}{% endif %}{% endif %}{% assign _pre_befores = _content | split: "<pre" %}{% assign _content = "" %}{% for _pre_before in _pre_befores %}{% assign _pres = _pre_before | split: "</pre>" %}{% assign _pres_after = "" %}{% if _pres.size != 0 %}{% if site.compress_html.blanklines %}{% assign _lines = _pres.last | split: _LINE_FEED %}{% capture _pres_after %}{% for _line in _lines %}{% assign _trimmed = _line | split: " " | join: " " %}{% if _trimmed != empty or forloop.last %}{% unless forloop.first %}{{ _LINE_FEED }}{% endunless %}{{ _line }}{% endif %}{% endfor %}{% endcapture %}{% else %}{% assign _pres_after = _pres.last | split: " " | join: " " %}{% endif %}{% endif %}{% capture _content %}{{ _content }}{% if _pre_before contains "</pre>" %}<pre{{ _pres.first }}</pre>{% endif %}{% unless _pre_before contains "</pre>" and _pres.size == 1 %}{{ _pres_after }}{% endunless %}{% endcapture %}{% endfor %}{% if _profile %}{% assign _profile_collapse = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.clippings == "all" %}{% assign _clippings = "html head title base link meta style body article section nav aside h1 h2 h3 h4 h5 h6 hgroup header footer address p hr blockquote ol ul li dl dt dd figure figcaption main div table caption colgroup col tbody thead tfoot tr td th" | split: " " %}{% else %}{% assign _clippings = site.compress_html.clippings %}{% endif %}{% for _element in _clippings %}{% assign _edges = " <e;<e; </e>;</e>;</e> ;</e>" | replace: "e", _element | split: ";" %}{% assign _content = _content | replace: _edges[0], _edges[1] | replace: _edges[2], _edges[3] | replace: _edges[4], _edges[5] %}{% endfor %}{% if _profile and _clippings %}{% assign _profile_clippings = _content | size | plus: 1 %}{% endif %}{{ _content }}{% if _profile %} <table id="compress_html_profile_{{ site.time | date: "%Y%m%d" }}" class="compress_html_profile"> <thead> <tr> <td>Step <td>Bytes <tbody> <tr> <td>raw <td>{{ content | size }}{% if _profile_endings %} <tr> <td>endings <td>{{ _profile_endings }}{% endif %}{% if _profile_startings %} <tr> <td>startings <td>{{ _profile_startings }}{% endif %}{% if _profile_comments %} <tr> <td>comments <td>{{ _profile_comments }}{% endif %}{% if _profile_collapse %} <tr> <td>collapse <td>{{ _profile_collapse }}{% endif %}{% if _profile_clippings %} <tr> <td>clippings <td>{{ _profile_clippings }}{% endif %} </table>{% endif %}{% endif %}
53 changes: 53 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
layout: compress
---

<!DOCTYPE html>
<html lang="{{ site.lang | default: "en-US" }}">

{% include head.html %}

<body>
<div class="wrapper">
<header>
<h1><a href="{{ "/" | absolute_url }}">{{ site.title | default: site.github.repository_name }}</a></h1>

{% if site.logo %}
<img src="{{site.logo | relative_url}}" alt="Logo" />
{% endif %}

<p>{{ site.description | default: site.github.project_tagline }}</p>

{% if site.github.is_project_page %}
<p class="view"><a href="{{ site.github.repository_url }}">View the Project on GitHub <small>{{ site.github.repository_nwo }}</small></a></p>
{% endif %}

{% if site.github.is_user_page %}
<p class="view"><a href="{{ site.github.owner_url }}">View My GitHub Profile</a></p>
{% endif %}

{% if site.show_downloads %}
<ul class="downloads">
<li><a href="{{ site.github.zip_url }}">Download <strong>ZIP File</strong></a></li>
<li><a href="{{ site.github.tar_url }}">Download <strong>TAR Ball</strong></a></li>
<li><a href="{{ site.github.repository_url }}">View On <strong>GitHub</strong></a></li>
</ul>
{% endif %}

{% include postlist.html %}
</header>

<section>

{{ content }}

</section>

{% include footer.html %}

</div>

{% include script.html %}

</body>
</html>
11 changes: 11 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
layout: default
---
<article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting">

<div class="post-content e-content" itemprop="articleBody">
{{ content }}
</div>

<a class="u-url" href="{{ page.url | relative_url }}" hidden></a>
</article>
32 changes: 32 additions & 0 deletions _posts/2019-01-12-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

## The fun has started

My motivation for this project is a customisation of my `zsh`.

Every time I login I want to see the current weather of my location and fortune cookie.

Example: zsh Dark

![Solarized Dark](https://cinhtau.github.io/geek-fortune-cookies/assets/images/zsh-solarized-dark-fortune.png)

Example: zsh Light

![Solarized Light](https://cinhtau.github.io/geek-fortune-cookies/assets/images/zsh-solarized-light-fortune.png)

## Problem

I am dissatisfied with the existing content.

## Solution

Most of time I read the Twitter tweets from

- [Programming Wisdom](https://twitter.com/CodeWisdom)
- [I Am Devloper](https://twitter.com/iamdevloper)

For instance:

![I Am Developer Tweet](https://cinhtau.github.io/geek-fortune-cookies/assets/images/code_review.png)

So my idea is to extract the tweets from Twitter and output it as [`fortune`](https://www.unix.com/man-page/freebsd/6/fortune/)
compatible databases for my daily use.
Loading

0 comments on commit c67a0ef

Please sign in to comment.