/dev/nikc/blog

Kuolleiden purjehduskenkien seura

Dec 8th 2015

Native CSS Variables Are Golden

12:38

If you read Philip Walton’s blogpost Why I’m Excited About Native CSS Variables, you, just like me, would also be, or at least you should be, excited about native CSS Variables.

Until now I have been using postcss-custom-properties, but never before realised how much gold we’re still missing out on when we can’t utilise media queries, inheritance and the cascade in combination with CSS variables.

Native CSS variables today are available only in Firefox. They are under development for Chrome and Chrome Canary has them as an experimental feature1. IE Edge is considering them2. Safari seems to have some interest and is showing recent related work but the feature is absent from the WebKit Feature Status page. Opera is keeping quiet.

The specification is currently at the Candidate Recommendation stage. Make your voice heard and wake up all the browser vendors.

Shorts

  • A consequence of easily installable modules is that they inadvertently eat up quite a bit of disk space. Using find and du it’s easy to find the biggest culprits:

    find $PROJECTS_HOME -name “node_modules” -prune -exec du -sh {} \;

    (0) #

Sep 3rd 2015

Complement Git Stash With Commit And Soft Reset

11:01

One of my favourite Git tools is the stash. However, it doesn’t always quite fit the bill. E.g. you notice you need to amend a commit in your history, but stashing everything would lead to solving umpteen unrelated conflicts during a rebase update. Instead I like to store everything irrelevant for the amend as a stash-commit, then stash what I need to bring along.

The Three Step Workflow

  1. git commit -am "stash", i.e. commit everything (you want to stash) into a stash-commit
  2. do your work, usually involves rebasing and/or working in other branches
  3. git reset HEAD^, i.e. reverse the stash-commit from stage 1

Stash Can Do That

The same effect (or very similar) can be achieved with stash save --patch, but I find a stash-commit is often quicker and simpler. Personally, I also like that my stash-commit remains in the branch, whereas stashes are global.

Stashes are also much too easy to forget, and even if you have the option to name them when using stash save, I rarely do, which leads to not remembering what’s been stashed if it’s more than minutes ago.

Shorts

Aug 2nd 2015

A shoe is a shoe is a shoe, but isn’t

17:31

This is a story about a man and a pair of shoes. A pair of shoes, that at the time of purchase seemed to the man like any other ordinary pair of shoes. Little did he know, what kind of adventures the shoes would lead the man into, or the depths their relationship would eventually reach.

Mein Name Ist Parker

Our story begins in Berlin, more specifically in the Mephisto Shoes store on Kurfürstendamm, in the part of the German capital known as Charlottenburg, some time in the early 2010’s. Our hero picks up a pair of Mephisto Allrounder Parker shoes. Because they look and feel nice.

Today, years later, these same shoes are still our hero’s most favourite shoes in the whole world. His greatest fear, each time he wears them, is that they will break, and he can wear them no longer. Thus he seldom wears them, to keep them from falling apart, which is sad, because the effect is the same as them having fallen apart: our hero is shoeless.

Allrounders

As the picture maybe shows, despite its mediocrity, the shoes are well-worn, having accompanied our hero for many, many miles in several countries. They have attended many parties, and been the sole of nights in bars on many occasions. They are also the shoe of choice when a pair of conveniently packable shoes is called for. Their compact size really makes them ideal for the purpose.

One of our hero’s greatest regrets in life is not buying several pairs of these shoes when he had the chance.

Dwindling Quality

Fast forward some years, until 2013 to be exact, and several pairs of Allrounder shoes. Our hero is once more shopping for shoes, and to his delight has spotted a very near revival of his favourite shoe. This time, not wanting to repeat his earlier mistake, our hero buys two pairs at once.

And the shoes are good! They are nearly as conveniently sized as his all-time favourite, just as comfortable, and they even look pleasant to the eye. Sadly, neither of the two pairs is no longer with our hero.

The first pair suffered a torn seam almost immediately and was returned to the factory for a check up, never to be seen again, to our hero’s great disappointment. Being wiser, when a shoe in the second pair tore a seam, our hero took it to his local cobbler for repair. And the cobbler did a good job and the shoes were whole again, as was our hero.

