Showing posts with label css. Show all posts
Showing posts with label css. Show all posts

This Week I Learned - 2016 Week 38

Last week post or the whole series. Interesting stuff learned this week.

Encountered this error message when checking a USB thumbdrive with `fdisk` command. The particular thumb drive was burned with an ISO file through the `dd` command.
$ sudo fdisk -l
......
GPT PMBR size mismatch (1432123 != 15765503) will be corrected by w(rite).
Disk /dev/sdc: 7.5 GiB, 8071938048 bytes, 15765504 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8C18967D-CB41-4EF1-8958-4E495054958D

Device     Start     End Sectors   Size Type
/dev/sdc1     64   17611   17548   8.6M Microsoft basic data
/dev/sdc2  17612   23371    5760   2.8M EFI System
/dev/sdc3  23372 1432075 1408704 687.9M Microsoft basic data

Follow the instructions given, running the device through `gparted` seems to resolve the issue.



Perl's hash initialization, referencing, and de-referencing. Seriously, I need to get this correctly and read more Perl's FAQs.
# Normal way, without referencing.
%foobar = (a => '1', b => '2');
say $foobar{a};

# Using referencing. More readable.
$foobar = {a => '1', b => '2'};
say $foobar->{a};

# Alternatively.
$foobar_ref = \%foobar;
say $foobar_ref->{a};

Finding properties of the event target in Javascript.
$('foo').bind('click', function () {
    // inside here, `this` will refer to the foo that was clicked
});

How do you add a trailing slash if none found? Regex, regex.
$string =~ s!/*$!/!; # Add a trailing slash

Protocol-relative URL. While we're on HTTP protocol, it was made aware to me that the anchor tag should be the last item on the URL.

CSS image sprite technique using HTML unordered list. One of the issue encountered is if you have single line text link, how do you align the text link vertically in the middle? Make sure the `line-height` is equal to `height` for the `li`` element.

Git merge conflict? Just abort the whole process.

Similarly discard all changes on a diverged local branch, two ways. First method is to my liking.
# Method 1
$ git branch -D phobos
$ git checkout --track -b phobos origin/phobos

# Method 2
$ git checkout phobos
$ git reset --hard origin/phobos

Debugging Dockerfile. Something I learned this week but in a separate and longer post.

Starting a new software project but not sure about which technology stack to use? Read this slide as a guide.






This Week I Learned - 2016 Week 27

Looking back to the last week post or you might want to check out the whole series.

What is Modern Perl? (via HN). The transition of Perl development motto from TMTOWTDI (pronounced Tim Toady) to TIMTOWTDIBSCINABTE (Tim Toady Bicarbonate). It took them (the Perl community) quite a long time to realize that consistency is not a bad things. Some approaches are really preferable but at least there should be a consistency way of coding, hence coding convention should and would exists in a project or a team.

REPL for Perl? Well, you will have to install Devel::REPL with some customization and workaround. To get started, just install these modules and run these commands.
# Prevent Data::Dump::Streamer failed to install error.
# See https://rt.cpan.org/Public/Bug/Display.html?id=100488
$ cpanm PadWalker 

# Enable command history
# See http://stackoverflow.com/a/28818133
$ cpanm Term::Readline::Gnu 

# Install the REPL
$ cpanm Devel::REPL

# Run the REPL
$ re.pl

# Find the Perl version through '$]' and '$^V' Perl's variables.
$ $]
5.024000

$ $^V
v5.24.0

# Quit from the REPL.
$ exit

How X11 works. Wonderful guide on underlying structure of X Windows System.

Free Perl programming books. Didn't realize there are still a lot of unknown, although quite old, Perl books.

Do you suffer from compulsive hoarding? Then r/datahoarder is for you. Be warned, you will burn some extra money to collect these data.

Probably the minimum Vim settings (compare to this and this) to have a good usage experiences, especially when administrating a server through the console.

How to write defensive Bash script. There is always one rule that I never follow, whic is to explicitly make all variables 'local'. Not a good habit if you want to be proficient at console.

It's the future. Be aware of over-engineered and complex solutions for your application before you decide to adopt it to your technology stack.

Awesome list of Perl resources. While we're at it, should you still use Perl?

It has been a while since I last follow with any CSS standard. For me, the existence of CSS frameworks means that the CSS is a solved issue for web development. One thing I noticed that the CSS box-model have changed these days till we have International box-sizing awareness day which the default 'box-sizing' should be 'border-box'. It seems that the Internet Explorer was rights about the default box calculation.

Centering a div in 2014

Sad but true, yet in 2014, we still need to resolve to ridiculous hacks to center a bloody div tag. Changes in the web standard still moving at a slow pace, mostly due to the monopoly and high Internet Explorer browser market share.

Not to mention the fixed or sticky footer. Sigh.