Hey, it’s been a while since the last time I updated my blog. I spent some time learnig html, css and javascript. Though I am still in a very beginner state, I feel like I would like to learn some interesting code I randomly found. Try to breakdown to see what I can learn from them.
The article is about implementing Voronoi-Diagram in Javascript. The resource can be found here.
I found this recently hosted AEC hackathon video. To be honest, this will be the first hackathon I knew in AEC industy was held.Just want to memo down some interesting ideas from each project. Oh also, I heard the Glodfinger was the big winner of this event. I would like to dive deep into there source code in near future, and I might write some other posts for that topic.
Sunday Programme
Pollution Solution
People from A to B, might consider not only the distance, but also the air quality as well.
Find alternative routes where pollution levels are significantly lower
Algorithm taking the Google pollution data into account.
Recently, I found myself tend to absorb some general knowledge in tech-field at late night. I got company with Lofi music from Spotify. This post tend to note down some benefits for programmer switch to Linux instead of other OS, for say Windows or MacOS.
I’ve had this rough ideas about those great programmers tend to work in pure text, command line enviroment a lot, not saying they don’t want to use GUI, it’s just faster if both hands can stick on their keyboard and get everything done.
LinuxOS is open source, meaning anyone who want to can look at the source code. Although this might mean anyone who want to attack the other’s machine can find the system flaw easily, it turns out become harder to hack in. Because Linux is a famous OS, thousands of other programmers run the code on their local machine,and they don’t want someone can get a way hack in, they patched the flaws once found it.
Improve programming workflow
For example, if you want to install something:
The scenario in a linux machine will be
1
sudo apt-get install whatever-you-want-to
However, if you are in a MacOS or Windows.
you might need a package manager
Or find the correct link on the correct webpage
click several button while installing
might need to restart your machine
As a developer, we constantly install things and linux make this procedure less pain.
No rebooting
Linux can update the entire whole Operating System without any reboot. This is neither possible on MacOS nor Windows. This no-rebooting thing is one of the reason why linux is choosed for running most of the servers.
Many Linux servers on the Internet have been running for years without failure or even being restarted.
Powerful Programming Tools pre-installed
GREP
wget
_corn
Task automation
Linux lend itself very well for automation. one-liner means short little scripts that you write to automate a task.
Performace
Linux is not neccessary faster than other OS, but it is very lightweight for an OS.
I went a long long walk today, approximately 21km and took me 6.7 hours. The weather today was just so great. Recently, I noticed that if the article I posted only has the techicial contents, that might be a bit boring. The whole keep posting thing is for me to be motivated, so I decided that I need to write down some thoughts ahead or behind the article, to make it more human.
What’s my thoughts about YAML before learning it.
I have had much knowledge about yaml before I tried to post on github Page. I am currently using the hexo framework, organizing my blogs, and inside the folder, there’s one .yaml file owns a lot of settings we can play around.
I could put whatever font I want. It might work on my machine, but I have no guarantees that same font will exist or be installed on your machine or the average person’s machine.
One option that we have is to actually include a font. As part of our document, we can include a font file so you can buy a font, you can download them.
Inline: Width and Height are ignored. Margin & Padding push elements away horizontally but not vertically.
Block: Block elements break the flow of a document. Width, Height, Margin, & Padding are respected.
Inline-Block: Behaved like an inline element except Width, Height, Margin, & Padding are respected.
Hide element
1 2 3
h1{ display: none; }
CSS Unit Revisited
Relative
em
rem
vh
vw
%
and more!
Absolute
px
pt
cm
in
mm
em
font-size: em meanings relative value from its parent. margin: em meanings relative value from itself(font-size).
One problem from em will be if you put em in a nested structure, let’s say a nested list, the factor will either grow or shrink dramatically.
rem
Root ems
Relative to the root html element‘s font-size. Often easier to work with. If the root font-size is 20px, 1 rem is always 20px, 2rem is always 40px, etc.
Keyword added to a selector that lets you style a particular part of selected element(s)
::after
::before
::first-letter
::first-line
::selection
SPECIFICITY
Specificity is how the brower decides which rules to apply when multiple rules could apply to the same element. It is a measure of how specific a given selector is. The more specific selector “wins”.
CSS is a language for describing how documents are presented visually - how they are arranged and styled
What does it stand for?
CSS stands for Cascading Style Sheets.
CSS RULES
(almost) everything you do in CSS follows this basic pattern
1 2 3
selector{ property: value; }
Including Style Correctly
Inline Style: You can write your styles directly inline on each element, but this is NOT A GOOD IDEA most of the time.
The STYLE element: You can write your style inside of a <style> element. This is easy, but it makes it impossible to share styles between documents. Not recommended either
External stylesheet: Write your styles in a .css file, and then include the using a <link> in the head of your html document. Recommended!