Allrounders

As the picture maybe shows, despite its mediocrity, as time went on, our hero became good friends with his local cobbler, due to his frequent visits when seam after seam eventually let go in his near-all-time-favourite shoes. Eventually, to our hero’s great dismay, this unfortunate pair of shoes suffered a tear which rendered them irreparable.

Once more our hero was left caring for his only pair of his all-time favourite pair of shoes.

A Big Mistake

Despite having suffered great disappointment, our hero, being the loyal kind, still decided to invest yet once more into a pair of Allrounder shoes. After all, they had in general given more pleasure than caused displeasure.

This time, however, he decided to try a pair which weren’t all leather. As is customary when buying shoes, he bought a pair that were just a bit not-quite-but-very-nearly comfortable. The adage being shoes should be worn comfortable, not bought. This decision would haunt our hero later on, when after tens and tens of agonising hours later, the pair of shoes are still undistinguishable from medieval instruments of torture.

Allrounders

As the picture maybe shows, despite its mediocrity, the shoes are still looking nearly as new. Our hero believes this is not likely to change any time soon, as wearing them is not likely to inspire loving verse and song for a long time.

The Bane of Constant Renewal

It’s understandable that shoemakers feel the need to constantly create new designs, even our hero can understand the sentiment, but he still feels it is ridiculous: The Parker was already perfect, and improving perfection can only result in an inferior outcome. Instead it should have been made a staple, a permanent model.

If there is a moral to this story, it is to act when you have the opportunity. Like everything else in this world, opportunities are by nature fleeting, and you might not have another one.

In the end our hero was lucky. Living in the internet age, he found a pair of correct size Allrounder Parkers for sale in a far-away land.

May 24th 2015

Yhden projektin epilogi

20:20

Vuoden kestänyt kokeilu on päättymässä. Kun heinäkuun alkupuolella justnyt.fi-domain vanhenee, en näillä näkymin ole sitä uusimassa. Vaikka vastaanotto oli alussa varovaisen innokas, osoittautui se kuitenkin lopulta laimeaksi.

Vaikka olen tietysti harmissani, olinhan itse kovin kiintynyt ajatukseen mikä sai koodikynän viuhumaan, niin en lopulta kuitenkaan koe menettäneeni mitään. Oikeastaan päinvastoin, sillä ryhdyinhän vastoin normaalien toimintatapojeni vastaisesti ajatuksesta tekoihin ja toteutin ideani, sen sijaan, että olisin jättänyt sen haaveilun asteelle.

Kiitos kaikille projektiin osallistuneille. Vielä on aikaa jäädä historiaan justnytin viimeisenä kuraattorina.

May 4th 2015

URLs Need Due Diligence

11:25

Considering how central the URL (Uniform Resource Locator) is to the World Wide Web, it should really be blatantly obvious that it needs proper attention during the design process of any new website. It’s not always easy, and I for one have certainly at times been guilty of poor URL design, but making changes later can be a tall mountain to climb.

bq.. URL Design is a complex subject. I can’t say there are any “right” solutions — it’s much like the rest of design. There’s good URL design, there’s bad URL design, and there’s everything in between — it’s subjective.

URL Design

What I especially liked in the article is the notion that URLs are for humans. SEO is useful, not the least because it employs a whole industry, but really the human you’re trying to attract to your website should always be at the centre. But all other things aside, the absolute most important attribute about a URL, is and always has been is that it works, and that it keeps on working.

bq.. What makes a cool URI?
A cool URI is one which does not change.
What sorts of URI change?
URIs don’t change: people change them.

Cool URIs don’t change

Having revisited older posts in this blog, it’s unfortunate to see so many dead external links. Luckily there are projects like the Internet Archive that make internet archaeology possible.

So do the internet a favour: keep your URLs alive, and donate to the Internet Archive project to mitigate the consequences of dying URLs.

Apr 24th 2015

Suru laskeutui Blogilistan kotikadulle …taas

22:13

Vuosia kestäneen suhteen päivät on nyt luetut. Nimittäin Blogilista tiedotti tänään pistävänsä pillit pussiin kesäkuun alusta.

Lienen viimeisiä Blogilistaa aktiivisesti vielä käyttäviä. En osaa varsinaisesti sanoa miksi edelleen listaa käytän, mutta uskollisesti palaan suosikkilistaani katsomaan lähes päivittän.

Lopetuksen syistä ei ole julkisuudessa puhuttu. En voi uskoa että käyttökustannukset ovat niin suuret, että palvelu sen takia ajettaisiin alas. Viime aikoina palvelu on tosin kärsinyt jonkinasteisesta spam-ongelmasta uusien blogien listassa, joten kenties kehitystarpeet ja niiden kustannukset painoivat vaakakupin armokuoleman puolelle.

Itse käytin Blogilistaa jo silloin kun se vielä tunnettiin nimellä Päivän Pamaus, tämäkin blogi on listalta löytynyt vuodesta 2006. Sami kertaa hieman historiaa postauksessaan Blogilistalla uusi omistaja.

Blogilistalla on vaiheikas historia. Se sai alkunsa “Päivän Pamaus” nimellä Pinserin sivupalkista vähän Pinserin syntymisen jälkeen vuonna 2002. Aluksi Riitan ja minun tarkoituksena oli kerätä itseämme varten muistilistaa suomalaisista blogeista, mutta lista laajeni nopeasti niin isoksi, että aloin rakennella sen ympärille erilaisia aputoimintoja. Suosikeiksi merkitseminen ja päivitystarkistukset helpottivat blogien seuraamista ja vähän kerrassaan monet muutkin bloggaajat alkoivat käyttää listaa.

Kiinnostuneena Blogilistaa ja sen kehittymistä on käsitelty tässäkin blogissa usean postauksen verran.

Blogistanian kultakaudella Blogilistan “kilpailijoita” tuli ja meni. Nyt yksikään niistä (mitä blogini arkistoista löysin) ei ole enää hengissä. Myös oma JustNyt!-viritykseni tehnee laimeahkon vastaanoton takia dodolle seuraa sekin, kun seuraavan kerran täytyy kaivaa kuvetta.

Kovasti kiitos kuluneista vuosista, toivottavasti joku täyttää suomalaiseen blogiskeneen syntyvän aukon.

Kuvakaappaus tämän blogin tiedoista Blogilistalla 24.4.2015

Leikekirjaani otin tänään kuvakaappauksen blogini lisätietosivusta. Se ehtii päivittyä vielä yhden kerran.

Shorts

Mar 5th 2015

Sujuvampaa kirjautumista mobiilissa

12:15

PA bloggaa mobiilisovelluksien sisäänkirjautumispoluista: Älä kompastu kynnykseen – 30 vinkkiä mobiilin sisäänkirjautumispolun suunnitteluun.

Vaikka juttu onkin suuntautunut natiiveihin sovelluksiin, on lähes kaikki käyttötapaukset sovellettavissa myös verkossa.

Feb 21st 2015

Host aliases and tab completion for SSH

13:02

Despite being a relentless tinkerer, for some bizarre reason instead of using the proper mechanics I’ve resorted to aliases for hosts I log in to frequently. Thankfully, the mental strain of remembering all the hosts I log in to finally forced me to sit down for 2 minutes and add the host + username combinations into my ssh-config. (Procrastination is such a beautiful word!)

<code>Host freq
HostName some.long.hostname.that.i.need.frequently.com
User mysysadminassignedmethis</code>

Configuration blocks like the example above shorten the full command to ssh freq from ssh mysysadminassignedmethis@some.long.hostname.that.i.need.frequently.com. Quite an improvement, I’m sure you’ll agree.

However, since I did a proper job, naming things in a logical and consistent manner using patterns such as servicename-stg for the staging environment and servicename-prod for the corresponding live host, there was still quite a lot of typing to do. If you saw my post about tab completion for project folders you can probably guess where this is going.

As I now have all the relevant information in ~/.ssh/config it’s very easy to parse out a helpful wordlist to create ssh tab completion. I have it and now you can have it, too.

Download ssh-complete.bash, source it from your ~/.bashrc and simply TAB away.

There are plenty of other useful things you can set in your ssh-config. See its man page for further information.

Meta

Pages

Search blog

Latest comments