<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title>Andeers.com</title>
	<subtitle>I mainly write about web development and tech.</subtitle>
	<link href="https://andeers.com/feed/feed.xml" rel="self"/>
	<link href="https://andeers.com/"/>
	<updated>2025-02-22T23:01:00Z</updated>
	<id>https://andeers.com/</id>
	<author>
		<name>Anders Grendstadbakk</name>
		<email>anders.2205@gmail.com</email>
	</author>
	
	<entry>
		<title>DDEV</title>
		<link href="https://andeers.com/2025/ddev/"/>
		<updated>2025-02-22T23:01:00Z</updated>
		<id>https://andeers.com/2025/ddev/</id>
		<content type="html">&lt;p&gt;I&#39;ve been working with Drupal for about 12 years now and I&#39;ve tried a lot of tools for local development: Vagrant, Mamp, Xampp, Docker and installing everything directly on my Mac.&lt;/p&gt;
&lt;p&gt;All of these solutions worked, but they also had problems. The setup I liked the most was installing PHP, MySQL directly on my mac and set up a local domain with dnsmasq. This setup worked great for me but one big issue was that over time you work with a lot of different clients that all have different web servers, versions of stuff and requirements. My local setup required me to change the PHP version on my mac everytime I needed to test something specific (and change back when I was done). Figuring out bugs happening on a specific web server or database version was even more problematic.&lt;/p&gt;
&lt;h2&gt;Enter DDEV&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://ddev.readthedocs.io/en/stable/&quot;&gt;DDEV&lt;/a&gt; is docker based, and I was quite skeptical in the beginning because of my earlier attempts at docker based development. Slow websites, much config and work to get the docker files to work as I wanted.&lt;/p&gt;
&lt;p&gt;With DDEV all of the Docker stuff is abstracted away and for regular projects you only touch a single file &lt;code&gt;config.yaml&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It can look like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# .ddev/config.yaml
name: example
type: drupal9
docroot: web
php_version: &amp;quot;8.3&amp;quot;
webserver_type: nginx-fpm
router_http_port: &amp;quot;80&amp;quot;
router_https_port: &amp;quot;443&amp;quot;
xdebug_enabled: false
additional_hostnames: []
additional_fqdns: []
database:
    type: mariadb
    version: &amp;quot;10.4&amp;quot;
nfs_mount_enabled: false
mutagen_enabled: true
use_dns_when_possible: true
composer_version: &amp;quot;2&amp;quot;
web_environment: []
nodejs_version: &amp;quot;16&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With this file in your project all you need to do is type &lt;code&gt;ddev start&lt;/code&gt; to have a website running at &lt;strong&gt;example.ddev.site&lt;/strong&gt;. If you need to switch to apache or use a different PHP version, edit the config and type &lt;code&gt;ddev restart&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Many possibilities&lt;/h2&gt;
&lt;p&gt;DDEV works without configuring anything more than the above. But it can do so much more. You can specifiy custom docker images, add multiple hostnames and enable addons. There are addons for elasticsearch, varnish, mongodb++.&lt;/p&gt;
&lt;h2&gt;Good framework support&lt;/h2&gt;
&lt;p&gt;DDEV has a generic PHP project template so it could work with all kinds of PHP based projects. But it also comes with &lt;a href=&quot;https://ddev.readthedocs.io/en/stable/users/quickstart/&quot; title=&quot;CMS Quickstart&quot;&gt;support for many popular frameworks&lt;/a&gt; like Drupal, WordPress, Statamic and more.&lt;/p&gt;
&lt;h2&gt;Installing DDEV&lt;/h2&gt;
&lt;p&gt;DDEV has very &lt;a href=&quot;https://ddev.readthedocs.io/en/stable/users/install/ddev-installation/&quot;&gt;good documentation&lt;/a&gt; for many environments.&lt;/p&gt;
&lt;p&gt;On a mac you can install it with brew like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Install DDEV
brew install ddev/ddev/ddev

# One-time initialization of mkcert
mkcert -install
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Bottom line&lt;/h2&gt;
&lt;p&gt;DDEV has made it so easy to work with multiple PHP-versions, packages, web servers and setups without having to juggle versions and install everything locally.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Can Prettier be used with Drupal?</title>
		<link href="https://andeers.com/2023/can-prettier-be-used-with-drupal/"/>
		<updated>2023-04-19T00:00:00Z</updated>
		<id>https://andeers.com/2023/can-prettier-be-used-with-drupal/</id>
		<content type="html">&lt;p&gt;Prettier is a fantastic tool for JavaScript developers, and after reading about its PHP plugin, I decided to give it a try. Since I primarily work with Drupal, I was curious to see how well Prettier would work with it.&lt;/p&gt;
&lt;h2&gt;Setting up Prettier for PHP&lt;/h2&gt;
&lt;p&gt;To get started, I created a package.json file in the root of my Drupal project and installed Prettier:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;npm init --yes
npm install --save-dev prettier @prettier/plugin-php
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The Prettier PHP plugin comes with &lt;a href=&quot;https://github.com/prettier/plugin-php#configuration&quot;&gt;several options&lt;/a&gt; that can be configured in a &lt;code&gt;.prettierrc.json&lt;/code&gt; file.
To make it format code according to Drupal Coding Standards, I set the following options:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;phpVersion&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;8.1&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;tabWidth&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;braceStyle&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1tbs&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;singleQuote&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Prettier&#39;s PHP plugin has &lt;a href=&quot;https://github.com/prettier/plugin-php#configuration&quot;&gt;excellent documentation&lt;/a&gt;  for configuring it in various editors and IDEs.&lt;/p&gt;
&lt;h2&gt;Can it be used with Drupal?&lt;/h2&gt;
&lt;p&gt;The short answer is &lt;strong&gt;no&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The longer answer is that there are some Coding Standards rules that can&#39;t be configured according to Drupal:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;TRUE, FALSE and NULL must be uppercase, not going to happen according to &lt;a href=&quot;https://github.com/prettier/plugin-php/issues/1555&quot;&gt;this issue&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Prettier wraps lines longer than the &lt;code&gt;printWidth&lt;/code&gt; in a way that makes Drupal CS complain on some array elements.&lt;/li&gt;
&lt;li&gt;Drupal requires an empty line before the closing bracket of a class, which Prettier removes.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;While there may be other issues, these are the ones I encountered during my testing. It&#39;s a shame, because the &amp;quot;format on save&amp;quot; feature is so nice.&lt;/p&gt;
&lt;p&gt;I think it can be a good fit for other PHP projects who follow the PSR-12 standard.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>This is not a redesign, it&#39;s the beginning of one</title>
		<link href="https://andeers.com/2023/this-is-not-a-redesign-it-s-the-beginning-of-one/"/>
		<updated>2023-01-31T00:00:00Z</updated>
		<id>https://andeers.com/2023/this-is-not-a-redesign-it-s-the-beginning-of-one/</id>
		<content type="html">&lt;p&gt;In the past all my redesigns have been a process of working hard for a while on a redesign, getting tired, and publishing it. Then I would not do anything about it until the urge for a redesign appeared again.&lt;/p&gt;
&lt;p&gt;This is not a good approach I think, the process should be more continuous. A nice thing about websites is that it&#39;s easy to make adjustments. So this time my plan is to make it a longer process with iterations and adjustments from time to time.&lt;/p&gt;
&lt;p&gt;I&#39;m hoping this will make everything more motivating to me and let my website evolve into something I really like.&lt;/p&gt;
&lt;p&gt;After all it is a personal website and not some super important website built for a client. Personal websites should be a place to show who you are, experiment with technologies and do whatever you want.&lt;/p&gt;
&lt;p&gt;I hope to release the beginning of my redesign very soon, and then make adjustments and improve it from time to time.&lt;/p&gt;
&lt;p&gt;So to quote Ted (yeah, I like How I Met Your Mother): &amp;quot;Make, Adjustments, Go, Get, It, Energized&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://andeers.com/img/0mUGtNuUT6-800.webp 800w&quot; /&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://andeers.com/img/0mUGtNuUT6-800.avif 800w&quot; /&gt;&lt;img alt=&quot;Ted Mosby from How I Met Your Mother writing Maggie on a blackboard&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;800&quot; src=&quot;https://andeers.com/img/0mUGtNuUT6-800.jpeg&quot; height=&quot;486&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Simple drush with and without ddev</title>
		<link href="https://andeers.com/2023/simple-drush-with-and-without-ddev/"/>
		<updated>2023-01-27T00:00:00Z</updated>
		<id>https://andeers.com/2023/simple-drush-with-and-without-ddev/</id>
		<content type="html">&lt;p&gt;I&#39;ve recently started using DDEV for local Drupal development, it&#39;s very nice but the old way of using drush is very stuck in my muscle memory.&lt;/p&gt;
&lt;p&gt;I decided too see if I could find a way to get the best of both worlds.&lt;/p&gt;
&lt;p&gt;DDEV provides a cli that allows you to interact with the docker container, and also check the status of it (with json!). The command &lt;code&gt;ddev status&lt;/code&gt; gives you information about the project you are in at the moment in your terminal.&lt;/p&gt;
&lt;p&gt;So it should be possible to write a bash script/function that runs that command and checks if we are in a DDEV environment or not. Based on that we could either run the regular drush command or the ddev drush command.&lt;/p&gt;
&lt;p&gt;It turned out parsing JSON is not that easy in bash, so I had to resort to a external dependency JQ. Installed with &lt;code&gt;brew require jq&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It allows me to pipe the JSON output of the ddev command and extract the single property (status) that I&#39;m after.&lt;/p&gt;
&lt;h2&gt;The solution&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;% function drush2 () {
  ddev_running=$(ddev st --json-output | jq -r &#39;.raw.status&#39;)

  if [[ $ddev_running == &amp;quot;running&amp;quot; ]] then 
    ddev drush $@ 
  else 
    drush $@ 
  fi 
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is a ZSH function that I put in &lt;code&gt;~/.oh-my-zsh/custom/functions.zsh&lt;/code&gt;. After restarting the terminal I get a new command &lt;code&gt;drush2&lt;/code&gt; that works with regular drush and ddev drush.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>2022</title>
		<link href="https://andeers.com/2023/2022/"/>
		<updated>2023-01-05T00:00:00Z</updated>
		<id>https://andeers.com/2023/2022/</id>
		<content type="html">&lt;p&gt;2022 has come to an end. It feels like the year went by in a blink. My daughter turned two at the start of the year, work has had exiting challenges. This website though, has been left untouched.&lt;/p&gt;
&lt;h2&gt;Work&lt;/h2&gt;
&lt;p&gt;I&#39;ve spent a lot of time this year making Drupal run in Kubernetes, since our hosting provider wanted to move us to the &amp;quot;cloud&amp;quot;. It&#39;s been a steep learning curve and kind of outsite of what I usually do, but a fun experience nonetheless.&lt;/p&gt;
&lt;p&gt;My colleagues and I went to Prague for Drupal Con Europe in october, which was my first conference since 2019.&lt;/p&gt;
&lt;p&gt;I&#39;ve also worked with e-commerce in Drupal and made som cli tools with Node.js.&lt;/p&gt;
&lt;h2&gt;Personal life&lt;/h2&gt;
&lt;p&gt;My daughter turned 2 years in January and is a big part of the non-work time. It&#39;s so exciting to see her grow and learn new things. I&#39;ve been able to read a few books which is nice.&lt;/p&gt;
&lt;p&gt;I startet jogging in November, doing a run or two per week. Feels good to be active so that&#39;s something I would like to continue doing.&lt;/p&gt;
&lt;h2&gt;Other stuff&lt;/h2&gt;
&lt;p&gt;My website has not been the most active place this year, I haven&#39;t had the time/motivation to neither write or work on it. And that has been ok. With a full time job and a family side projects has not been a priority.&lt;/p&gt;
&lt;p&gt;With all the crazyness going on at Twitter I made the move to Mastodon in November. After the initial finding-a-nice-server struggle the experience so far has been really nice. I like my social media non-algorithmic. On twitter I always was quite passive, but on Mastodon I feel more motivated to actually participate and share stuff.&lt;/p&gt;
&lt;p&gt;I ended the year closing 3 windows and &lt;strong&gt;loads&lt;/strong&gt; of tabs on my computer, subscribing to RSS feeds where possible. Removing clutter feels really good and makes it easier to focus.&lt;/p&gt;
&lt;h2&gt;Plans for 2023&lt;/h2&gt;
&lt;p&gt;I hope to make a habit of jogging and becoming more active. Keep doing non-web activites with my family and keep a good work-life balance.&lt;/p&gt;
&lt;p&gt;Not doing so much side-stuff and starting to use Mastodon has given me some motivation to write more and make this website &lt;strong&gt;my&lt;/strong&gt; home on the internet. Another thing I want to do is to find a better way of writing and managing content. Right now I have drafts in notion and do my formatting/publishing in VS Code. I&#39;m considering using some kind of CMS as a backend and keep my site static. But time will show.&lt;/p&gt;
&lt;p&gt;To summarize my plans:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;10 blog posts this year (at least more than 2022)&lt;/li&gt;
&lt;li&gt;Update this website&lt;/li&gt;
&lt;li&gt;Continue jogging&lt;/li&gt;
&lt;/ul&gt;
</content>
	</entry>
	
	<entry>
		<title>Create-react-app in Drupal</title>
		<link href="https://andeers.com/2022/create-react-drupal/"/>
		<updated>2022-02-08T00:00:00Z</updated>
		<id>https://andeers.com/2022/create-react-drupal/</id>
		<content type="html">&lt;p&gt;&lt;a href=&quot;https://create-react-app.dev/&quot; title=&quot;Create React App website&quot;&gt;Create-react-app&lt;/a&gt; (CRA) is nice to start a react project without messing with webpack and react setup. But CRA generates JS and CSS files with a hash
in the name which makes it hard to include them in a Drupal library.&lt;/p&gt;
&lt;p&gt;A libraries.yml entry looks like this:&lt;/p&gt;
&lt;pre class=&quot;language-yml&quot;&gt;&lt;code class=&quot;language-yml&quot;&gt;&lt;span class=&quot;token key atrule&quot;&gt;module_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token key atrule&quot;&gt;js&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;br /&gt;    &lt;span class=&quot;token key atrule&quot;&gt;js/script.js&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token key atrule&quot;&gt;css&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token key atrule&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token key atrule&quot;&gt;css/style.css&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To make it work with CRA we would have to update the file path each time we rebuild.&lt;/p&gt;
&lt;h2&gt;Hooks and a manifest to the rescue&lt;/h2&gt;
&lt;p&gt;To automate it we can use a file generated by CRA and a Drupal hook. But first we define the library with empty
CSS and JS objects, We&#39;ll add the files from CRA later.&lt;/p&gt;
&lt;pre class=&quot;language-yml&quot;&gt;&lt;code class=&quot;language-yml&quot;&gt;&lt;span class=&quot;token key atrule&quot;&gt;module_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token key atrule&quot;&gt;js&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token key atrule&quot;&gt;css&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token key atrule&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Luckily for us, CRA generates a asset-manifest.json file that is generated on build and looks like this:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;files&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;main.css&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./static/css/main.e5894e93.css&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;main.js&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./static/js/main.1c36d7cb.js&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;index.html&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./index.html&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;main.e5894e93.css.map&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./static/css/main.e5894e93.css.map&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;main.1c36d7cb.js.map&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./static/js/main.1c36d7cb.js.map&quot;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;entrypoints&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token string&quot;&gt;&quot;static/css/main.e5894e93.css&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token string&quot;&gt;&quot;static/js/main.1c36d7cb.js&quot;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Combining this file with the Drupal hook &lt;code&gt;hook_library_info_alter()&lt;/code&gt; we can update the library definition when rebuilding
the Drupal cache:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function-definition function&quot;&gt;module_name_library_info_alter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$libraries&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$extension&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;// The library name as defined in libraries.yml&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token variable&quot;&gt;$library_name&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;module_name&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$libraries&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$library_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;// Get the path to the module.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token variable&quot;&gt;$pathResolver&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token class-name class-name-fully-qualified static-context&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Drupal&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;service&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;extension.path.resolver&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token variable&quot;&gt;$path&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$pathResolver&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getPath&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;module&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$library_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;// Load the manifest file and decode it.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token variable&quot;&gt;$manifest&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;json_decode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;file_get_contents&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$path&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;/client/build/asset-manifest.json&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;TRUE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;// Relative path to the build directory of CRA.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token variable&quot;&gt;$cra_build_path&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;client/build/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;// Loop through the manifest and build the library definition.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$manifest&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;files&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$key&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$realpath&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$key&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;strlen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;css&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;css&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token variable&quot;&gt;$libraries&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$library_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;css&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;component&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$cra_build_path&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;ltrim&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$realpath&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;&#92;.&#92;/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$key&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;strlen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token variable&quot;&gt;$libraries&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$library_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$cra_build_path&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;ltrim&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$realpath&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;&#92;.&#92;/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The code loads the asset-manifest, loops through each of the files and adds the files that passes the check to the
library. We check for CSS and JS files since we don&#39;t want the &lt;code&gt;index.html&lt;/code&gt; file and the map-files.&lt;/p&gt;
&lt;p&gt;Now, we can clear the cache and the current CSS/JS files will be added to the library.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>2021 in review</title>
		<link href="https://andeers.com/2022/2021-in-review/"/>
		<updated>2022-01-13T00:00:00Z</updated>
		<id>https://andeers.com/2022/2021-in-review/</id>
		<content type="html">&lt;p&gt;Another year has passed, for me it&#39;s been a year of parental leave and Drupal. With a kid there hasn&#39;t been that much time for hobby projects, but I have learned a lot and expanded my knowledge of Drupal&lt;/p&gt;
&lt;p&gt;Some stuff that happened:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Started the year with parental leave 👏&lt;/li&gt;
&lt;li&gt;Started on a Unity course (refreshing to try something new and different)&lt;/li&gt;
&lt;li&gt;Had a nice summer vacation hiking in the mountains&lt;/li&gt;
&lt;li&gt;Amalie started kindergarten 😊&lt;/li&gt;
&lt;li&gt;Held a presentation about Drupal in an internal work conference 😃&lt;/li&gt;
&lt;li&gt;Wrote only two blog posts 😕&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Plans for the next year&lt;/h2&gt;
&lt;p&gt;When christmas comes I always get motivated to work on this website. I haven&#39;t gotten to it yet, but some things I want do is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Update the styling (get better at design tokens, font scales and such)&lt;/li&gt;
&lt;li&gt;Set up NetlifyCMS or something similar to separate blogging and coding&lt;/li&gt;
&lt;li&gt;Blog more (always a goal)&lt;/li&gt;
&lt;li&gt;Improve the design (&lt;em&gt;never get satisfied am I right?&lt;/em&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Workwise I want to continue working with &lt;strong&gt;Drupal&lt;/strong&gt;, expand my knowledge and test out different ways of using it. I have also decided
that I want to learn Typescript and figure out why &lt;strong&gt;everybody&lt;/strong&gt; is talking about it.&lt;/p&gt;
&lt;p&gt;The most important thing for the next year is to have a healthy work/life balance.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Permissions API</title>
		<link href="https://andeers.com/2022/permissions-api/"/>
		<updated>2022-01-06T00:00:00Z</updated>
		<id>https://andeers.com/2022/permissions-api/</id>
		<content type="html">&lt;p&gt;Today I learned about a new browser api called &lt;strong&gt;Permissions API&lt;/strong&gt;. It&#39;s a new API that allow you to check the current state
of different API permissions such as Geolocation.&lt;/p&gt;
&lt;p&gt;It can look like this:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;permissions&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;geolocation&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;The current state of geolocation permissions are:&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; result&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;state&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;// result.state can be &quot;granted&quot;, &quot;prompt&quot; or &quot;denied&quot;.&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Use cases?&lt;/h2&gt;
&lt;p&gt;I came across it when looking for a way to check the status of geolocation before prompting the user to allow it. If you know the user has approved it
you can show a map or load some locations when the page loads without bothering the user.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;It&#39;s a experimental API so it&#39;s not the safest to use in production. It&#39;s supported in most major browsers execpt Safari, and you can &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Navigator/permissions&quot; title=&quot;The permissions API on mdn&quot;&gt;read more about it here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>How to disable FLoC on Netlify</title>
		<link href="https://andeers.com/2021/06/disable-floc/"/>
		<updated>2021-06-01T00:00:00Z</updated>
		<id>https://andeers.com/2021/06/disable-floc/</id>
		<content type="html">&lt;p&gt;FLoC is Googles next attempt at tracking people online. You can read more about it in this &lt;a href=&quot;https://adactio.com/journal/18046&quot; title=&quot;Get the FLoC out &quot;&gt;nice article&lt;/a&gt; by Adactio.&lt;/p&gt;
&lt;p&gt;Both &lt;a href=&quot;https://make.wordpress.org/core/2021/04/18/proposal-treat-floc-as-a-security-concern/&quot; title=&quot;Proposal: Treat FLoC like a security concern&quot;&gt;WordPress&lt;/a&gt; and &lt;a href=&quot;https://www.drupal.org/project/drupal/issues/3209628&quot; title=&quot;Add Permissions-Policy header to block Google FLoC&quot;&gt;Drupal&lt;/a&gt; are discussing if they should disable it by default.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;In the meantime, if you’re a website owner, you have to opt your website out of the origin trial.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Do opt out of it on Netlify all you have to do is add some lines to your &lt;code&gt;netlify.toml&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[[headers]]
    for = &amp;quot;/*&amp;quot;
    [headers.values]
        Permissions-Policy = &amp;quot;interest-cohort=()&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will add a header to your website that will tell Google Chrome that your website don&#39;t want to participate. It may not be necessary, but it&#39;s an easy fix.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>10 years!</title>
		<link href="https://andeers.com/2021/04/10-years/"/>
		<updated>2021-04-25T00:00:00Z</updated>
		<id>https://andeers.com/2021/04/10-years/</id>
		<content type="html">&lt;p&gt;This website is 10 years old! My first blog post was posted on the 18th of March 2011, as a part of a college course about social media.&lt;/p&gt;
&lt;p&gt;There have been multiple changes since then:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Switching from Norwegian to English&lt;/li&gt;
&lt;li&gt;Writing about web development&lt;/li&gt;
&lt;li&gt;Removing Google Analytics in favor of Netlify Analytics&lt;/li&gt;
&lt;li&gt;Many design attempts and iterations&lt;/li&gt;
&lt;li&gt;Tech stack&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My website has always been a place for me to test things, so it&#39;s gone through some changes over the years.&lt;/p&gt;
&lt;p&gt;It started with WordPress (self hosted), moved to Jekyll (on Github Pages), and finally moved to Eleventy (on Netlify).&lt;/p&gt;
&lt;p&gt;So far I&#39;ve been really happy with Eleventy and see no reason to switch.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Quicktip: Github profile readme</title>
		<link href="https://andeers.com/2020/08/quicktip-github-profile/"/>
		<updated>2020-08-31T00:00:00Z</updated>
		<id>https://andeers.com/2020/08/quicktip-github-profile/</id>
		<content type="html">&lt;p&gt;To make your Github profile page more interesting you can now create a readme file that will be displayed at the top of your profile.&lt;/p&gt;
&lt;p&gt;This &amp;quot;feature&amp;quot; is kind of hidden, but it&#39;s straight forward to enable it. You just have to create a new repository with the same name
as your username. For example my username is &lt;code&gt;andeersg&lt;/code&gt;, so I created a repository called &lt;code&gt;andeersg&lt;/code&gt; with a &lt;code&gt;README.md&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now I have a new section on my profile with the content of that &lt;code&gt;README.md&lt;/code&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Setting up Nginx with PHP</title>
		<link href="https://andeers.com/2020/06/setup-nginx-php/"/>
		<updated>2020-06-26T00:00:00Z</updated>
		<id>https://andeers.com/2020/06/setup-nginx-php/</id>
		<content type="html">&lt;p&gt;I&#39;m not a server guy, but from time to time I have to setup a website for testing or development. Here are my steps for setting up nginx with PHP.&lt;/p&gt;
&lt;h2&gt;Installing nginx&lt;/h2&gt;
&lt;p&gt;Installing nginx is straight forward:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt&lt;/span&gt; update&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; nginx&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next is to verify that the firewall accepts nginx.&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; ufw status&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If &amp;quot;Nginx HTTP&amp;quot;, &amp;quot;Nginx HTTPS&amp;quot;, or &amp;quot;Nginx Full&amp;quot; is not listed you have to add the ones you need (Full is https and http).&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; ufw allow &lt;span class=&quot;token string&quot;&gt;&#39;Nginx HTTP&#39;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Installing PHP&lt;/h2&gt;
&lt;p&gt;Using PHP with nginx requires PHP-FPM. If using Ubuntu 18, the repository must be added.&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; update&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-y&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; software-properties-common&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; add-apt-repository ppa:ondrej/php&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; update&lt;/code&gt;&lt;/pre&gt;
</content>
	</entry>
	
	<entry>
		<title>How to update to Drupal 9</title>
		<link href="https://andeers.com/2020/06/update-drupal9/"/>
		<updated>2020-06-06T00:00:00Z</updated>
		<id>https://andeers.com/2020/06/update-drupal9/</id>
		<content type="html">&lt;p&gt;&lt;a href=&quot;https://www.drupal.org/project/drupal/&quot; title=&quot;Drupal 9 on drupal.org&quot;&gt;Drupal 9&lt;/a&gt; was launched this week. So if your modules are ready it&#39;s time to update.&lt;/p&gt;
&lt;p&gt;Updating betweeen major versions can be tricky, sometimes Composer won&#39;t update a package because another package have a common dependency, but with another version.
And sometimes the conflicting package is the one you try to update.&lt;/p&gt;
&lt;p&gt;That happened to me when I tried to update &lt;code&gt;drupal/core&lt;/code&gt; from &lt;strong&gt;8.8.6&lt;/strong&gt; to &lt;strong&gt;9.0.0&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Drupal 9 required a version of a package that was not compatible with Drupal 8, and that stopped Composer from updating.&lt;/p&gt;
&lt;h2&gt;Are you ready?&lt;/h2&gt;
&lt;p&gt;I recommend using the &lt;a href=&quot;https://www.drupal.org/project/upgrade_status&quot; title=&quot;Upgrade Status on drupal.org&quot;&gt;Upgrade Status&lt;/a&gt; module to check if your site is ready for Drupal 9. It can scan both custom modules and contributed moduls for problems.&lt;/p&gt;
&lt;p&gt;Be aware that unsupported modules won&#39;t stop composer from updating, so you could crash your site by updating if some of your code is not compatible.&lt;/p&gt;
&lt;h2&gt;My solution&lt;/h2&gt;
&lt;p&gt;Here are the steps I did to update. My project was made from &lt;a href=&quot;https://github.com/drupal-composer/drupal-project/&quot; title=&quot;drupal-project on github.com&quot;&gt;Drupal Project&lt;/a&gt; and contained &lt;code&gt;drupal/core&lt;/code&gt;, &lt;code&gt;drupal/core-dev&lt;/code&gt; and &lt;code&gt;drupal/core-composer-scaffold&lt;/code&gt;, all with &lt;code&gt;^8.8.6&lt;/code&gt; as the version.&lt;/p&gt;
&lt;p&gt;First I updated &lt;code&gt;composer.json&lt;/code&gt; without actually running the updates:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;composer&lt;/span&gt; require drupal/core-recommended:^9.0.0 drupal/core-composer-scaffold:^9.0.0 drupal/core:^9.0.0  --update-with-dependencies --no-update&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;composer&lt;/span&gt; require drupal/core-dev:^9.0.0 &lt;span class=&quot;token parameter variable&quot;&gt;--dev&lt;/span&gt; --update-with-dependencies --no-update&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Since it&#39;s a new major version, &lt;code&gt;composer require&lt;/code&gt; is needed instead of update. The option &lt;code&gt;--update-with-dependecies&lt;/code&gt; makes composer update dependecies of the specified packages. &lt;code&gt;--no-update&lt;/code&gt; prevents Composer from actually updating the packages.&lt;/p&gt;
&lt;p&gt;Then it should be safe to run&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;composer&lt;/span&gt; update&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After this you should remove &lt;code&gt;drupal/core&lt;/code&gt; since &lt;code&gt;drupal/core-recommended&lt;/code&gt; is installed.&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;composer&lt;/span&gt; remove drupal/core&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And that&#39;s it, run database updates and enjoy Drupal 9.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Generate many screenshots for inspiration</title>
		<link href="https://andeers.com/2020/04/inspiration-screenshots/"/>
		<updated>2020-04-22T00:00:00Z</updated>
		<id>https://andeers.com/2020/04/inspiration-screenshots/</id>
		<content type="html"></content>
	</entry>
	
	<entry>
		<title>Drafts and scheduled publishing</title>
		<link href="https://andeers.com/2020/04/draft-scheduled/"/>
		<updated>2020-04-14T00:00:00Z</updated>
		<id>https://andeers.com/2020/04/draft-scheduled/</id>
		<content type="html">&lt;p&gt;A nice feature I had in Jekyll was drafts and the option to schedule publishing of content.&lt;/p&gt;
&lt;p&gt;In Jekyll you placed drafts in a separate folder called &lt;code&gt;_drafts&lt;/code&gt; and when you built the site with the flag &lt;code&gt;--drafts&lt;/code&gt; they where included.&lt;/p&gt;
&lt;p&gt;I have gone a different way in my Eleventy site, and keep the drafts in the same folder (&lt;code&gt;_posts&lt;/code&gt;) as the published content. To mark something as draft I add it to the front matter: &lt;code&gt;draft: true&lt;/code&gt;.
Combined with that I have the following functions in &lt;code&gt;.elevent.js&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;These functions do things based on environment, you can read how to add environment variables to Eleventy in &lt;a href=&quot;https://andeers.com/2019/03/eleventy-essentials/&quot; title=&quot;Eleventy Essentials on Andeers.com&quot;&gt;this other post I wrote&lt;/a&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;drafts&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;eleventyVars&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;development &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; item&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;draft&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;// If not development, and draft is true, skip it.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;// Return everything by default.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This function is used as a array filter callback to skip the drafts if the current environment is not development.&lt;/p&gt;
&lt;h2&gt;Scheduled publishing&lt;/h2&gt;
&lt;p&gt;For scheduling content I do a similar approach, I check the defined date vs the current date, and skip the item in production if it&#39;s in the future.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;future&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;// If item date is before now it&#39;s safe to publish it.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;item&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;date &lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt; now&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;// If it&#39;s in the future we can publish it in development.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;eleventyVars&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;development&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;// In future and not development, skip it.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The scheduling check only works when the site is deployed/built. So I have used ifttt.com to automatically rebuild my website hosted on netlify.com each night.&lt;/p&gt;
&lt;h2&gt;The complete solution&lt;/h2&gt;
&lt;p&gt;I have all of this in a helper function I use to generate the collection.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;getPosts&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;collectionApi&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; globs &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token string&quot;&gt;&#39;./_posts/*&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; now &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;drafts&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;// See function above.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;future&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;// See function above.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; collectionApi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getFilteredByGlob&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;globs&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;item&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;permalink&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;drafts&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;future&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;reverse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It&#39;s important that you add these checks to all collections you output, so your drafts are not published on the archive page or in the rss feed.&lt;/p&gt;
&lt;p&gt;If you want to look at my whole code you can &lt;a href=&quot;https://github.com/andeersg/andeers.com/blob/master/.eleventy.js&quot; title=&quot;Andeers.com on Github&quot;&gt;check it out on Github&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Possible changes&lt;/h2&gt;
&lt;p&gt;If you want to keep the drafts in a separate folder the &lt;code&gt;getPosts&lt;/code&gt; function could be changed to include the drafts folder in the globs-array instead of checking the draft variable. I&#39;m considering doing this my self.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Disable row in Drupal tableselect</title>
		<link href="https://andeers.com/2019/09/drupal-disable-tableselect-row/"/>
		<updated>2019-09-26T00:00:00Z</updated>
		<id>https://andeers.com/2019/09/drupal-disable-tableselect-row/</id>
		<content type="html">&lt;p&gt;When you use the &lt;code&gt;tableselect&lt;/code&gt; element there may be reasons you want to make a row not selectable:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Permissions&lt;/li&gt;
&lt;li&gt;Missing properties on the element&lt;/li&gt;
&lt;li&gt;Or any other reason to not make a row selectable&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I had to do this recently and thought it should be a easy thing to do, since all form elements seems to support the &lt;code&gt;#disabled&lt;/code&gt; property.&lt;/p&gt;
&lt;p&gt;A tableselect element looks something like this:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;table&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#type&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;tableselect&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#multiple&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;FALSE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#header&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;name&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;Name&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;age&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;Age&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#options&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$options&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#empty&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;No items available&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then each entry (in &lt;code&gt;$options&lt;/code&gt;) would look like:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$options&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;anders&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// knowing the key is important for disabling.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;name&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#markup&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;Anders&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;age&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#markup&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You would think the way to disable a row is to just add &lt;code&gt;&#39;#disabled&#39; =&amp;gt; TRUE;&lt;/code&gt; to the option entry, but no, nothing happens.&lt;/p&gt;
&lt;p&gt;To actually disable a row you would need to target the same key outside the &lt;code&gt;#options&lt;/code&gt; array. Like this:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;table&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;anders&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#disabled&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;TRUE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Added directly to tableselect element.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In my opinion this is quite confusing.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Refresh Service Worker</title>
		<link href="https://andeers.com/2019/07/service-worker-refresh/"/>
		<updated>2019-07-21T00:00:00Z</updated>
		<id>https://andeers.com/2019/07/service-worker-refresh/</id>
		<content type="html">&lt;p&gt;Have you ever enabled a service worker and then realised that your updates are not showing because of caching. I have.&lt;/p&gt;
&lt;p&gt;According to &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API&quot; title=&quot;Service Worker API&quot;&gt;MDN&lt;/a&gt; a service worker will update every 24 hour or so or when all pages/instances are closed.&lt;/p&gt;
&lt;p&gt;This can be a problem if you have made recent changes or the website is added to home screen. There could be reasons not to force update the service worker whenever a new one is available, so a better solution is to prompt the user to update (if they want to).&lt;/p&gt;
&lt;h2&gt;How to detect when a new worker is available&lt;/h2&gt;
&lt;p&gt;There are two parts to manage this. The service worker must listen for messages from the browser (client refreshing), and the browser must listen for new service workers.&lt;/p&gt;
&lt;h3&gt;Service worker&lt;/h3&gt;
&lt;p&gt;To listen for messages inside the service worker we need to add an event listener for the message event.&lt;/p&gt;
&lt;p&gt;In my solution I send an object to the service worker with an action property. So when the service worker receives &lt;code&gt;action: &#39;skipWaiting&#39;&lt;/code&gt; it knows to activate the pending worker.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;message&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;action &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;skipWaiting&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    self&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;skipWaiting&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Browser&lt;/h3&gt;
&lt;p&gt;First you need a button to click.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;refresh-worker hidden&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;A new service worker is available, click to reload&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I recommend to hide it with CSS. If JS or service workers are not supported it has no purpose and can stay hidden.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; refreshButton &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.refresh-worker&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; newWorker &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;refreshButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  newWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;postMessage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token literal-property property&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;skipWaiting&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;location&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;reload&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First we need a reference to the button (for click handler) and a variable to put the service worker in when it&#39;s available.&lt;/p&gt;
&lt;p&gt;When the button is clicked we send a message to the worker telling it to skip waiting and activate the new worker. Then we refresh the page.&lt;/p&gt;
&lt;p&gt;Next we must listen for service worker updates so we know when to display the button and prompt the user to update.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Register service worker:&lt;/span&gt;&lt;br /&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;service-worker.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;registration&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt; 		&lt;span class=&quot;token comment&quot;&gt;// Listen for updates:&lt;/span&gt;&lt;br /&gt;    registration&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;updatefound&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;      newWorker &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; registration&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;installing&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;			&lt;span class=&quot;token comment&quot;&gt;// Listen for when the new worker is ready:&lt;/span&gt;&lt;br /&gt;      newWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;statechange&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token keyword&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;newWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;state&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;          &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;installed&#39;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;br /&gt;            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;navigator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;serviceWorker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;controller&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt; 							&lt;span class=&quot;token comment&quot;&gt;// Display button:&lt;/span&gt;&lt;br /&gt;              refreshButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;remove&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;hidden&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;            &lt;span class=&quot;token keyword&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When the worker is ready to be activated we can display the button and inform the user that a new version is available.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Eleventy tip: Markdown template engine</title>
		<link href="https://andeers.com/2019/04/11ty-tip-markdown/"/>
		<updated>2019-04-23T00:00:00Z</updated>
		<id>https://andeers.com/2019/04/11ty-tip-markdown/</id>
		<content type="html">&lt;p&gt;You can use helpers, filters and template logic in your markdown files. And by default the template language for markdown files is &lt;a href=&quot;https://www.11ty.io/docs/config/#default-template-engine-for-markdown-files&quot; title=&quot;Default template engine for markdown files&quot;&gt;liquid&lt;/a&gt;. This can lead to interesting results when you use a different template language that looks the same.&lt;/p&gt;
&lt;p&gt;To fix this and ensure correct results you can define which template engine should be used for markdown files like this (in &lt;code&gt;.eleventy.js&lt;/code&gt;):&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;eleventyConfig&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt; 		&lt;span class=&quot;token literal-property property&quot;&gt;htmlTemplateEngine&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;hbs&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Engine for html files.&lt;/span&gt;&lt;br /&gt; 		&lt;span class=&quot;token literal-property property&quot;&gt;markdownTemplateEngine&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;hbs&#39;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Engine for markdown files.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
</content>
	</entry>
	
	<entry>
		<title>Eleventy Essentials</title>
		<link href="https://andeers.com/2019/03/eleventy-essentials/"/>
		<updated>2019-03-31T00:00:00Z</updated>
		<id>https://andeers.com/2019/03/eleventy-essentials/</id>
		<content type="html">&lt;p&gt;I switched my personal site to &lt;a href=&quot;https://www.11ty.io/&quot; title=&quot;11ty.io&quot;&gt;Eleventy&lt;/a&gt; recently. It&#39;s a very good static site generator.  Here are some tips and tricks I have discovered that are nice to have when you are creating a site.&lt;/p&gt;
&lt;h2&gt;Start using the _data folder&lt;/h2&gt;
&lt;p&gt;If you come from Jekyll you are used to different kinds of variables being available in your templates (&lt;code&gt;site.time&lt;/code&gt;, &lt;code&gt;site.posts&lt;/code&gt;).
Eleventy does not have these by default, but it&#39;s quite easy to add them (and more).&lt;/p&gt;
&lt;p&gt;Each JSON/JS file in the &lt;code&gt;_data&lt;/code&gt; folder will become available under the filename namespace in your templates. So &lt;code&gt;_data/meta.json&lt;/code&gt; becomes available as &lt;code&gt;meta.some_key_inside_file&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;eleventy.js&lt;/h3&gt;
&lt;p&gt;The first file I create contains things related to the engine and environment.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;exports &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token literal-property property&quot;&gt;production&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; process&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;env&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;ELEVENTY_ENV&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;production&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token literal-property property&quot;&gt;development&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; process&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;env&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;ELEVENTY_ENV&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;development&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token literal-property property&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; process&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;env&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;ELEVENTY_ENV&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;development&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token literal-property property&quot;&gt;notReady&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Flag to prevent something from rendering.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token function-variable function&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Simplest example, could use Moment.js to return another format.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This gives me access to information about environment so I can exclude Google Analytics if it&#39;s not production, or print more information in development.&lt;/p&gt;
&lt;h3&gt;metadata.json&lt;/h3&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;title&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Andeers.com&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;description&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Personal site of Anders Grendstadbakk&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;url&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;https://andeers.com/&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;feed&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;subtitle&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;I mainly write about web development and tech.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;filename&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;feed.xml&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;path&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;/feed/feed.xml&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;url&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;https://andeers.com/feed/feed.xml&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;https://andeers.com/&quot;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;author&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;email&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The metadata.json contains information about this site and me. I also have some fields for the RSS feed. It&#39;s nice to collect all this information in one file so when you make changes you have it all together.&lt;/p&gt;
&lt;h2&gt;.eleventy.js&lt;/h2&gt;
&lt;p&gt;This file is where you define collections, filters, and shortcodes.&lt;/p&gt;
&lt;p&gt;A hot tip is that since this is node.js you can &lt;code&gt;require()&lt;/code&gt; your data files here and access the variables. This way you can use content from &lt;code&gt;metadata&lt;/code&gt; in helper functions, or output something different in development.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; eleventyVars &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;./_data/eleventy&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Create a collection based on a folder of files&lt;/h3&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;eleventyConfig&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addCollection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;posts&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;collection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; collection&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getFilteredByGlob&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;./_posts/*&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;reverse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;// Only include items with a permalink.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;item&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;permalink&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This gives you a collection of all items in the &lt;code&gt;_posts&lt;/code&gt; folder.&lt;/p&gt;
&lt;h3&gt;Latest posts&lt;/h3&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;eleventyConfig&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addCollection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;latestPosts&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;collection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; posts &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; collection&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getSortedByDate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;reverse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; items &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; item &lt;span class=&quot;token keyword&quot;&gt;of&lt;/span&gt; posts &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;item&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;inputPath&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;&#92;/_posts&#92;/&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;      items&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; item &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; items&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length &lt;span class=&quot;token operator&quot;&gt;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; items&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This snippet gives you a variable with the 5 latest posts you can use on your front page.&lt;/p&gt;
&lt;h3&gt;Date functions&lt;/h3&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;eleventyConfig&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addFilter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;readableDate&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;dateObj&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; DateTime&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fromJSDate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;dateObj&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toLocaleString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;DateTime&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;DATE_FULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;// Used in Handlebars like this: {{readableDate post.date }}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This function renders the date in a specific way, but it could easily take another argument that specifies format, or use Moment.js in stead of Luxon.&lt;/p&gt;
&lt;h3&gt;Meta functions&lt;/h3&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;eleventyConfig&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addFilter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;pageTitle&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;title &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; title &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;title&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; | &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;metadata&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;title&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; metadata&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;title&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;eleventyConfig&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addFilter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;pageDescription&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;description&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; opt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;content&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; excerpt &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; opt&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;root&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;description &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; description &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; description&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;excerpt &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; excerpt &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; excerpt&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;content &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; content &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;opt&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;root&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;isFront&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;snippetGenerator&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;content&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; metadata&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;description&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I have two functions I use for &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;description&amp;gt;&lt;/code&gt;. The first one renders the page title with the site name appended, and if a page title is not available it just returns the site name.&lt;/p&gt;
&lt;p&gt;The pageDescription check multiple places for a description, first if one was specifically defined, then it tries to generate one from the content of the page. If that does not work it falls back to the generic site description.&lt;/p&gt;
&lt;h2&gt;Other stuff&lt;/h2&gt;
&lt;p&gt;In the root index.html I add a &lt;code&gt;isFront: true&lt;/code&gt; to the front matter, this makes it possible to do conditional stuff when rendering the front page:&lt;/p&gt;
&lt;pre class=&quot;language-handlebars&quot;&gt;&lt;code class=&quot;language-handlebars&quot;&gt;&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;section&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token handlebars language-handlebars&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;{{&lt;/span&gt;&lt;span class=&quot;token block keyword&quot;&gt;#if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;isFront&lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;}}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;This paragraph is only written to the front page.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token handlebars language-handlebars&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;{{&lt;/span&gt;&lt;span class=&quot;token block keyword&quot;&gt;/if&lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;}}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;This paragraph is rendered on all pages.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;section&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Since my website is a work in progress I will probably find other useful snippets to make Eleventy even better, so &lt;a href=&quot;https://github.com/andeersg/andeers.com&quot; title=&quot;Andeers.com on Github&quot;&gt;check this site out on Github&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>The CSS Widows</title>
		<link href="https://andeers.com/2019/01/css-widows/"/>
		<updated>2019-01-14T00:00:00Z</updated>
		<id>https://andeers.com/2019/01/css-widows/</id>
		<content type="html">&lt;p&gt;If you are like me you have probably been annoyed when your editor autocompletes &lt;code&gt;wid&lt;/code&gt; to &lt;code&gt;widows&lt;/code&gt; and you wanted &lt;code&gt;width&lt;/code&gt; or something similar.&lt;/p&gt;
&lt;p&gt;I have always wondered why my editor is not smarter, since this is something I have never used. And I have to admit that up until I started writing this I have thought it said &lt;code&gt;windows&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;But the last time I saw it I had more time and started to wonder. What does it do?&lt;/p&gt;
&lt;h2&gt;What are widows?&lt;/h2&gt;
&lt;p&gt;The word comes from print, and references the last line of a paragraph if ends up on a new page. If on the other hand a paragraph starts at the very bottom of a page (and continues on the next) it&#39;s called a orphan.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The widows CSS property sets the minimum number of lines in a block container that must be shown at the top of a page, region, or column.&lt;br /&gt;
&lt;cite&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/widows&quot;&gt;Widows at developer.mozilla.org&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In CSS this can work on not only print, but also CSS columns.
It works the same way in CSS, you control how much of a block (typically a paragraph) will continue on the next page/column before the whole block follows over.&lt;/p&gt;
&lt;h2&gt;Example&lt;/h2&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/* Apply the widows property to the parent element of paragraphs. */&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token selector&quot;&gt;.paragraphs-container&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;widows&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 2&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And thats everything you need. If the page breaks or the text spans across multiple columns no more than two lines of a paragraph will continue over to the next page/column.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Different front page for logged in users in Drupal 8</title>
		<link href="https://andeers.com/2018/09/different-front-drupal/"/>
		<updated>2018-09-16T00:00:00Z</updated>
		<id>https://andeers.com/2018/09/different-front-drupal/</id>
		<content type="html">&lt;p&gt;Sometimes we have the need to show logged in users something different than the regular visitors. It could be a dashboard for logged in users and a landing page for regular users. Or anything.&lt;/p&gt;
&lt;h2&gt;How to solve it&lt;/h2&gt;
&lt;p&gt;At first I tried using the &lt;a href=&quot;https://www.drupal.org/docs/8/api/configuration-api/configuration-override-system&quot;&gt;configuration override system&lt;/a&gt; to override the front page setting, but this does not work. It looks like that setting cannot be overridden on a per user role basis.&lt;/p&gt;
&lt;p&gt;I thought about checking the current user and if they are logged in redirect to &lt;code&gt;/dashboard&lt;/code&gt;, but redirecting seems unnecessary for this.&lt;/p&gt;
&lt;p&gt;So created a module with a route called &lt;code&gt;/front&lt;/code&gt;, and my own controller with a method that looks something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public function frontpage() {
  $current_user = &#92;Drupal::/currentUser/();

  $output = [
    &#39;#cache&#39; =&amp;gt; [
      &#39;contexts&#39; =&amp;gt; [
        &#39;user.roles&#39;,
      ],
    ],
  ];

  if ($current_user-&amp;gt;isAuthenticated()) {
    $output[] = $this-&amp;gt;userDashboard();
    return $output;
  }
  else {
    $config = &#92;Drupal::/config/(&#39;custom_module.setup&#39;);
    $id = $config-&amp;gt;get(&#39;visitor_front_page&#39;);

    $node = Node::/load/($id);
    if ($node) {
      $output[] = node_view($node);
      return $output;
    }
  }

	return [&#39;#markup&#39; =&amp;gt; &#39;Something went wrong&#39;];
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First I check if the visiting user is logged in, and if they are I return the render array for a dashboard. If they are not logged in I load a node specified in my modules config and return this. If the node is not found I return a simple text.&lt;/p&gt;
&lt;h3&gt;Improvements&lt;/h3&gt;
&lt;p&gt;You could extend the check to do different stuff based on the role or permission of the user. Maybe return better fallback content than in my example.&lt;/p&gt;
&lt;h2&gt;Other solutions?&lt;/h2&gt;
&lt;p&gt;There is a beta version of the &lt;a href=&quot;https://www.drupal.org/project/front&quot;&gt;Front Page module&lt;/a&gt; that seems to provide this functionality, but it does not look ready yet based on the description.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Use DigitalOcean and home computer to update domain IP</title>
		<link href="https://andeers.com/2017/02/dynamic-ip-domain/"/>
		<updated>2017-02-25T00:00:00Z</updated>
		<id>https://andeers.com/2017/02/dynamic-ip-domain/</id>
		<content type="html">&lt;p&gt;Using DigitalOcean(DO)&#39;s API, a domain and a script on your home computer, you can have a subdomain pointing to your home network all the time.&lt;/p&gt;
&lt;p&gt;If you just want the script, here it is (remember to to replace &lt;code&gt;[token]&lt;/code&gt;, &lt;code&gt;[domain]&lt;/code&gt; and &lt;code&gt;[record_id]&lt;/code&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash

PUBLIC_IPV4=$(curl ifconfig.co)

curl -X PUT -H &amp;quot;Content-Type: application/json&amp;quot; -H &amp;quot;Authorization: Bearer [token]&amp;quot; -d &#39;{&amp;quot;data&amp;quot;:&amp;quot;${PUBLIC_IPV4}&amp;quot;}&#39; &amp;quot;https://api.digitalocean.com/v2/domains/[domain]/records/[record_id]&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Put this script with your values somewhere inside your network and call it from time to time and you should be good to go.&lt;/p&gt;
&lt;p&gt;For more details, please read on.&lt;/p&gt;
&lt;h2&gt;Prerequisites&lt;/h2&gt;
&lt;p&gt;To set this up you need the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Configure your domain to use DigitalOcean&#39;s name servers&lt;/li&gt;
&lt;li&gt;Create a A-record for your subdomain and point it to your external IP (&lt;a href=&quot;https://ifconfig.co/&quot; title=&quot;ifconfig.co&quot;&gt;What is my IP?&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Generate a API token in the dashboard at DigitalOcean&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Find the domain record id&lt;/h2&gt;
&lt;p&gt;As far as I&#39;ve seen, is there no way to find the domain record id from the web interface. So the easiest solution is to use their API and the terminal.&lt;/p&gt;
&lt;p&gt;If you execute the following script (with replaced values):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;curl -X GET -H &amp;quot;Content-Type: application/json&amp;quot; -H &amp;quot;Authorization: Bearer [token]&amp;quot; &amp;quot;https://api.digitalocean.com/v2/domains/[domain]/records&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You will get back a JSON object will all entries for your domain. In here you will find the id.&lt;/p&gt;
&lt;h2&gt;Run the script automatically&lt;/h2&gt;
&lt;p&gt;Since you don&#39;t want to run this script manually, we should set up some automation. This differs from OS to OS, but here are some options:&lt;/p&gt;
&lt;h3&gt;Linux&lt;/h3&gt;
&lt;p&gt;If you have a Raspberry Pi or some other computer with a linux OS you can use &lt;a href=&quot;https://www.wikiwand.com/en/Cron&quot; title=&quot;Cron&quot;&gt;cron&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;0 * * * * /path/to/script/update_digital_ocean.sh &amp;gt;/dev/null 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This example will run &lt;code&gt;update_digital_ocean.sh&lt;/code&gt; every hour and not generate any output. You can use this &lt;a href=&quot;http://crontab-generator.org/&quot; title=&quot;Crontab Generator&quot;&gt;generator&lt;/a&gt; to create your script.&lt;/p&gt;
&lt;p&gt;To configure it on your computer type &lt;code&gt;crontab -e&lt;/code&gt; inside your terminal to open the crontab file. Here you can just copy in your line at the end of the file and save.&lt;/p&gt;
&lt;h3&gt;OSX&lt;/h3&gt;
&lt;p&gt;Apple don&#39;t use cron anymore, they use something called &lt;em&gt;launchd&lt;/em&gt;. I&#39;m not that familiar with it, but found this &lt;a href=&quot;http://launched.zerowidth.com/&quot; title=&quot;Launchd Generator&quot;&gt;launchd-generator&lt;/a&gt; you can use to create a launchd.plist file.&lt;/p&gt;
&lt;p&gt;After you generate a file this website also tells you where to place it.&lt;/p&gt;
&lt;h3&gt;Windows&lt;/h3&gt;
&lt;p&gt;For Windows I really don&#39;t know (I&#39;m sorry), but I found &lt;a href=&quot;http://stackoverflow.com/questions/132971/what-is-the-windows-version-of-cron&quot; title=&quot;StackOverflow thread about cron&quot;&gt;this StackOverflow thread&lt;/a&gt; that has an answer which lists a couple of tools for different versions of Windows.&lt;/p&gt;
&lt;h2&gt;Why is this necessary?&lt;/h2&gt;
&lt;p&gt;Most internet providers don&#39;t give you a static IP at home, so your IP address may suddenly change. This will break your domain and you will not be able to connect anymore.&lt;/p&gt;
&lt;p&gt;This script will update the domain with the correct IP every time it&#39;s executed.&lt;/p&gt;
&lt;h2&gt;Remember to configure your router&lt;/h2&gt;
&lt;p&gt;Even if your domain points towards your home, you will have to do some changes to the router configuration to be able to serve websites or connect with SSH.&lt;/p&gt;
&lt;p&gt;If you want to serve a webpage at port 80, you need to port forward external port 80 to the local IP of your computer. The same for every other port you want to use.&lt;/p&gt;
&lt;h2&gt;Ideas for what you can do with it&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Set up &lt;a href=&quot;https://home-assistant.io/&quot; title=&quot;Home-Assistant&quot;&gt;Home-Assistant&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Some torrent clients have a web ui, you could access it from everywhere and manage your downloads&lt;/li&gt;
&lt;li&gt;Enable SSH access to your computer&lt;/li&gt;
&lt;li&gt;Probably you could run a Minecraft (or many other games) server&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Credit should go to &lt;a href=&quot;https://www.digitalocean.com/community/questions/using-the-v2-api-and-my-home-computer-to-automatically-update-a-domain-name-a-record-like-dynamic-dns&quot; title=&quot;DigitalOcean Community&quot;&gt;DigitalOcean community&lt;/a&gt; where I found the script.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Entity API in Drupal 8</title>
		<link href="https://andeers.com/2017/02/entity-api-drupal-8/"/>
		<updated>2017-02-13T00:00:00Z</updated>
		<id>https://andeers.com/2017/02/entity-api-drupal-8/</id>
		<content type="html">&lt;p&gt;A quick walkthrough of the most common entity operations in Drupal 8.&lt;/p&gt;
&lt;h2&gt;Changes from Drupal 7&lt;/h2&gt;
&lt;p&gt;Everything is different from Drupal 7, but if you really want to you can still use &lt;code&gt;[core_entity]_load&lt;/code&gt; and &lt;code&gt;[core_entity]_load_multiple&lt;/code&gt;. You should note that they are marked as deprecated in the code and will be removed (In Drupal 9), so you should just use the new ways right now.&lt;/p&gt;
&lt;h2&gt;Load a node in Drupal 8&lt;/h2&gt;
&lt;p&gt;To load a node in Drupal 8 you have to use the Node class:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Drupal&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;node&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Node&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token variable&quot;&gt;$node&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token class-name static-context&quot;&gt;Node&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;load&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;
A good friend of mine &lt;a href=&quot;http://github.com/zaporylie&quot;&gt;Zaporylie&lt;/a&gt;, told me of a better way of loading nodes (and other entities):&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$entity&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$container&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;entity_type.manager&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getStorage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;entity_type&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;load&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$entity_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Doing it this way makes it easier to extend functionality and override original node class.&lt;/p&gt;
&lt;h3&gt;Working with fields&lt;/h3&gt;
&lt;p&gt;To get values from your node you can either use some of the defined methods:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$node&lt;/span&gt;→&lt;span class=&quot;token function&quot;&gt;getTitle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token variable&quot;&gt;$node&lt;/span&gt;→&lt;span class=&quot;token function&quot;&gt;getOwner&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;// There are a lot more of these methods, and you can inspect the with dpm().&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;dpm&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$node&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;// To see all methods just switch to the &quot;Available methods&quot; tab.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or you can just specify the field name:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$field&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$node&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;field_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Most fields will be an instance of &lt;code&gt;FieldItemList&lt;/code&gt;, but images and attachments for example will be of &lt;code&gt;FileFieldItemList&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;There are multiple ways you can get the field values, in this example the field is a formated text field (with format and value).&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Array of values, if you don&#39;t have multiple values it will be an array with one item.&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token variable&quot;&gt;$value&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$field&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getValue&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;My value is: &quot;&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$value&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;value&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;&quot;, it uses the format: &#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$value&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;format&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;// Or you can fetch a specific value, you specify the index for the value you want.&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;// This will return a field class instance.&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token variable&quot;&gt;$value&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$field&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token variable&quot;&gt;$value&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Text.&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token variable&quot;&gt;$value&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// The format.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Updating and saving entities&lt;/h2&gt;
&lt;p&gt;To update a node you can use the set method of the node class:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$node&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;field_text&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;format&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;full_html&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;value&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;&amp;lt;p&gt;Updated text is better than old text.&amp;lt;/p&gt;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can also update values directly like this:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$node&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;body&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token variable&quot;&gt;$node&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;full_html&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But in my opinion it’s much cleaner to use the set method.&lt;/p&gt;
&lt;p&gt;To actually store your changes you have to call the save method:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$node&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;save&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Creating a new entity&lt;/h2&gt;
&lt;p&gt;To create a new entity you have to use the static method create:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$node&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token class-name static-context&quot;&gt;Node&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;title&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;My programmatically created node is amazing&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;created&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;changed&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;type&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;page&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;langcode&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;en&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;uid&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;body&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;format&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;full_html&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;value&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;&amp;lt;p&gt;Welcome to my node.&amp;lt;/p&gt;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And after creating the node object you have to save it with the save method.&lt;/p&gt;
&lt;h2&gt;Deleting entities&lt;/h2&gt;
&lt;p&gt;Deleting a entity is quite easy. You just need to call the delete method.&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$node&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;What&#39;s next?&lt;/h2&gt;
&lt;p&gt;There is a lot of functions available for the different entities, I really recommend you to look into the entity class file to see what methods are available.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Programming advent calendars</title>
		<link href="https://andeers.com/2016/12/programming-advent-calendars/"/>
		<updated>2016-12-03T00:00:00Z</updated>
		<id>https://andeers.com/2016/12/programming-advent-calendars/</id>
		<content type="html">&lt;p&gt;If you like coding and advent calendars I can really recommend &lt;a href=&quot;http://adventofcode.com/2016&quot;&gt;Advent of Code&lt;/a&gt;. Every day up until Christmas you get access to a new two-part task you have to solve with programming.&lt;/p&gt;
&lt;p&gt;Here is my solution to day 3 if you want to get inspired/see what it can be:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;var fs = require(&#39;fs&#39;);

var triangles = fs.readFileSync(&#39;./input-triangles.txt&#39;, &#39;UTF-8&#39;);
triangles = triangles.split(&amp;quot;&#92;n&amp;quot;);

var possibles = 0;
var possibles2 = 0;

var i = 1;
var cols = [];

triangles.forEach(function(line) {
  line = line.replace(/^-/, &#39;&#39;);
  
  var a = parseInt(line.substr(0, 3).trimLeft());
  var b = parseInt(line.substr(5, 3).trimLeft());
  var c = parseInt(line.substr(10, 3).trimLeft());
  
  if ((a + b &amp;gt; c) &amp;amp;&amp;amp; (a + c &amp;gt; b) &amp;amp;&amp;amp; (b + c &amp;gt; a)) {
    possibles = possibles + 1;
  }

  if (i &amp;lt; 3) {
    cols.push([a, b, c]);
    i++;
  }
  else if (i == 3){
    cols.push([a, b, c]);
    for (var k = 0; k &amp;lt; 3; k++) {

      var aa = parseInt(cols[0][k]);
      var bb = parseInt(cols[1][k]);
      var cc = parseInt(cols[2][k]);
      if ((aa + bb &amp;gt; cc) &amp;amp;&amp;amp; (aa + cc &amp;gt; bb) &amp;amp;&amp;amp; (bb + cc &amp;gt; aa)) {
        possibles2 = possibles2 + 1;
      }
    }
    cols = [];
    i = 1;
  }
});

console.log(possibles);
console.log(possibles2);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I really enjoy these kinds of challenges, because they make me think about solving stuff I normally wouldn’t. And when I try to solve the problems I often come across things I can use later in my regular work.&lt;/p&gt;
&lt;p&gt;So if you have some spare time and enjoy challenges I really recommend programming advent calendars.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>24 days of Christmas</title>
		<link href="https://andeers.com/2016/12/24-days-of-christmas/"/>
		<updated>2016-12-01T00:00:00Z</updated>
		<id>https://andeers.com/2016/12/24-days-of-christmas/</id>
		<content type="html">&lt;p&gt;December is here. Enter the advent calendars and gingerbread cookies.&lt;/p&gt;
&lt;p&gt;This Christmas I have decided to try to write a blog post every day.
I haven’t made any specific plans on what to write about, but it will be related to web development, open source and productivity.&lt;/p&gt;
&lt;p&gt;So to kick it off I want tell you about this small library I made at work. I had to import some documents from a Norwegian service that gives municipalities texts for services they are required to provide on their websites (quite the niche service).&lt;/p&gt;
&lt;p&gt;“Surprisingly”, there was no open source library for this integration available in PHP, so I decided to &lt;a href=&quot;https://github.com/andeersg/php-service-directory&quot; title=&quot;PHP Service Directory&quot;&gt;create one&lt;/a&gt;. I were going to use this integration in a Drupal 8 site, but decided to split out the library since the rest of the project is closed source.&lt;/p&gt;
&lt;p&gt;Drupal 8 has really good composer support, so it’s very easy to include PHP libraries into Drupal. So now I have a composer package on Github that anyone can use, and a Drupal module that uses the library to integrate everything into Drupal.&lt;/p&gt;
&lt;p&gt;Another benefit of separating the API and platform specific code is that multiple platforms can re-use the library. No need to reinvent the wheel and it may be easier for other people to contribute, since developers of Drupal, WordPress and other frameworks may want to use it.&lt;/p&gt;
&lt;p&gt;The best thing about open source is that maybe someone else will have need for what you have made. The library I mentioned earlier is very specific, so maybe nobody will need it. But if a PHP developer is looking for a way to integrate with Norwegian service directory, there is a library for that.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Optimizing websites</title>
		<link href="https://andeers.com/2016/06/optimizing-websites/"/>
		<updated>2016-06-01T00:00:00Z</updated>
		<id>https://andeers.com/2016/06/optimizing-websites/</id>
		<content type="html">&lt;p&gt;I have recently done some optimizations to my blog to improve the loading speed of it, and thought I should write it down, because a faster web-site is a happier web site.&lt;/p&gt;
&lt;p&gt;If you want to take a closer look at the examples in this post you can take a look at my &lt;a href=&quot;https://github.com/andeersg/andeers.com&quot; title=&quot;Andeers.com on Github&quot;&gt;website&#39;s repo on Github.com&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;JavaScript&lt;/h2&gt;
&lt;p&gt;Every website that showcases code samples need some syntax highlighting, but not all pages have code, so loading the syntax highlighting library on all pages is unnecessary.&lt;/p&gt;
&lt;p&gt;To optimize this I found a &lt;a href=&quot;https://davidwalsh.name/javascript-loader&quot; title=&quot;Lazyload script by David Walsh&quot;&gt;simple lazy-load function&lt;/a&gt; created by David Walsh. It allows you to load CSS and JavaScript after the rest of the page has loaded. To only load prism.js when there is code to highlight I have this simple snippet&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;pre&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  load&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;js&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/assets/js/prism.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    Prism&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;highlightAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Fonts&lt;/h2&gt;
&lt;p&gt;If there is one thing page speed test complain about it’s web fonts. So to improve the performance of them I started with an article I found on The Filament Group blog about &lt;a href=&quot;https://www.filamentgroup.com/lab/font-loading.html&quot; title=&quot;Optimizing font performance&quot;&gt;optimizing font performance&lt;/a&gt;. It suggested base64-encoding the font files and place them in separate CSS-files which then are lazy loaded. And that approach worked. If the web font took some time to load it was quite noticeable when the font switched from the fallback to the web font.&lt;/p&gt;
&lt;p&gt;But then I came across this newer article from The Filament Group where they have found a better way by &lt;a href=&quot;https://www.filamentgroup.com/lab/font-events.html&quot; title=&quot;Use font events for loading web fonts&quot;&gt;using font events&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By using this approach you don’t have to base64-encode your font files or do anything else with the fonts. Just define them as usual in &lt;code&gt;@font-face&lt;/code&gt;, and split your &lt;code&gt;font-family&lt;/code&gt; declaration into two blocks, the regular body and one with a special class.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Helvetica Neue&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Helvetica&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; sans-serif&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token selector&quot;&gt;.loaded-fonts body&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Ubuntu&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then you can use a &lt;a href=&quot;https://github.com/bramstein/fontfaceobserver&quot; title=&quot;Bram Stein’s FontFaceObserver script&quot;&gt;FontFaceObserver library&lt;/a&gt; to load the fonts and append the special class to your page. By doing it this way, the class is only appended to the page when the font is ready to use, so there should be no FOIT at all.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;typeof&lt;/span&gt; Promise &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;undefined&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; Promise&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;[native code]&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;localStorage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;webfontsLoaded&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39; loaded-fonts&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;FontFaceObserver&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Ubuntu&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;check&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;        document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;className &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39; loaded-fonts&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    localStorage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;webfontsLoaded &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I choose to use a version of the FontFaceObserver library without a Promise polyfill. So if the visitor does not support Promises they get the fallback. I also store a variable in localStorage when the web font have been loaded, so the next page load we just use the web font immediately.&lt;/p&gt;
&lt;h2&gt;Inline scripts&lt;/h2&gt;
&lt;p&gt;Since I don’t have that much JavaScript I didn’t want to have an extra JS-file. So all my JS is inline, and then I had the problem that if I had my Javascript un-minified it was not as optimized as possible, and if I minified it, it was not that easy to work with.&lt;/p&gt;
&lt;p&gt;Since I use a static site generator it’s more limited what can be done compared to something like WordPress or Drupal.&lt;/p&gt;
&lt;p&gt;I already have Gulp to preprocess Sass, so I looked for something to minify inline scripts and found &lt;a href=&quot;https://www.npmjs.com/package/gulp-minify-inline&quot; title=&quot;Minify inline scripts with Gulp&quot;&gt;gulp-minify-inline&lt;/a&gt;. Next I created a folder &lt;code&gt;_pre_build&lt;/code&gt; and configured Jekyll to ignore it.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;exclude: [_pre_build]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Inside that folder I can put any file that exists in my Jekyll folder, like the &lt;code&gt;_includes/head.html&lt;/code&gt; file I use for my &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; section.&lt;/p&gt;
&lt;p&gt;In the &lt;code&gt;_pre_build&lt;/code&gt; folder I can have html files with un-minified scripts and then let Gulp minify them and move them to the “real” folders that Jekyll uses.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; minifyOptions &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token literal-property property&quot;&gt;jsSelector&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;script[data-minify=&quot;true&quot;]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token literal-property property&quot;&gt;cssSelector&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;style[data-minify=&quot;true&quot;]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token literal-property property&quot;&gt;js&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token string-property property&quot;&gt;&quot;vars&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;load&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;task&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;minify-inline&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;_pre_build/**/*.html&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;minifyInline&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;minifyOptions&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;error&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;      console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;gulp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;dest&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;./&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Future enhancements&lt;/h2&gt;
&lt;p&gt;Could I have done more? Absolutely. A lot of people split up their CSS into critical and non critical, and then inline the critical and lazy loads the non critical.&lt;/p&gt;
&lt;p&gt;I should probably look into using a CDN like Cloudflare.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>CSS Calc is pretty neat</title>
		<link href="https://andeers.com/2015/10/css-calc-is-neat/"/>
		<updated>2015-10-29T00:00:00Z</updated>
		<id>https://andeers.com/2015/10/css-calc-is-neat/</id>
		<content type="html">&lt;p&gt;With a centered layout it can be hard to have full with elements without a hassle.&lt;/p&gt;
&lt;p&gt;In this post will I show you a neat trick to get full width sections in a layout that are centered. If you just want the demo
check out this &lt;a href=&quot;http://codepen.io/andeersg/full/gaKadg/&quot; title=&quot;CodePen demo showing the layout trick&quot;&gt;CodePen&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The snippet should work in Internet Explorer 9 and up and the other major browsers.&lt;/p&gt;
&lt;pre class=&quot;language-scss&quot;&gt;&lt;code class=&quot;language-scss&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.full &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;100% &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt; 100vw&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;/2&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; relative&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100vw&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;min-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;// Optional (center padding both sides):&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;padding-left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;100vw &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;/2&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;padding-right&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;100vw &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;/2&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;{: .language-scss}&lt;/p&gt;
&lt;h2&gt;The how&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;vw&lt;/strong&gt; unit is the width of the viewport. 100vw is the width of your browser window, 50vw is half.&lt;/p&gt;
&lt;p&gt;The left property is where the magic happens:&lt;/p&gt;
&lt;pre class=&quot;language-scss&quot;&gt;&lt;code class=&quot;language-scss&quot;&gt;&lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;100% &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt; 100vw&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;/2&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;100% is the full width of the element.&lt;/li&gt;
&lt;li&gt;100vw is the width of the screen.&lt;/li&gt;
&lt;li&gt;So a screen that is 1200 pixels wide and a element that is 700px wide gives this equation: &lt;code&gt;(700px - 1200px) / 2&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The result of this is &lt;strong&gt;-250&lt;/strong&gt;, so we move the element 250 pixels to the left.&lt;/li&gt;
&lt;li&gt;Then we set the width of the element to the full with of the viewport.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Extra options&lt;/h2&gt;
&lt;p&gt;To center the content inside the full width element we add padding to both sides by flipping the calc function:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;padding-left: calc((100vw - 100%) / 2);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I have created a simple demo on CodePen you can explore, with examples for right and left padding only.&lt;/p&gt;
&lt;p data-height=&quot;268&quot; data-theme-id=&quot;0&quot; data-slug-hash=&quot;gaKadg&quot; data-default-tab=&quot;result&quot; data-user=&quot;andeersg&quot; class=&quot;codepen&quot;&gt;See the Pen &lt;a href=&quot;http://codepen.io/andeersg/pen/gaKadg/&quot;&gt;CSS Calc examples&lt;/a&gt; by andeersg (&lt;a href=&quot;http://codepen.io/andeersg&quot;&gt;@andeersg&lt;/a&gt;) on &lt;a href=&quot;http://codepen.io/&quot;&gt;CodePen&lt;/a&gt;.&lt;/p&gt;
&lt;script async=&quot;&quot; src=&quot;https://assets.codepen.io/assets/embed/ei.js&quot;&gt;&lt;/script&gt;</content>
	</entry>
	
	<entry>
		<title>CSS Grid Layout</title>
		<link href="https://andeers.com/2015/10/grid-layout/"/>
		<updated>2015-10-26T00:00:00Z</updated>
		<id>https://andeers.com/2015/10/grid-layout/</id>
		<content type="html">&lt;p&gt;If you have worked with the web, grids are nothing new to you. The grid layout specification is a different take on grids than the numerous grid frameworks that exist.&lt;/p&gt;
&lt;p&gt;Much like Flexbox does the Grid Layout allow us to control the html in a new and simpler way.&lt;/p&gt;
&lt;p&gt;Even though Bootstrap has made it quite easy to set up a grid, there is a still a battle of negative margins, paddings, floating and clearfixes going on.&lt;/p&gt;
&lt;p&gt;The Grid Layout specification tries to make it easy to generate grids with rows and columns. With it you can use the space available in a smart way.&lt;/p&gt;
&lt;p&gt;You can easily set a column to a fixed with, and another one to take up the rest of the width available. And you have the same options for height, a row can be set to take up all remaining vertical space.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The only way you can test it is with Chrome Canary and a experimental flag turned on.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Unfortunatly Grid Layout has a really poor browser support at the moment. The only way you can test it is with Chrome Canary and a experimental flag turned on. For more updated information on this you can check &lt;a href=&quot;http://caniuse.com/#feat=css-grid&quot; title=&quot;CSS Grid on caniuse.com&quot;&gt;caniuse.com&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Technical stuff&lt;/h2&gt;
&lt;p&gt;We need a parent element to get started:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;#grid-parent&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; grid&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;grid-template-columns&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto &lt;span class=&quot;token function&quot;&gt;minmax&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;min-content&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1fr&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;grid-template-rows&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto &lt;span class=&quot;token function&quot;&gt;minmax&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;min-content&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1fr&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; auto&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here we see that the display property has a new value, and that we have two new properties defining the rows and columns in the grid.&lt;/p&gt;
&lt;p&gt;The rows and columns are separated with a space, so here we have two columns and three rows.&lt;/p&gt;
&lt;p&gt;The various rows and columns can be defined with various values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;CSS Length value (like px),&lt;/li&gt;
&lt;li&gt;Percentage&lt;/li&gt;
&lt;li&gt;Flex factor (defined with the value fr)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;min-content&lt;/code&gt; (make the column at least as wide as the content)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;max-content&lt;/code&gt; (don&#39;t make the column larger than the content)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;minmax()&lt;/code&gt; (takes both a minimum and a maximum value)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Elements in the grid&lt;/h2&gt;
&lt;p&gt;After we have defined the grid we can take control of the elements inside.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;grid-parent&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;logo&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;stats&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;board&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;score&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here we have a simple markup for a game board. To place these elements in the grid we use the following CSS:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;#logo&lt;/span&gt;   &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;grid-column&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;grid-row&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1 &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token selector&quot;&gt;#stats&lt;/span&gt;  &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;grid-column&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;grid-row&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 2 / span 2&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;align-self&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; start &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token selector&quot;&gt;#board&lt;/span&gt;  &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;grid-column&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 2&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;grid-row&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1 / span 2&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token selector&quot;&gt;#score&lt;/span&gt;  &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;grid-column&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 2&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;grid-row&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 3&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;justify-self&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; center &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The logo goes top left, below the logo we place the stats. Since we don&#39;t have anything to put below, the stats use two rows.&lt;/p&gt;
&lt;p&gt;The board also takes two rows in the other column, with the scores underneath.&lt;/p&gt;
&lt;p&gt;Since all the grid layouts are defined in the CSS we can easily alter the grid at different breakpoints or with just a parent class.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 600px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token selector&quot;&gt;#grid-parent&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;grid-template-columns&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;grid-template-rows&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto min-content auto auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token selector&quot;&gt;#grid-parent *&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;grid-column&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token selector&quot;&gt;#logo&lt;/span&gt;   &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;grid-row&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token selector&quot;&gt;#stats&lt;/span&gt;  &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;grid-row&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 4&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token selector&quot;&gt;#board&lt;/span&gt;  &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;grid-row&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 2&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token selector&quot;&gt;#score&lt;/span&gt;  &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;grid-row&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 3&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here we completely alter the grid at a small breakpoint, we change it to one column and add some more rows. We also change the order of the elements.&lt;/p&gt;
&lt;h2&gt;Summary&lt;/h2&gt;
&lt;p&gt;This was a very short introduction to CSS Grids, and I really recommend the &lt;a href=&quot;http://www.w3.org/TR/css-grid-1&quot; title=&quot;The specifications&quot;&gt;specifications&lt;/a&gt; for more examples.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Getting started with Jekyll</title>
		<link href="https://andeers.com/2015/09/getting-started-with-jekyll/"/>
		<updated>2015-09-28T00:00:00Z</updated>
		<id>https://andeers.com/2015/09/getting-started-with-jekyll/</id>
		<content type="html">&lt;p&gt;A couple of days ago I moved my blog from WordPress to Jekyll, a static site generator. Jekyll has a simple structure that allows for easy theming and styling.&lt;/p&gt;
&lt;p&gt;In this post I will go through:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What Jekyll is&lt;/li&gt;
&lt;li&gt;How to get started&lt;/li&gt;
&lt;li&gt;Features of Jekyll&lt;/li&gt;
&lt;li&gt;Hosting your site on Github&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;What is Jekyll&lt;/h2&gt;
&lt;p&gt;Jekyll is a static site generator created by Tom Preston-Werner in 2008. It’s written in Ruby and compiles all your source files to a static HTML site.&lt;/p&gt;
&lt;p&gt;Since it’s a static site generator you don’t need a database, so it’s fewer “things” to take care of.&lt;/p&gt;
&lt;p&gt;And combining it with Github gives you a dead simple awesome blog engine. But more on that later on.&lt;/p&gt;
&lt;h2&gt;Why should I consider Jekyll?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Fast&lt;/strong&gt;&lt;br /&gt;
No database is needed, so when users visit you don&#39;t have to query and handle the data.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Simple&lt;/strong&gt;&lt;br /&gt;
A folder with posts, a couple of layout files, and that is all you need.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;The setup&lt;/h2&gt;
&lt;p&gt;After you have installed Jekyll:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gem install jekyll
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can generate a sample site with the following command:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;jekyll new awesome_blog
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This command will generate a folder &lt;code&gt;awesome_blog&lt;/code&gt; with a working Jekyll site inside.&lt;/p&gt;
&lt;p&gt;To see your freshly generated site in action type:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;jekyll serve
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will make your blog accessible from &lt;code&gt;localhost:4000&lt;/code&gt; (if you would like another port you can add &lt;code&gt;-P 4242&lt;/code&gt; to the command).&lt;/p&gt;
&lt;h2&gt;The structure&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The main Jekyll file is called &lt;code&gt;_config.yml&lt;/code&gt; and contains global settings and variables.&lt;/li&gt;
&lt;li&gt;All blog posts are located in the &lt;code&gt;_posts&lt;/code&gt; folder.&lt;/li&gt;
&lt;li&gt;Layouts are located in the &lt;code&gt;_layouts&lt;/code&gt; folder.&lt;/li&gt;
&lt;li&gt;Jekyll has builth-in support for SCSS, but more on that later.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Files and folders starting with an underscore will not be part of the generated site. Everything else will.&lt;/p&gt;
&lt;h2&gt;SCSS&lt;/h2&gt;
&lt;p&gt;If you are familiar with Compass, Gulp og Grunt tasks this approach may look weird at first.&lt;/p&gt;
&lt;p&gt;There are two folders &lt;code&gt;_sass&lt;/code&gt; and &lt;code&gt;css&lt;/code&gt;, and if you go the Sass folder you would expect a &lt;code&gt;style.scss&lt;/code&gt; and some partial files. But in Jekyll the partial files are stored in the sass-folder, and the main sass file that imports them are located in the css-folder. Weird right?&lt;/p&gt;
&lt;p&gt;These Sass files will be compiled automatically with the &lt;code&gt;jekyll build&lt;/code&gt; or &lt;code&gt;jekyll serve&lt;/code&gt; commands, but there is nothing that stops you from using your own CSS preprocessor and folder setup.&lt;/p&gt;
&lt;h2&gt;Templates&lt;/h2&gt;
&lt;p&gt;Templates use a templating language called &lt;strong&gt;Liquid&lt;/strong&gt;, if you are familiar with &lt;strong&gt;Handlebars&lt;/strong&gt; or &lt;strong&gt;Underscore.js&lt;/strong&gt; they are kind of similar.&lt;/p&gt;
&lt;p&gt;A really simple index page could look something like this:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;br /&gt;---&lt;br /&gt;layout: default&lt;br /&gt;---&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;home&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h1&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;page-heading&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Posts&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;ul&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;post-list&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    {% for post in site.posts %}&lt;br /&gt;      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;post-meta&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&#92;{{ post.date | date: &quot;%b %-d, %Y&quot; }}&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;          &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;post-link&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&#92;{{ post.url | prepend: site.baseurl }}&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;{{ post.title }}&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    {% endfor %}&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;ul&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first part between the dashes is the YAML, and a funny thing I just learnt is that YAML is short for:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Y&lt;/strong&gt;AML &lt;strong&gt;A&lt;/strong&gt;in&#39;t &lt;strong&gt;M&lt;/strong&gt;arkup &lt;strong&gt;L&lt;/strong&gt;anguage&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&amp;quot;YAML is a human friendly data serialization standard for all programming languages.&amp;quot;&lt;/p&gt;
&lt;p&gt;We tell Jekyll that we want to use the default template located at &lt;code&gt;_layouts/default.html&lt;/code&gt;.
There are a couple of variables you can add to the YAML to configure the output:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;permalink - Set the url where this post is located (will override the site setting)&lt;/li&gt;
&lt;li&gt;title - The post/page title should be added, this way it is available to the layout and can be displayed in the title tag.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Includes&lt;/h2&gt;
&lt;p&gt;In Jekyll you have includes, you can think of them as reusable blocks of code.&lt;/p&gt;
&lt;p&gt;In the starter theme the header and footer are includes. They are located in the &lt;code&gt;_includes&lt;/code&gt; folder and are referenced like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{% include header.html %}
{% include footer.html %}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Includes are great for things you repeat on multiple pages and across layouts.&lt;/p&gt;
&lt;h2&gt;Writing posts&lt;/h2&gt;
&lt;p&gt;To write a post you simply:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add a file to the &lt;code&gt;_posts&lt;/code&gt; folder with the name pattern &lt;code&gt;yyyy-mm-dd-some-text.md&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Start the file with the YAML block, and add a title and what layout you want to use.&lt;/li&gt;
&lt;li&gt;Write your blog post with markdown (or html).&lt;/li&gt;
&lt;li&gt;Run the build command or just look at the blog if you use the serve command.&lt;/li&gt;
&lt;li&gt;Your first post is visible on your blog!&lt;/li&gt;
&lt;/ol&gt;
&lt;h1&gt;Hosting on Github&lt;/h1&gt;
&lt;p&gt;A very cool feature of Github is that you can host your Jekyll powered website for free.&lt;/p&gt;
&lt;p&gt;There are two ways you can set this up:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a repo called &lt;code&gt;username.github.io&lt;/code&gt; and keep your Jekyll site in the master branch.&lt;br /&gt;
Site available at &lt;code&gt;username.github.io&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Create another repo and create a branch called &lt;code&gt;gh-pages&lt;/code&gt;.&lt;br /&gt;
Site available at &lt;code&gt;username.github.io/repo_name&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you have your own domain it&#39;s also very easy to use it. Just add a file called &lt;code&gt;CNAME&lt;/code&gt; to your Jekyll folder with the domain you want to use.&lt;/p&gt;
&lt;p&gt;Then you just have to point your domain to Github.&lt;/p&gt;
&lt;h1&gt;Local development with Vagrant&lt;/h1&gt;
&lt;p&gt;I have created a &lt;a href=&quot;https://github.com/andeersg/jekyll-vagrant&quot; title=&quot;Jekyll Vagrant&quot;&gt;Vagrant&lt;/a&gt; with Ruby and Jekyll that you can use if you don&#39;t want to hassle with Ruby on your local computer.&lt;/p&gt;
&lt;p&gt;If you have Vagrant installed just do:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone https://github.com/andeersg/jekyll-vagrant jekyll&lt;br /&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; jekyll&lt;br /&gt;vagrant up&lt;br /&gt;vagrant &lt;span class=&quot;token function&quot;&gt;ssh&lt;/span&gt;&lt;br /&gt;jekyll new my_blog&lt;br /&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; my_blog&lt;br /&gt;jekyll serve&lt;/code&gt;&lt;/pre&gt;
&lt;h1&gt;What next?&lt;/h1&gt;
&lt;p&gt;You could for example take a look at the &lt;a href=&quot;https://github.com/andeersg/andeersg.github.io&quot; title=&quot;Source of andeers.com&quot;&gt;source code&lt;/a&gt; for this blog. Or you could visit &lt;a href=&quot;http://jekyllrb.com/&quot; title=&quot;Jekyll.rb&quot;&gt;Jekyll&#39;s homepage&lt;/a&gt; to get a more extensive look at Jekyll.&lt;/p&gt;
&lt;p&gt;To learn more about hosting on Github I reccomend the &lt;a href=&quot;https://pages.github.com/&quot; title=&quot;Github Pages&quot;&gt;Github Pages site&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>A new WordPress theme &amp;#8211; Part 1</title>
		<link href="https://andeers.com/new-wordpress-theme-part-1/"/>
		<updated>2015-06-18T00:00:00Z</updated>
		<id>https://andeers.com/new-wordpress-theme-part-1/</id>
		<content type="html">&lt;p&gt;I have for long wanted to improve my site. I was not happy with the old design and I felt like I had locked myself in a corner. The theme used a big banner image (inspired of Medium) and I never felt I could create a nice image for it.&lt;/p&gt;
&lt;p&gt;And also the code was a mess and I was not motivated to improve it. So I decided to start working on a new theme. For months I have crawled the web looking for inspiration since I haven’t been sure what kind of style I wanted for this blog.&lt;/p&gt;
&lt;p&gt;I also have a habit of not getting satisfied with my own private work (guess most developers are like that), so I decided that I should get the theme working, enable it and improve it afterwards.&lt;/p&gt;
&lt;p&gt;So in this blog entry, and hopefully a couple of more I will document the stuff I have done to make this site better.&lt;/p&gt;
&lt;h2&gt;Getting started with a theme&lt;/h2&gt;
&lt;p&gt;I use &lt;a href=&quot;http://underscores.me/&quot; title=&quot;Underscores&quot;&gt;_s&lt;/a&gt; as a template/starting point so I know that I have best practice WordPress code as a base, then I set up my Gulp config.&lt;/p&gt;
&lt;p&gt;In my &lt;code&gt;wp-config.php&lt;/code&gt; I have added a constant:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;PHP&quot;&gt;define(&#39;ENVIRONMENT&#39;, &#39;development&#39;);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That way I can do this in my &lt;code&gt;functions.php&lt;/code&gt; to automatically get the unminified CSS in development environments:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;PHP&quot;&gt;if (ENVIRONMENT == &#39;development&#39;) {
  wp_enqueue_style( &#39;adams-style&#39;, get_stylesheet_directory_uri() . &#39;/assets/css/style.css&#39; );
}
else {
  wp_enqueue_style( &#39;adams-style&#39;, get_stylesheet_directory_uri() . &#39;/assets/css/style.min.css&#39; );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And this technique can be used for javascripts and other “things” that should have different setups in development.&lt;/p&gt;
&lt;h2&gt;Publishing it&lt;/h2&gt;
&lt;p&gt;I have put this theme on Github, you can look at it &lt;a href=&quot;https://github.com/andeersg/adams&quot;&gt;here&lt;/a&gt;. May plan is to create a develop branch, and keep the master branch like the live site at all times. I really like &lt;a href=&quot;http://nvie.com/posts/a-successful-git-branching-model/&quot;&gt;this&lt;/a&gt; Git workflow, and plan to use it for this theme.&lt;/p&gt;
&lt;p&gt;So if you find any bugs or see room for improvements, feel free to create an issue or a pull request.&lt;/p&gt;
&lt;h2&gt;What’s next?&lt;/h2&gt;
&lt;p&gt;I have a long list of stuff that needs to be fixed, here are some of them:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Archive (I don’t like/want the pagination, so I must create some archive display)&lt;/li&gt;
&lt;li&gt;Icons (I want to use some icons for different stuff)&lt;/li&gt;
&lt;li&gt;Post types (Post types for image, link, maybe aside also)&lt;/li&gt;
&lt;li&gt;Speed optimization (I want this page to load fast and be effective, so optimizing CSS, JS)&lt;/li&gt;
&lt;li&gt;Server optimization (Find a good setup for Varnish and Nginx)&lt;/li&gt;
&lt;li&gt;Improve the theme in general (Styling)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I already feel that this approach as encouraged me to develop and write more.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>WordPress SEO and relative links</title>
		<link href="https://andeers.com/wordpress-seo-and-relative-links/"/>
		<updated>2015-06-16T00:00:00Z</updated>
		<id>https://andeers.com/wordpress-seo-and-relative-links/</id>
		<content type="html">&lt;p&gt;I really like &lt;a href=&quot;https://wordpress.org/plugins/wordpress-seo/&quot;&gt;WordPress SEO&lt;/a&gt;, it’s a nice plugin that does everything I need for SEO. But for long I have had a problem with the sitemap feature. My posts did not show up in the post-sitemap.&lt;/p&gt;
&lt;p&gt;I did not look into it anymore until today, when I looked through webmaster tools and figured I should get everything to work.&lt;/p&gt;
&lt;p&gt;I opened &lt;code&gt;class-sitemaps.php&lt;/code&gt; in the WordPress SEO plugin and started to go through the code.&lt;/p&gt;
&lt;p&gt;At line 818 I found this snippet:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;PHP&quot;&gt;if ( false === strpos( $url[&#39;loc&#39;], $this-&amp;gt;home_url ) ) {
  continue;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For some reason this continue always triggered. At first I did not see what the problem was, since all my posts have urls. But then I realized (as you probably have guessed from the title) that all of them where relative links.&lt;/p&gt;
&lt;p&gt;And WordPress SEO treats them as external links.&lt;/p&gt;
&lt;h2&gt;The solution&lt;/h2&gt;
&lt;p&gt;The fix was quite easy. WordPress SEO have a alter hook right before this check, so with a small function in my &lt;code&gt;functions.php&lt;/code&gt; I re-added the domain part of the url.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;PHP&quot;&gt;function andeersg_fix_urls($url, $post) {
  if (substr($url, 0, 1) == &#39;/&#39;) {
    return home_url() . $url;
  }
  else {
    return $url;
  }
}
add_filter(&#39;wpseo_xml_sitemap_post_url&#39;, &#39;andeersg_fix_urls&#39;, 10,  2);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I do a small check to see that the first character is a forward slash so I don’t “fix” actual external urls if there are some of those.&lt;/p&gt;
&lt;p&gt;And with that snippet enabled the sitemaps work again.&lt;/p&gt;
&lt;h2&gt;The actual problem&lt;/h2&gt;
&lt;p&gt;I have a plugin called &lt;a href=&quot;https://wordpress.org/plugins/root-relative-urls/&quot;&gt;Root Relative URLs&lt;/a&gt; enabled, and that plugin removes the domain part from all urls.&lt;/p&gt;
&lt;p&gt;I found &lt;a href=&quot;https://yoast.com/relative-urls-issues/&quot;&gt;this blog entry&lt;/a&gt; from Yoast, the team behind WordPress SEO that talks about how relative urls are not good. So I guess that may be the reason they treat relative urls this way.&lt;/p&gt;
&lt;p&gt;I’m actually not sure why I have that plugin enabled, but I guess it has something to do with local development and broken/wrong image links.&lt;/p&gt;
&lt;p&gt;Anyhow, disabling plugins that create relative urls will fix this problem, or you could use my code snippet. I will continue to use it until I know why I have that relative links plugin enabled.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>New tools are not scary</title>
		<link href="https://andeers.com/new-tools-are-not-scary/"/>
		<updated>2015-04-15T00:00:00Z</updated>
		<id>https://andeers.com/new-tools-are-not-scary/</id>
		<content type="html">&lt;p&gt;Being a developer is not the same as it was a couple of years ago. It was HTML, CSS and JS you had to cope with. These days it’s completely different.&lt;/p&gt;
&lt;p&gt;Every day there are new tools and technologies coming out that can help and improve our workflows. New stuff can often look scary and it’s easy to feel like todays workflow and way of doing stuff is the best.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Why should i spend time learning all this new stuff when I get my work done now?&lt;/p&gt;
&lt;p&gt;— &lt;cite&gt;Probably some developer&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And if we try all the tools out there we probably will spend all our time learning stuff. But there are really some good tools that can improve our workflows.&lt;/p&gt;
&lt;h2&gt;Don’t be afraid&lt;/h2&gt;
&lt;p&gt;One thing I have learned from my self is to not be afraid of stuff only because it’s new or different. You can’t have a real opinion on stuff without trying it first.&lt;/p&gt;
&lt;p&gt;Being afraid of change is not a uncommon thing, just take a look at &lt;strong&gt;every&lt;/strong&gt; change Facebook has done the last years. For each change we have multiple groups with people wanting to revert it and there are news articles about it.&lt;/p&gt;
&lt;p&gt;But usually no change is reverted, people stop complaining and just learn to use the site with the new changes. Maybe was it a good change if they think about it.&lt;/p&gt;
&lt;p&gt;It’s the same about preprocessors, gulp, grunt, yeoman, bower, travis-ci, backbone, angular or mocha. When you first hear about them they sound scary and difficult. But probably you will benefit from using a couple of those. Next I will share a couple of the tools I use.&lt;/p&gt;
&lt;h2&gt;Tools I use&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;1. SCSS&lt;/strong&gt;&lt;br /&gt;
I’m not sure when, but I started to use the preprocessor SCSS for my CSS a long time ago, I used it with Compass. You probably know what SCSS is, but here is the short summary from &lt;a href=&quot;http://sass-lang.com/&quot; title=&quot;SASS-Lang&quot;&gt;sass-lang&lt;/a&gt;?&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Sass is the most mature, stable, and powerful professional grade CSS extension language in the world.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It allows you to split your CSS into multiple files, use variables and functions (mixins).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. &lt;a href=&quot;http://gruntjs.com/&quot; title=&quot;Grunt.js&quot;&gt;Grunt&lt;/a&gt; and &lt;a href=&quot;http://gulpjs.com/&quot; title=&quot;Gulp.js&quot;&gt;Gulp&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;
Grunt and Gulp are task runners written in &lt;a href=&quot;https://nodejs.org/&quot;&gt;Node.js&lt;/a&gt;. They do not to much on their own, but when you give them tasks to do they get really powerful.&lt;/p&gt;
&lt;p&gt;I started with Grunt, but now I mostly use Gulp. I think they both can accomplish the same, but I prefer the shorter config of Gulp.&lt;/p&gt;
&lt;p&gt;The first task I made was for SCSS, so instead of having to run &lt;code&gt;compass watch&lt;/code&gt;, I now write &lt;code&gt;gulp watch&lt;/code&gt;. But the magic of Gulp is that I also have some extra plugins, like the &lt;a href=&quot;https://www.npmjs.com/package/gulp-autoprefixer&quot; title=&quot;Gulp Autoprefixer at NPMJS.com&quot;&gt;Autoprefixer&lt;/a&gt;. After Gulp has compiled my SCSS it sends it to this plugins that check if it should prefix some CSS for me.&lt;/p&gt;
&lt;p&gt;I also have a Javascript task in Gulp that “lints” my files and notifies me of errors, merges files together and minifies it for me.&lt;/p&gt;
&lt;p&gt;All of this happens inside Gulp, and it has become a tool I don’t want to live without.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3. &lt;a href=&quot;http://yeoman.io/&quot; title=&quot;Yeoman.io&quot;&gt;Yeoman&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;
Yeoman is one of the latest tools I have looked at. It’s also written in Node.js and is a scaffolding tool. I use it to create folder structures and files for Drupal modules at work, and I also have a Gulp workflow it can set up for me.&lt;/p&gt;
&lt;p&gt;It’s a command line tool, so to use it you have to be a little familiar with the command line.&lt;/p&gt;
&lt;p&gt;Yeoman is a good example of a tool I thought was scary for a long time, I had heard about it but never looked at what it really was.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4. &lt;a href=&quot;https://travis-ci.org/&quot; title=&quot;Travis CI&quot;&gt;Travis CI&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;
I had heard about automatic testing from colleagues and really thought it sounds smart, but I never looked at it myself. The idea that a external service automatically checks your code and reports back if it finds problems or if everything is ok sounds amazing.&lt;/p&gt;
&lt;p&gt;And it really is. When I created &lt;a href=&quot;https://github.com/andeersg/generator-drupal-module&quot;&gt;a generator for Yeoman&lt;/a&gt;, I decided that I also should add tests for it. Since my generator is pretty simple, my test (for now) only checks if the correct files and folders are created. Travis provides you with a badge you can have in your readme file on Github that updates itself according to the test results.&lt;/p&gt;
&lt;p&gt;So with a successful test you get this green nice badge:&lt;br /&gt;
&lt;img src=&quot;https://andeers.com/wp-content/uploads/2015/04/Skjermbilde-2015-04-15-20.35.55-1024x199.png&quot; alt=&quot;Travis build passing, one of the new tools I use&quot; width=&quot;640&quot; height=&quot;124&quot; class=&quot;aligncenter size-large wp-image-1143&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;What’s next?&lt;/h2&gt;
&lt;p&gt;All of this tools looked scary in the beginning, but have proved to be invaluable for me. I really recommend you try them out.&lt;/p&gt;
&lt;p&gt;So I really recommend you find some tools you thought was scary and try them. Maybe you find your perfect tool.&lt;/p&gt;
&lt;p&gt;And, don’t forget to actually do some work as well 😉&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>currentColor</title>
		<link href="https://andeers.com/currentcolor/"/>
		<updated>2015-03-16T00:00:00Z</updated>
		<id>https://andeers.com/currentcolor/</id>
		<content type="html">&lt;p&gt;currentColor is a quite unknown CSS value with good browser support, and i thought i should check it out and see if i could use it for something useful.&lt;/p&gt;
&lt;p&gt;It’s supported in all major browsers &lt;a href=&quot;http://caniuse.com/#search=currentcolor&quot; title=&quot;currentColor @ caniuse.com&quot;&gt;according to caniuse.com&lt;/a&gt;, except Internet Explorer 8 (of course).&lt;/p&gt;
&lt;p&gt;Example usage:&lt;/p&gt;
&lt;p&gt;.element {
color: #e6e6e6;
border: 1px solid currentColor; /* #e6e6e6 &lt;em&gt;/
}
.element a {
color: currentColor; /&lt;/em&gt; #e6e6e6 &lt;em&gt;/
}
.second-element {
color: currentColor; /&lt;/em&gt; Not #e6e6e6 &lt;em&gt;/
}
.third-element {
border-color: #ff88aa;
color: currentColor; /&lt;/em&gt; Won&#39;t work */
}&lt;/p&gt;
&lt;p&gt;Both the border and the links inside the element will have the same color as defined on the first line.&lt;/p&gt;
&lt;p&gt;For the second element &lt;code&gt;currentColor&lt;/code&gt; will go up the dom until it finds another defined color, and if it doesn’t it will take take the browser default color (usually black).&lt;/p&gt;
&lt;p&gt;For the third element it won’t work, since &lt;code&gt;currentColor&lt;/code&gt; needs a &lt;code&gt;color: #somecolor;&lt;/code&gt; before it to work. It won’t work with &lt;code&gt;background-color&lt;/code&gt; or &lt;code&gt;border-color&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This also mean that you cannot use it for a sibling element, it has to be a parent or the same element.&lt;/p&gt;
&lt;h2&gt;What can it be used for?&lt;/h2&gt;
&lt;p&gt;The only thing i can think of is if you have some objects that should always be in a certain style. For example the comments of your site has been designed to have a orange border and orange links inside it. Then you have defined the color once and styled all elements inside your comment with &lt;code&gt;currentColor&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I think its value is quite small when you probably already are using preprocessors for your CSS and have variables there.&lt;/p&gt;
&lt;p&gt;But i like the idea of it and think i would have used it if i hadn’t preprocessors available.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Writing CSS with ITCSS</title>
		<link href="https://andeers.com/writing-css-with-itcss/"/>
		<updated>2015-03-01T00:00:00Z</updated>
		<id>https://andeers.com/writing-css-with-itcss/</id>
		<content type="html">&lt;p&gt;Inspired by Harry Roberts’ &lt;a href=&quot;http://vimeo.com/114965689&quot; title=&quot;Harry Roberts at TDC&quot;&gt;talk about ITCSS&lt;/a&gt; at Trondheim Developer Conference in October, i decided to use it for a redesign/optimization i was going to work on for a client at work.&lt;/p&gt;
&lt;h2&gt;What is ITCSS?&lt;/h2&gt;
&lt;p&gt;ITCSS stands for Inverted Triangle CSS and is a way of structuring your CSS. The inverted triangle means that you start off in the wide end (low specificity) with base styling of html tags and the more you go down the triangle the narrower it gets and you have more specificity and complex rules.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Settings – SASS/LESS variables and default values.&lt;/li&gt;
&lt;li&gt;Tools – Mixins and helper functions&lt;/li&gt;
&lt;li&gt;Generic&lt;/li&gt;
&lt;li&gt;Base&lt;/li&gt;
&lt;li&gt;Objects&lt;/li&gt;
&lt;li&gt;Components&lt;/li&gt;
&lt;li&gt;Trumps&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The first two are only relevant if you use a preprocessor (and you should use a preprocessor), afterwards you place your reset/normalize, declare fonts and start on the selectors.&lt;/p&gt;
&lt;p&gt;When you get to step 5 you start defining classes and writing CSS for specific elements.&lt;/p&gt;
&lt;p&gt;But you can read more about the structure in &lt;a href=&quot;http://csswizardry.net/talks/2014/11/itcss-dafed.pdf&quot; title=&quot;The slides&quot;&gt;Harry Roberts’ slides&lt;/a&gt;, here i want to tell about my experiences while testing it.&lt;/p&gt;
&lt;h2&gt;Something about the old site&lt;/h2&gt;
&lt;p&gt;The site i was going to work with suffered from almost three years of development and the CSS was a mess. There were no structure, so when a new feature was added it either was added to the end of some file, or in a new file appended at the end. At the end you almost had to search to find the parts you were going to work on.&lt;/p&gt;
&lt;p&gt;And this was my main motivation to try to put everything into a system, so when i got the opportunity to rewrite this CSS, ITCSS was a logical choice.&lt;/p&gt;
&lt;h2&gt;Getting started&lt;/h2&gt;
&lt;p&gt;I started with the main SASS file and just wrote down the steps of the triangle. The settings, base, tools and generic steps i created files for. Components, objects and trumps i created as folders since this is where most of the code would end up. Inside each folder i have a &lt;code&gt;_all.scss&lt;/code&gt; file that contains all imports for this folder, by doing this the main SASS file is kept clean and tidy.&lt;/p&gt;
&lt;p&gt;In this project the “object”-step was not used. We did not have any defined objects, so everything got sorted into the components step. I split things up into files like “buttons”, “form”, “header” and so on.&lt;/p&gt;
&lt;p&gt;Rules for grid, clearfix, screen readers and visibility where put into the trumps step. They are put last so that no other class can mess with them.&lt;/p&gt;
&lt;h2&gt;Combining it with BEM&lt;/h2&gt;
&lt;p&gt;BEM (Block, Element &amp;amp; Modifier) is a way of naming classes. And instead of nesting you have classes that tell the hierarchy. For example:&lt;/p&gt;
&lt;p&gt;.navbar {
CSS-rules here.
}
.navbar__item {
CSS
}
.navbar__item--active {
CSS
}&lt;/p&gt;
&lt;p&gt;I feel like this approach is really good. And with SCSS you can “nest” it by using the &lt;code&gt;&amp;amp;amp;&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;.navbar {
&amp;amp;__item {
&amp;amp;--active {}
}
}&lt;/p&gt;
&lt;p&gt;This code will compile to the code in the previous example. So you can still “nest” in SASS to keep the working code organized, but the compiled code is flat.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.smashingmagazine.com/2012/04/16/a-new-front-end-methodology-bem/&quot; title=&quot;BEM&quot;&gt;Here you can read more about BEM.&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Problems?&lt;/h2&gt;
&lt;p&gt;This site was built with Drupal and the main problem was basically being able to add classes to all the elements i wanted (so the problem was not related to ITCSS at all). There were a lot of extra work because i had to create functions and use hooks to override Drupal.&lt;/p&gt;
&lt;h2&gt;The result, and was it worth it?&lt;/h2&gt;
&lt;p&gt;Comparing the old site with the new site add cssstats.org we see that:&lt;br /&gt;
Number of rules went from 506 to 703.&lt;br /&gt;
Selectors went from 623 to 975.&lt;br /&gt;
File size went from 77kb to 62kb.&lt;/p&gt;
&lt;p&gt;I think one of the reasons there are so many more selectors is because of the bootstrap-grid. But also the redesign were more extensive.&lt;/p&gt;
&lt;p&gt;The most interesting is when you look at the visualisation of the specificity graph:&lt;br /&gt;
&lt;a href=&quot;https://andeers.com/wp-content/uploads/2015/02/specificity.png&quot;&gt;&lt;img src=&quot;https://andeers.com/wp-content/uploads/2015/02/specificity.png&quot; alt=&quot;specificity&quot; width=&quot;600&quot; height=&quot;407&quot; class=&quot;aligncenter size-full wp-image-1096&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There have been major changes in the specificity of the CSS. And that is one of the goals of ITCSS.&lt;/p&gt;
&lt;p&gt;While writing i felt i spent much more time moving and organizing the CSS than i would normally do, but i think i have much more control over the CSS now. I know where to go when i need to change something or add something new.&lt;/p&gt;
&lt;p&gt;I really like it, and i’m going to continue to use it on my projects.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>When ideas become an obstacle</title>
		<link href="https://andeers.com/ideas-become-obstacle/"/>
		<updated>2015-01-20T00:00:00Z</updated>
		<id>https://andeers.com/ideas-become-obstacle/</id>
		<content type="html">&lt;p&gt;Everyone has ideas and it’s a good thing we have them. But for me they can sometimes become an obstacle.&lt;/p&gt;
&lt;p&gt;That’s because i always see stuff i want to improve in the solutions i use and get ideas of things that would be cool to create.&lt;/p&gt;
&lt;p&gt;So i have figured out that i must suffer from &lt;strong&gt;IID&lt;/strong&gt;, an pretty unknown problem(mainly because i just made it up) that is called &lt;strong&gt;Instant Idea Development&lt;/strong&gt;. When i get an idea i feel the need to start working on it immediately, so i create a folder and some files, maybe download some modules from NPM, write some code. But then i need to continue my “real work”, so i leave this newly started project in one of my projects folders (i have a lot of them).&lt;/p&gt;
&lt;p&gt;Even if i don’t start creating a project for my ideas, i have it in my head and think about it. And that can be very unproductive. It makes me distracted.&lt;/p&gt;
&lt;p&gt;And when i get home and should have the energy and time to work on some side-projects i usually don’t do anything, because my growing folders of started projects takes away my motivation.&lt;/p&gt;
&lt;p&gt;Of the ideas i have, some are way too complex for spare-time work, some requires learning a lot of new stuff (i like learning new stuff, but there is a time for everything) and some ideas wasn’t that good. But when i don’t do any of that i get more stressed that i don’t work on anything. So it’s a bad circle.&lt;/p&gt;
&lt;p&gt;One thing that is quite ironic is that i have 3-4 projects for different todolist/project management tools to manage all my ideas.&lt;/p&gt;
&lt;h2&gt;Changing the workflow&lt;/h2&gt;
&lt;p&gt;To avoid this from happening i have forced myself to write down ideas and “forget” them. By writing it down i don’t get afraid of losing my ideas, and i don’t go around and think about them all the time.&lt;/p&gt;
&lt;p&gt;To manage this i have created a &lt;a href=&quot;https://trello.com/&quot; title=&quot;Trello&quot;&gt;Trello&lt;/a&gt; board for my ideas. With every idea as a “card” it’s easy to label them, comment on them to add more information and eventually move them from “idea” to “work in progress”, another list on my board.&lt;/p&gt;
&lt;p&gt;I can absolutely admit that it still happens that a folder is created and some code is started on, but it doesn’t happen all the time anymore, and i don’t feel stressed because of all the things i want to do.&lt;/p&gt;
&lt;p&gt;It’s also good to get some distance to the ideas. It’s much easier to see the really bad ones when you have had some time to think about it.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Creating a command line tool with Node.js</title>
		<link href="https://andeers.com/creating-command-line-tool-node-js/"/>
		<updated>2014-11-24T00:00:00Z</updated>
		<id>https://andeers.com/creating-command-line-tool-node-js/</id>
		<content type="html">&lt;p&gt;Command line tools are always useful. They can help you do stuff faster and be more productive. And with Node.js it’s really easy to create them yourself.&lt;/p&gt;
&lt;p&gt;The easiest command line tool may be something like this:&lt;/p&gt;
&lt;p&gt;#!/usr/bin/env node
console.log(process.argv);&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The first line tells that it’s Node that should be used for this.&lt;/li&gt;
&lt;li&gt;The second line just outputs every argument back to you.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To make this work just type &lt;code&gt;node index.js arg1 arg2 arg3&lt;/code&gt; and your console will print:&lt;/p&gt;
&lt;p&gt;[&#39;node&#39;,
&#39;/path/to/js/file&#39;,
&#39;arg1&#39;,
&#39;arg2&#39;,
&#39;arg3&#39;]&lt;/p&gt;
&lt;h2&gt;Slightly more advanced&lt;/h2&gt;
&lt;p&gt;If you want to make it even more like a command line tool:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Rename it to cmdtool (without the .js ending).&lt;/li&gt;
&lt;li&gt;Make it executable (sudo chmod +x cmdtool)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Then we can do the same as before, only we now just need to type &lt;code&gt;./cmdtool arg1 arg2 arg3&lt;/code&gt; and the result will be the same.&lt;/p&gt;
&lt;h2&gt;Fancyness increasing&lt;/h2&gt;
&lt;p&gt;To make it even more fancy either put your script in &lt;code&gt;/usr/local/bin&lt;/code&gt; or make a symlink to it from there (&lt;code&gt;ln -s /source/cmdtool /usr/local/bin/cmdtool&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Then you can just type &lt;code&gt;cmdtool arg1 arg2&lt;/code&gt; without anything extra for the real command line feel.&lt;/p&gt;
&lt;p&gt;So now we have a working command line tool with input arguments. Now you could go on and loop through the arguments and parse them for option flags and input and everything yourself, or you could use a node.js package made for this.&lt;/p&gt;
&lt;h2&gt;Commander reporting for duty&lt;/h2&gt;
&lt;p&gt;I have tried a package called &lt;a href=&quot;https://www.npmjs.org/package/commander&quot;&gt;commander&lt;/a&gt; that’s really easy to setup. Here is an example:&lt;/p&gt;
&lt;p&gt;#!/usr/bin/env node&lt;/p&gt;
&lt;p&gt;var program = require(&#39;commander&#39;);
var chalk = require(&#39;chalk&#39;);&lt;/p&gt;
&lt;p&gt;program
.version(require(&#39;./package.json&#39;).version)
.usage(&#39;&lt;path to=&quot;&quot; file=&quot;&quot;&gt; [options]&#39;)
.option(&#39;-o, --output [type]&#39;, &#39;Add output format [html, csv, json]&#39;, &#39;html&#39;)
.option(&#39;-s, --screen&#39;, &#39;Add this to output file to console instead of creating file&#39;)
.option(&#39;-f, --filename [filename]&#39;, &#39;the output filename&#39;);&lt;/path&gt;&lt;/p&gt;
&lt;p&gt;program.parse(process.argv);&lt;/p&gt;
&lt;p&gt;if(!program.args.length) {
console.log( chalk.red(&#39;n No input file specified.&#39;) );
program.help();
}
if (program.filename) {
console.log(program.filename);
}
else {
console.log(&#39;No filename specified.&#39;);
}
{: .language-javascript}&lt;/p&gt;
&lt;p&gt;This code snippet actually requires two packages, commander and chalk. Chalk makes it easy to output text in different colors, like red for errors.&lt;/p&gt;
&lt;p&gt;The first part of the code defines options and format of the command line tool.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The usage line is a textual way to describe how the program works.&lt;/li&gt;
&lt;li&gt;The option lines is different options, with a short syntax, full syntax, helping text and optionally a default value.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;program.parse&lt;/code&gt; reads input (like we did with console.log in the first example).&lt;/li&gt;
&lt;li&gt;Next we check if there are any arguments, and if there isn’t we show an error and print the help (usage + options).&lt;/li&gt;
&lt;li&gt;Next we can check for the values of the different options and use them in our script.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So there we have a working command line tool, now you can make something awesome. And also, with NPM you can publish your scripts to &lt;a href=&quot;https://www.npmjs.org/&quot;&gt;npmjs.org&lt;/a&gt; so other people (and yourself later) can install it with &lt;code&gt;npm install -g cmdtool&lt;/code&gt;. This will put your script in a “bin” and make it executable for you.&lt;/p&gt;
&lt;p&gt;I haven’t tried publishing to npm yet. But you basically just type &lt;code&gt;npm publish&lt;/code&gt; with some arguments and stuff in your package.json file. You can &lt;a href=&quot;https://www.npmjs.org/doc/cli/npm-publish.html&quot;&gt;read more about it here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;And if you make something cool, leave a comment!&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Trondheim Developer Conference 2014</title>
		<link href="https://andeers.com/trondheim-developer-conference-2014/"/>
		<updated>2014-11-04T00:00:00Z</updated>
		<id>https://andeers.com/trondheim-developer-conference-2014/</id>
		<content type="html">&lt;p&gt;Last week I attended Trondheim Developer Conference &lt;a href=&quot;http://twitter.com/search/#tdconf&quot;&gt;#tdconf&lt;/a&gt; in Trondheim. It was the first conference I have attended and I must say it was fun and inspiring. I really liked going, and it was a nice way to learn new stuff and see interesting people you usually only see on Twitter.&lt;/p&gt;
&lt;p&gt;The conference consisted of 5 venues with 8 talks on each during the day plus three talks for everyone. It was a long day with lots of talks, and here are some of my favorites.&lt;/p&gt;
&lt;h2&gt;The better parts&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://www.crockford.com/&quot;&gt;Douglas Crockford&lt;/a&gt; talked about the better parts of javascript and the new stuff in ECMAScript6.&lt;/p&gt;
&lt;h2&gt;Managing CSS Projects with ITCSS&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://csswizardry.com/&quot;&gt;Harry Roberts&lt;/a&gt; held the first talk about his new approach for managing CSS projects, ITCSS. To optimize CSS you should structure it in a way where low specificity comes first. Harry has written more about that in his article &lt;a href=&quot;http://csswizardry.com/2014/10/the-specificity-graph&quot;&gt;The Specificity Graph&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;How HTML5 missed its graduation day&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://christianheilmann.com/&quot;&gt;Christian Heilmann&lt;/a&gt; talked about HTML5 and that we should not be afraid to use it. People with old browsers who don’t support new features does not expect to get fancy awesome features and we should not try to create the same experience for everybody.&lt;/p&gt;
&lt;h2&gt;Designing with Sensors: Creating Adaptive Experiences&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://twitter.com/xgmedia&quot;&gt;Avi Itzkovitch&lt;/a&gt; talked about designing apps and user interfaces that uses sensors and data to adapt its behavior to the users needs. It was a very interesting talk about how we can use the data we have about the user to create a better experience.&lt;/p&gt;
&lt;h2&gt;SVG is for everyone&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://css-tricks.com/&quot;&gt;Chris Coyier&lt;/a&gt; talked about SVG, and it was one of the talks i was looking forward to upfront. SVG has a lot of advantages over icon fonts and regular images and i really look forward to try it on a project soon.&lt;/p&gt;
&lt;h2&gt;Hacking the Creative Brain&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://denisejacobs.com/&quot;&gt;Denise Jacobs&lt;/a&gt; talked about how developers are creative and how to trigger the creative parts of the brain.&lt;/p&gt;
&lt;p&gt;I had a good time and i look forward to next year, i also hope i get to go to some other conferences in the future as well.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Creating patches for Git</title>
		<link href="https://andeers.com/creating-patches-git/"/>
		<updated>2014-07-04T00:00:00Z</updated>
		<id>https://andeers.com/creating-patches-git/</id>
		<content type="html">&lt;p&gt;Today i had to fix some bugs in a contributed drupal module in a project i’m working on, and to make sure my changes was not lost in a module upgrade i created a patch for them, and here is how i did it.&lt;/p&gt;
&lt;h2&gt;What is a patch?&lt;/h2&gt;
&lt;p&gt;A patch is a single file which can contain modifications for multiple files. A patch can for example rename a variable in every file in your project.&lt;/p&gt;
&lt;h2&gt;How do i do it?&lt;/h2&gt;
&lt;p&gt;The first thing you have to do is to clone the branch you want to patch:&lt;br /&gt;
&lt;code&gt;git clone http://url.of.your.project.git&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;You don’t have to use git to create and apply patches, but here i use git.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Then you go into your repo:&lt;br /&gt;
&lt;code&gt;cd folder_name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Next you can create a new branch for your modifications (i don’t know if this is necessary):&lt;br /&gt;
&lt;code&gt;git branch my-awesome-patch&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Switch to the new branch:&lt;br /&gt;
&lt;code&gt;git checkout my-awesome-patch&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Now you are good to go, and can code away. When you are finished with your changes and are ready to create the patch, commit everything in your branch.&lt;br /&gt;
&lt;code&gt;git add --all&lt;/code&gt; (Only use this if you want to add every modification you’ve made).&lt;br /&gt;
&lt;code&gt;git commit -m &amp;quot;commit message&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you want to compare your changes against the original code you can type:&lt;br /&gt;
&lt;code&gt;git diff [branch-name]&lt;/code&gt; (The branch name is not the one you created but the existing one).&lt;/p&gt;
&lt;p&gt;When everything looks great you can create the patch file:&lt;br /&gt;
&lt;code&gt;git diff [branch name] &amp;gt; my-awesome-features.patch&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;And voila, you have a patch file with all your modifications.&lt;/p&gt;
&lt;h2&gt;How do i apply a patch?&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;git apply -v [patch-name.patch]&lt;/code&gt; (this will apply your changes).&lt;/p&gt;&lt;figure id=&quot;attachment_991&quot; style=&quot;width: 327px;&quot; class=&quot;wp-caption aligncenter&quot;&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2&gt;Why patches?&lt;/h2&gt;
&lt;p&gt;Drupal uses patches for when people want to fix bugs or add features to modules. I think this is mainly because drupal.org doesn’t have forking and pull requests.&lt;/p&gt;
&lt;p&gt;There are probably other uses for patches than this, maybe you want to fix some stuff from a development branch without merging in the whole branch.&lt;/p&gt;
&lt;p&gt;Patching is not something i have used very much, but it was easy to understand and it may come in handy some day.&lt;/p&gt;
&lt;/figure&gt;</content>
	</entry>
	
	<entry>
		<title>Configuring Varnish for WordPress</title>
		<link href="https://andeers.com/configuring-varnish-wordpress/"/>
		<updated>2014-05-08T00:00:00Z</updated>
		<id>https://andeers.com/configuring-varnish-wordpress/</id>
		<content type="html">&lt;p&gt;&lt;a href=&quot;https://www.varnish-cache.org/&quot; title=&quot;Varnish&quot;&gt;Varnish&lt;/a&gt; is a very effective caching software, it can cache every part of your WordPress site. But when you turn it on you loose some nice features of WordPress.&lt;/p&gt;
&lt;p&gt;Varnish works by sitting in front of your web server, and giving the visitor a cached version of your page if it has any, and only if there is no cached version available send the visitor to the web server.&lt;/p&gt;
&lt;p&gt;But without some configuration you can&#39;t access your admin area without going to the port your web server is listening (example.com:8080). The same for preview of posts.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; I don’t know everything about Varnish so something here may not be done in the recommended way. But for me it works.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note: If you just want the config scroll down to the bottom.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Step 1: default.vcl&lt;/h2&gt;
&lt;p&gt;Default.vcl is the configuration file for varnish, this is were you tell it what to do. This file is located in &lt;code&gt;/etc/varnish/default.vcl&lt;/code&gt;. By default it is just a large file with commented out functions.&lt;/p&gt;
&lt;p&gt;Since we want Varnish in front of the web server we must specify on what port our web server listens:&lt;/p&gt;
&lt;p&gt;backend default {
.host = &amp;quot;127.0.0.1&amp;quot;;
.port = &amp;quot;8082&amp;quot;;
}&lt;/p&gt;
&lt;p&gt;This tells Varnish that our web server is listening to port 8082.&lt;/p&gt;
&lt;h2&gt;Step 2: sub vcl_recv&lt;/h2&gt;
&lt;p&gt;Sub vcl_recv is a varnish function, it responds to incoming request. This is the function where most of the stuff goes. We start by adding the client ip-address so that WordPress can read the users real ip-address.&lt;/p&gt;
&lt;p&gt;remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;&lt;/p&gt;
&lt;p&gt;This is necessary if you use plugins such as &lt;a href=&quot;https://wordpress.org/plugins/limit-login-attempts/&quot;&gt;Limit Login Attempts&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This next step is important if you want to login to your site:&lt;/p&gt;
&lt;p&gt;if (req.url ~ &amp;quot;wp-(login|admin)&amp;quot; || req.url ~ &amp;quot;preview=true&amp;quot; || req.url ~ &amp;quot;xmlrpc.php&amp;quot;) {
return (pass);
}&lt;/p&gt;
&lt;p&gt;It also allows previews and xmlrpc requests.&lt;/p&gt;
&lt;p&gt;This snippet strips away cookies unless your logged in to WordPress:&lt;/p&gt;
&lt;p&gt;if (req.http.cookie) {
if (req.http.cookie ~ &amp;quot;(wordpress_|wp-settings-)&amp;quot;) {
return(pass);
} else {
unset req.http.cookie;
}
}&lt;/p&gt;
&lt;p&gt;This works great for me, since i’m the only one logging in, but if you have a blog where users log in you probably want something else.&lt;/p&gt;
&lt;p&gt;Then we unset cookies from files:&lt;/p&gt;
&lt;p&gt;if (req.url ~ &amp;quot;.(gif|jpg|jpeg|swf|css|js|flv|mp3|mp4|pdf|ico|png)(?.*|)$&amp;quot;) {
unset req.http.cookie;
}&lt;/p&gt;
&lt;p&gt;This way files are served without cookies which is good for speed.&lt;/p&gt;
&lt;p&gt;At last we strip every get-parameter:&lt;/p&gt;
&lt;p&gt;set req.url = regsub(req.url, &amp;quot;?.*$&amp;quot;, &amp;quot;&amp;quot;);&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Maybe you want to alter this if you need some get-parameters.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;That was everything in &lt;code&gt;sub vcl_recv&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Step 3: sub vcl_fetch&lt;/h2&gt;
&lt;p&gt;Vcl_fetch is a function that is called after a request is sent from the web server.&lt;/p&gt;
&lt;p&gt;First we check if the user went to admin or login areas:&lt;/p&gt;
&lt;p&gt;if ( (!(req.url ~ &amp;quot;(wp-(login|admin)|login)&amp;quot;)) || (req.request == &amp;quot;GET&amp;quot;) ) {
unset beresp.http.set-cookie;
set beresp.ttl = 1h;
}&lt;/p&gt;
&lt;p&gt;If the user did not go to admin areas, or the request is a get-request, we unset the cookies and tell varnish to keep this request cached for 1 hour.&lt;/p&gt;
&lt;p&gt;Next we tell Varnish how long it should cache files:&lt;/p&gt;
&lt;p&gt;if (req.url ~ &amp;quot;.(gif|jpg|jpeg|swf|css|js|flv|mp3|mp4|pdf|ico|png)(?.*|)$&amp;quot;) {
set beresp.ttl = 365d;
}&lt;/p&gt;
&lt;p&gt;My blog is fairly static, so i cache everything for a year. I’m not sure if that is the best way, but it works for me.&lt;/p&gt;
&lt;p&gt;And that’s all in &lt;code&gt;sub vcl_fetch&lt;/code&gt;. Now you are finished with the important part.&lt;/p&gt;
&lt;h2&gt;Step 4: sub vcl_deliver&lt;/h2&gt;
&lt;p&gt;sub vcl_deliver {
if (obj.hits &amp;gt; 0) {
set resp.http.X-Cache = &amp;quot;HIT&amp;quot;;
} else {
set resp.http.X-Cache = &amp;quot;MISS&amp;quot;;
}
}&lt;/p&gt;
&lt;p&gt;When Varnish delivers content to the user it also adds a header telling if it was cached (HIT) or not (MISS).&lt;/p&gt;
&lt;h2&gt;Wrapping things up.&lt;/h2&gt;
&lt;p&gt;If you followed my steps you should now have a working Varnish config for WordPress. And if you don’t want to go through the steps, here is the whole config:&lt;/p&gt;
&lt;p&gt;backend default {
.host = &amp;quot;127.0.0.1&amp;quot;;
.port = &amp;quot;8082&amp;quot;;
}&lt;/p&gt;
&lt;p&gt;sub vcl_recv {
if (req.http.host == &amp;quot;about.andeers.com&amp;quot;) {
set req.backend = aboutnode;
}&lt;/p&gt;
&lt;p&gt;remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;&lt;/p&gt;
&lt;p&gt;if (req.url ~ &amp;quot;.(gif|jpg|jpeg|swf|css|js|flv|mp3|mp4|pdf|ico|png)(?.&lt;em&gt;|)$&amp;quot;) {
unset req.http.cookie;
set req.url = regsub(req.url, &amp;quot;?.&lt;/em&gt;$&amp;quot;, &amp;quot;&amp;quot;);
}&lt;/p&gt;
&lt;p&gt;if (req.url ~ &amp;quot;?(utm_(campaign|medium|source|term)|adParams|client|cx|eid|fbid|feed|ref(id|src)?|v(er|iew))=&amp;quot;) {
set req.url = regsub(req.url, &amp;quot;?.*$&amp;quot;, &amp;quot;&amp;quot;);
}&lt;/p&gt;
&lt;p&gt;if (req.url ~ &amp;quot;wp-(login|admin)&amp;quot; || req.url ~ &amp;quot;preview=true&amp;quot; || req.url ~ &amp;quot;xmlrpc.php&amp;quot;) {
return (pass);
}&lt;/p&gt;
&lt;p&gt;if (req.http.cookie) {
if (req.http.cookie ~ &amp;quot;(wordpress_|wp-settings-)&amp;quot;) {
return(pass);
} else {
unset req.http.cookie;
}
}
}&lt;/p&gt;
&lt;p&gt;sub vcl_fetch {
if ( (!(req.url ~ &amp;quot;(wp-(login|admin)|login)&amp;quot;)) || (req.request == &amp;quot;GET&amp;quot;) ) {
unset beresp.http.set-cookie;
set beresp.ttl = 1h;
}&lt;/p&gt;
&lt;p&gt;if (req.url ~ &amp;quot;.(gif|jpg|jpeg|swf|css|js|flv|mp3|mp4|pdf|ico|png)(?.*|)$&amp;quot;) {
set beresp.ttl = 365d;
}
}&lt;/p&gt;
&lt;p&gt;sub vcl_deliver {
if (obj.hits &amp;gt; 0) {
set resp.http.X-Cache = &amp;quot;HIT&amp;quot;;
} else {
set resp.http.X-Cache = &amp;quot;MISS&amp;quot;;
}
}&lt;/p&gt;
&lt;p&gt;If you want to test your configuration for errors you can use this command:&lt;/p&gt;
&lt;p&gt;varnishd -C -f /etc/varnish/default.vcl&lt;/p&gt;
&lt;p&gt;If you have errors, this command will give you a error message and the corresponding line number. If everything is okay it will print a lot of code (the generated config).&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Featured image as background image</title>
		<link href="https://andeers.com/featured-image-background-image-wordpress/"/>
		<updated>2014-05-02T00:00:00Z</updated>
		<id>https://andeers.com/featured-image-background-image-wordpress/</id>
		<content type="html">&lt;p&gt;If you have a theme with the custom background image feature enabled it’s pretty easy to replace it with the featured image of your posts.&lt;/p&gt;
&lt;p&gt;First you need to add the &lt;code&gt;wp-head-callback&lt;/code&gt;-attribute to your &lt;code&gt;add_theme_support(&#39;custom-background&#39;)&lt;/code&gt;-function:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;add_theme_support( &#39;custom-background&#39;, array(
        &#39;wp-head-callback&#39; =&gt; &#39;change_custom_background_cb&#39;,
    ) );&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This tells WordPress to use our function “change_custom_background_cb” to output the image.&lt;/p&gt;
&lt;h2&gt;Switch to featured image&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;function change_custom_background_cb() {
    $background = get_background_image();
    $color = get_background_color();
    if (is_single()) {
      $image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), &#39;full&#39; );
      if (isset($image[0])) {
      $background = $image[0];
      }
    }

    if ( ! $background &amp;#038;&amp;#038; ! $color )
        return;

    $style = $color ? &quot;background-color: #$color;&quot; : &#39;&#39;;

    if ( $background ) {
        $image = &quot; background-image: url(&#39;$background&#39;);&quot;;

        $repeat = get_theme_mod( &#39;background_repeat&#39;, &#39;repeat&#39; );

        if ( ! in_array( $repeat, array( &#39;no-repeat&#39;, &#39;repeat-x&#39;, &#39;repeat-y&#39;, &#39;repeat&#39; ) ) )
            $repeat = &#39;repeat&#39;;

        $repeat = &quot; background-repeat: $repeat;&quot;;

        $position = get_theme_mod( &#39;background_position_x&#39;, &#39;left&#39; );

        if ( ! in_array( $position, array( &#39;center&#39;, &#39;right&#39;, &#39;left&#39; ) ) )
            $position = &#39;left&#39;;

        $position = &quot; background-position: top $position;&quot;;

        $attachment = get_theme_mod( &#39;background_attachment&#39;, &#39;scroll&#39; );

        if ( ! in_array( $attachment, array( &#39;fixed&#39;, &#39;scroll&#39; ) ) )
            $attachment = &#39;scroll&#39;;

        $attachment = &quot; background-attachment: $attachment;&quot;;

        $style .= $image . $repeat . $position; //  . $attachment
    }
?&gt;
&amp;LT;style type=&quot;text/css&quot;&amp;GT;
body.custom-background .site-header { &amp;LT;?php echo trim( $style ); ?&amp;GT; }
&amp;LT;/style&amp;GT;

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The important part here is the first lines (4-9); we check if it’s a single post and if that post has a featured image, and if it has we replace the regular background image.&lt;/p&gt;
&lt;p&gt;Another important part is the css line at the bottom. In my theme i use the background image on my header element, so if you want your image on another element you have to change this part: &lt;code&gt;body.custom-background .site-header&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The rest of the function configures the css snippet according to the settings on the custom background page.&lt;/p&gt;
&lt;p&gt;If you don’t want those there you can safely remove them and keep all the styling inside your css (but then you can’t change them from inside WordPress). &lt;a href=&quot;https://codex.wordpress.org/Custom_Backgrounds&quot;&gt;Read more about this at the WordPress Codex&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;What else can you do?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Have a folder of images? Display them randomly.&lt;/li&gt;
&lt;li&gt;Display different images based on the time of day.&lt;/li&gt;
&lt;li&gt;Or different images for different seasons.&lt;/li&gt;
&lt;li&gt;Be creative.&lt;/li&gt;
&lt;/ul&gt;
</content>
	</entry>
	
	<entry>
		<title>WordPress development with Vagrant</title>
		<link href="https://andeers.com/wordpress-development-vagrant/"/>
		<updated>2014-04-10T00:00:00Z</updated>
		<id>https://andeers.com/wordpress-development-vagrant/</id>
		<content type="html">&lt;p&gt;&lt;a href=&quot;http://www.vagrantup.com/&quot; title=&quot;Vagrant&quot;&gt;Vagrant&lt;/a&gt; is a tool for creating virtual development environments. It allows you to setup a environment with the OS you want and all the functionality you want without messing with your computer.&lt;/p&gt;
&lt;h2&gt;Why vagrant?&lt;/h2&gt;
&lt;p&gt;Up until recently i used &lt;a href=&quot;https://www.apachefriends.org/index.html&quot; title=&quot;XAMPP&quot;&gt;xampp&lt;/a&gt; on my mac to setup local sites. It works pretty good, but sometimes there were trouble like when some tools did not understand which php they should use (xampp or osx), and stuff like that. With vagrant everything happens inside a sandbox and your computer is left alone. You’re also more certain everything will work on your server if the development environment is the same.&lt;/p&gt;
&lt;p&gt;I really like that you can install everything from web servers to database engines and not risk messing with OSX (or Windows).&lt;/p&gt;
&lt;h2&gt;How does Vagrant work?&lt;/h2&gt;
&lt;p&gt;Vagrant installs a operating system and executes a file containing commands &lt;code&gt;bootstrap.sh&lt;/code&gt;. Inside this file you can tell Vagrant to install Apache, MySql, PHP, Node.js, Git and so on.&lt;/p&gt;
&lt;p&gt;You can remove your virtual machine by typing &lt;code&gt;vagrant destroy&lt;/code&gt;, or temporary disable it by typing &lt;code&gt;vagrant halt&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Want to try it?&lt;/h2&gt;
&lt;p&gt;I have created a &lt;a href=&quot;https://github.com/andeersg/simple-wordpress-vagrant&quot; title=&quot;Simple WordPress Vagrant&quot;&gt;repo at Github with my setup&lt;/a&gt;, check it out and try for yourself. This vagrant installs Ubuntu 12.04, nginx, Mysql, PHP, Git, Node.js (with Grunt and Gulp), and WordPress 3.8.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Atom.io</title>
		<link href="https://andeers.com/atom-io/"/>
		<updated>2014-03-11T00:00:00Z</updated>
		<id>https://andeers.com/atom-io/</id>
		<content type="html">&lt;p&gt;Github just released a beta version of their new editor Atom, and i must say it looks good.&lt;/p&gt;
&lt;p&gt;It has a very clean user interface, and i must say i like what i see.&lt;/p&gt;&lt;figure id=&quot;attachment_881&quot; style=&quot;width: 640px;&quot; class=&quot;wp-caption alignnone&quot;&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://andeers.com/wp-content/uploads/2014/03/atomedior.png&quot; alt=&quot;Atom editor displaying functions.php&quot; width=&quot;640&quot; height=&quot;378&quot; class=&quot;size-full wp-image-881&quot; /&gt;&lt;/p&gt;&lt;figcaption class=&quot;wp-caption-text&quot;&gt;Atom editor displaying functions.php&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The editor is highly flexible with loads of packages you can download. A package can be a theme for the editor or new features and functions. A couple of packages highlighted on the atom.io site:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://atom.io/packages/color-picker&quot;&gt;Color picker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://atom.io/packages/atom-jshint&quot;&gt;JSHint&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Another small feature i like is that if your working on files inside a git repository, it displays the current branch, and how many lines changed from whats currently in git.&lt;/p&gt;&lt;figure id=&quot;attachment_888&quot; style=&quot;width: 340px;&quot; class=&quot;wp-caption center&quot;&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://andeers.com/wp-content/uploads/2014/03/git-diff-atom.gif&quot; alt=&quot;Atom displaying current branch and diffs.&quot; width=&quot;340&quot; height=&quot;61&quot; class=&quot;size-full wp-image-888&quot; /&gt;&lt;/p&gt;&lt;figcaption class=&quot;wp-caption-text&quot;&gt;Atom displaying current branch and diffs.&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The editor also have a shortcut &lt;code&gt;cmd+shift+p&lt;/code&gt; which opens a search-form that allows you to search in every function available.&lt;/p&gt;
&lt;p&gt;For example if your writing markdown you can search for a function that gives you a preview:&lt;/p&gt;
&lt;figure id=&quot;attachment_895&quot; style=&quot;width: 497px;&quot; class=&quot;wp-caption aligncenter&quot;&gt;&lt;img src=&quot;https://andeers.com/wp-content/uploads/2014/03/atom-search.gif&quot; alt=&quot;Search for whatever function you like.&quot; width=&quot;497&quot; height=&quot;375&quot; class=&quot;size-full wp-image-895&quot; /&gt;&lt;figcaption class=&quot;wp-caption-text&quot;&gt;Search for whatever function you like.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2&gt;My impression so far&lt;/h2&gt;
&lt;p&gt;I like the possibilities and that there are lots of customization and plugins for it. The one thing i miss most from &lt;a href=&quot;https://panic.com/coda&quot;&gt;Coda&lt;/a&gt; is the built-in SFTP-file manager, i love being able to open remote files from inside the editor and not have to use another program for that.&lt;/p&gt;
&lt;p&gt;I don’t think it has any killer features that would instantly make me switch from Coda, but it’s a great editor and i will absolutely recommend it, you can apply for beta access at &lt;a href=&quot;https://atom.io/&quot;&gt;Atom.io&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Grunt &amp;#8211; The JavaScript task runner</title>
		<link href="https://andeers.com/grunt-javascript-task-runner/"/>
		<updated>2014-02-08T00:00:00Z</updated>
		<id>https://andeers.com/grunt-javascript-task-runner/</id>
		<content type="html">&lt;p&gt;Grunt is a command line tool that’s running tasks for you. It can automate all the things you have to do manually (at least many of them).&lt;/p&gt;
&lt;p&gt;You can for example make it compile your SASS-files, check your JavaScript syntax, combine the JS-files and minify them with &lt;strong&gt;one&lt;/strong&gt; command.&lt;/p&gt;
&lt;h2&gt;What is Grunt really?&lt;/h2&gt;
&lt;p&gt;In itself Grunt does nothing, you have to add plugins to actually do stuff. Right now there are over 2000 plugins at &lt;a href=&quot;http://gruntjs.com/plugins&quot;&gt;GruntJS.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You have a file where you define the plugins you want to use, which folders they should work on and what you want them to do. You can define multiple environments and have the plugin to different things.&lt;/p&gt;
&lt;h2&gt;My configuration&lt;/h2&gt;
&lt;p&gt;I have structured my Grunt tasks for web development and i have plugins for Compass(SASS), validating JS, merging JS-files, minifying JS and optimizing images. I also use a plugin called Grunt Watch that watches my files and run the tasks when files are changed, something like “compass watch” only it works for all the files.&lt;/p&gt;
&lt;p&gt;When i have this setup i can work in smaller files and keep my development environment organized. As i work Grunt compiles my css and javascript-files and optimizes my images.&lt;/p&gt;
&lt;h2&gt;Alternatives&lt;/h2&gt;
&lt;p&gt;Until now have i used &lt;a href=&quot;https://incident57.com/codekit/&quot;&gt;CodeKit&lt;/a&gt;, a Mac desktop app that does most of the tasks i have described here. CodeKit monitors folders and can merge JavaScript, CSS and check JS-files for syntax errors. I like CodeKit very much, but it was annoying that i could not use it on remote servers.&lt;/p&gt;
&lt;p&gt;Recently another JavaScript task runner has appeared, it is called &lt;a href=&quot;http://gulpjs.com/&quot;&gt;gulp.js&lt;/a&gt; and is supposed to be much faster than Grunt. I have not tried gulp.js yet, so i cannot say to much about it, but it looks cool and i’m going to check it out.&lt;/p&gt;
&lt;h2&gt;Example&lt;/h2&gt;
&lt;p&gt;Here is a part of my Gruntfile.js (the file you define what tasks you want to execute):&lt;/p&gt;
&lt;p&gt;module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON(&#39;package.json&#39;),
concat: {
options: {
separator: &#39;;&#39;
},
dist: {
src: [&#39;dev/js/&lt;em&gt;.js&#39;],
dest: &#39;assets/js/script.min.js&#39;
}
},
uglify: {
options: {
banner: &#39;/&lt;/em&gt;! &amp;lt;%= pkg.name %&amp;gt; &amp;lt;%= grunt.template.today(&amp;quot;dd-mm-yyyy&amp;quot;) %&amp;gt; &lt;em&gt;/&#92;n&#39;
},
dist: {
files: {
&#39;assets/js/script.min.js&#39;: [&#39;&amp;lt;%= concat.dist.dest %&amp;gt;&#39;]
}
}
},
jshint: {
files: [&#39;Gruntfile.js&#39;, &#39;dev/js/&lt;/em&gt;.js&#39;],
options: {
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
}
});&lt;/p&gt;
&lt;p&gt;grunt.loadNpmTasks(&#39;grunt-contrib-uglify&#39;);
grunt.loadNpmTasks(&#39;grunt-contrib-jshint&#39;);
grunt.loadNpmTasks(&#39;grunt-contrib-concat&#39;);&lt;/p&gt;
&lt;p&gt;grunt.registerTask(&#39;default&#39;, [&#39;jshint&#39;, &#39;concat&#39;, &#39;uglify&#39;]);&lt;/p&gt;
&lt;p&gt;};&lt;/p&gt;
&lt;p&gt;In this file i have defined what plugins to use, i have registered the default task (what happens when you write “grunt” in the terminal), and i have told the different plugins where my files are and what i want them to do.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Moving my blog to DigitalOcean</title>
		<link href="https://andeers.com/moving-to-digitalocean/"/>
		<updated>2014-01-08T00:00:00Z</updated>
		<id>https://andeers.com/moving-to-digitalocean/</id>
		<content type="html">&lt;p&gt;I have been looking for another host for my blog for some time now, and in december i found DigitalOcean. I decided to move my blog there yesterday.&lt;span style=&quot;line-height: 1.5em;&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;DigitalOcean&lt;/h2&gt;
&lt;p&gt;With DigitalOcean you get a server, a linux OS and then you are on your own. Luckily for people without server knowledge (me) they also have lots of guides for setting up various things. I spent my Christmas holiday configuring and trying different things before i decided to move it. Previously i had my blog on a Norwegian host which i found very limiting, i did not have ssh access and could not use tools such as Compass, Git or Node.js. This blog is now running on Nginx with Varnish in front of it. I have also experimentet with node.js, and have set up a Ghost blog.&lt;/p&gt;
&lt;h2&gt;WordPress&lt;/h2&gt;
&lt;p&gt;I choose nginx for my wordpress blog mostly because i was curious and wanted to test it. This blog does not have so much traffic so i don’t think it was necessary for the user experience. But i like trying new stuff, and if nginx is faster than Apache there probably won’t be any large downsides (i hope).&lt;/p&gt;
&lt;h2&gt;Ghost&lt;/h2&gt;
&lt;p&gt;Ghost is a new blogging platform created by &lt;a href=&quot;http://john.onolan.org/&quot; title=&quot;John O&#39;Nolan&quot;&gt;John O’Nolan&lt;/a&gt;, it’s a very minimalistic blogging platform stripped of everything but the essentials for writing. You write your posts with markdown and you have a live preview on your right side.&lt;/p&gt;
&lt;p&gt;I must say i like messing around with the terminal and editing config files, so i think there may come  some posts about servers and setting up various stuff.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Getting started with Backbone.js</title>
		<link href="https://andeers.com/getting-started-with-backbone-js/"/>
		<updated>2013-12-12T00:00:00Z</updated>
		<id>https://andeers.com/getting-started-with-backbone-js/</id>
		<content type="html">&lt;p&gt;I have wanted to look at JavaScript frameworks for some time now. I like the idea to only send JSON data from the server and let the client do the rest. But there is a jungle of frameworks, so it is hard to get information about which one you should choose.&lt;/p&gt;
&lt;p&gt;I started on a small project for a client at work where they wanted to list courses and let people sign up. It was going to be a one-page application with courses listed on the left and the selected course on the right. This page is built with Drupal and my usual way of solving this would be to create all the markup with PHP and output it. Then i would use jQuery to switch between courses and do stuff. It was also important that you could link to a single course, so this would mean GET-variables or something.&lt;/p&gt;
&lt;p&gt;I have been using sites like &lt;a href=&quot;https://www.wunderlist.com/en/&quot; title=&quot;Wunderlist&quot;&gt;Wunderlist&lt;/a&gt; and &lt;a href=&quot;http://godt.no/&quot; title=&quot;Godt.no&quot;&gt;Godt.no&lt;/a&gt; (Norwegian site) and i like how they work. Both use Backbone.js. So because of this i choose Backbone.js for my project. With Backbone.js i can have templates for the project and it has built-in router functionality with hash-urls (and pushState when older browsers no longer needs to be supported).&lt;/p&gt;
&lt;p&gt;When i started with Backbone.js i took a look at the &lt;a href=&quot;http://todomvc.com/&quot; title=&quot;TodoMVC&quot;&gt;TodoMVC project&lt;/a&gt;. They have lots of example apps written with lots of frameworks. It’s a good resource for lots of JavaScript frameworks. My first thoughts when looking at Backbone code was that it was very cryptic and hard to understand. It took a while do dissect the code and understand the different parts.&lt;/p&gt;
&lt;p&gt;I learned that the best way to understand it (for me) was to break down the examples, modify them and create small projects. For me this works way better than reading the documentation (but i think the documentation is important for reference).&lt;/p&gt;
&lt;p&gt;I plan to write about the different parts of a Backbone application here on my blog. The first one will be about the “model”.&lt;/p&gt;
&lt;h2&gt;Further reading&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://backbonejs.org/&quot; title=&quot;Backbone Documentation&quot;&gt;Backbonejs.org&lt;/a&gt; – Documentation&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://todomvc.com/&quot; title=&quot;TodoMVC&quot;&gt;TodoMVC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://coenraets.org/blog/2011/12/backbone-js-wine-cellar-tutorial-part-1-getting-started/&quot; title=&quot;Backbone Wine Cellar Tutorial&quot;&gt;Backbone tutorial by Christophe Coenraets&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
	</entry>
	
	<entry>
		<title>A new blog theme</title>
		<link href="https://andeers.com/a-new-blog-theme/"/>
		<updated>2013-11-13T00:00:00Z</updated>
		<id>https://andeers.com/a-new-blog-theme/</id>
		<content type="html">&lt;p&gt;Today i changed my blog theme to a new theme i have created. It’s a theme heavily inspired by &lt;a href=&quot;http://inside.envato.com/&quot; title=&quot;Inside Envato&quot;&gt;Inside Envato&lt;/a&gt; and &lt;a href=&quot;https://bensmann.no/&quot; title=&quot;Bensmann.no&quot;&gt;Bensmann.no&lt;/a&gt;. It’s a work in progress, and changes will come.&lt;/p&gt;
&lt;p&gt;I’m also trying something new by writing in english. I want to do this to improve my writing skills and also get a potentially greater audience.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>iOS7 &amp;#8211; et førsteinntrykk</title>
		<link href="https://andeers.com/ios7-et-forsteinntrykk/"/>
		<updated>2013-06-11T00:00:00Z</updated>
		<id>https://andeers.com/ios7-et-forsteinntrykk/</id>
		<content type="html">&lt;p&gt;I går lanserte Apple &lt;strong&gt;iOS7&lt;/strong&gt; på sin WWDC-konferanse. Et operativsystem det ble sagt at skulle være det største som har skjedd med iPhone siden iPhone ble lansert. Min mening er at det stemmer. Det har blitt en helt annen telefon, og foreløpig liker jeg det jeg ser.&lt;/p&gt;
&lt;p&gt;De har redesignet alt fra låseskjermen, til menyene, animasjonene og ikonene.&lt;/p&gt;
&lt;h2&gt;Ikonene&lt;/h2&gt;
&lt;p&gt;Alle appene til Apple har fått oppdaterte ikoner med et mye “flatere” design enn tidligere. Personlig syns jeg det fungerer på enkelte av appene, mens på andre ser det ikke så bra ut.&lt;/p&gt;
&lt;p&gt;Mine favoritter er: &lt;span style=&quot;line-height: 13px;&quot;&gt;Kalender, &lt;/span&gt;Kalkulator, Passbook og Musikk. Og de verste syns jeg er Game Center og Safari.&lt;/p&gt;
&lt;img class=&quot;aligncenter size-full wp-image-798&quot; alt=&quot;iOS7 Ikon&quot; src=&quot;https://andeers.com/wp-content/uploads/2013/06/icons.png&quot; width=&quot;411&quot; height=&quot;130&quot; /&gt;
&lt;h2&gt;Kontrollsenter&lt;/h2&gt;
&lt;p&gt;Kanskje den enkelt-tingen jeg syns er mest kjekk foreløpig. Bare ved å dra fingeren opp fra bunnen av skjermen får jeg opp et panel som gir meg tilgang til de fleste innstillinger jeg måtte ha behov for å endre kjapt.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;line-height: 13px;&quot;&gt;Lysstyrke.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Wifi, Bluetooth, Flymodus, stillemodus og låsing av skjermrotasjon.&lt;/li&gt;
&lt;li&gt;Lommelykt, kalkulator, kamera og klokke.&lt;/li&gt;
&lt;li&gt;AirDrop&lt;/li&gt;
&lt;li&gt;Musikkspiller&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Mange av disse elementene måtte man inn i innstillinger, inn på et par undermenyer før man kunne slå de av og på før.&lt;/p&gt;
&lt;h3&gt;Foreløpige bugs&lt;/h3&gt;
&lt;p&gt;Har faktisk oppdaget svært få bugs med tanke på at det er en beta det er snakk om:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;line-height: 13px;&quot;&gt;Endel animasjoner hakker litt innimellom.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Apper som krasjer(hendt ca. 3-4 ganger).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;****Tilgang til iOS7 beta&lt;/h2&gt;
&lt;p&gt;Ønsker du også å teste iOS7 beta, må du gå til &lt;a href=&quot;http://developer.apple.com/&quot; title=&quot;Developer.apple.com&quot;&gt;Apple sine utviklingssider&lt;/a&gt; og registrere deg som utvikler.&lt;/p&gt;
&lt;p&gt;Har du testet iOS7? Hva syns du?&lt;/p&gt;
&lt;h2&gt;Oppdatering&lt;/h2&gt;
&lt;p&gt;De siste dagene har jeg lagt merke til en kjekk liten ting. Når noen skriver til meg, sender meg en epost eller noe annet med push-varsler så vises det som vanlig på skjermen til jeg låser opp telefonen.&lt;/p&gt;
&lt;p&gt;Om jeg åpner eposten/facebook-chatten på pcen, forsvinner varslet på mobilen med en gang. Liten detalj, men veldig kjekk.&lt;/p&gt;
&lt;p&gt;Har også inntrykk av at batteritiden er litt bedre, men det har jeg ikke fått undersøkt nok enda.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Angrep mot WordPress</title>
		<link href="https://andeers.com/angrep-mot-wordpress/"/>
		<updated>2013-04-18T00:00:00Z</updated>
		<id>https://andeers.com/angrep-mot-wordpress/</id>
		<content type="html">&lt;p&gt;I det siste har det vært flere artikler om store angrep mot WordPress-installasjoner. Derfor er det veldig viktig å ta noen forhåndsregler sånn at din WordPress er sikker.&lt;/p&gt;
&lt;p&gt;Angrepene prøver brukernavnet “admin” sammen med veldig mange passord. “admin” er et brukernavn veldig mange har satt som standard og derfor er det dette angrepet prøver på.&lt;/p&gt;
&lt;h2&gt;Har du “admin” som brukernavn?&lt;/h2&gt;
&lt;p&gt;Ta det med ro, det er ikke vanskelig å løse dette problemet.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;line-height: 13px;&quot;&gt;Opprett en ny bruker med det brukernavnet du ønsker (Sørg for at den nye brukeren har administrator-rettigheter).&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Logg inn med den nye brukeren og slett den gamle.&lt;/li&gt;
&lt;li&gt;Da vil du få et spørsmål om hva du vil gjøre med postene til den gamle brukeren, du kan enten overføre de til den nye brukeren eller slette de.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Da skal du ha fått deg en ny bruker med alle dine gamle innlegg.&lt;/p&gt;
&lt;h2&gt;Andre måter for å forhindre angrep mot WordPress&lt;/h2&gt;
&lt;p&gt;Jeg bruker alltid å legge inn &lt;a href=&quot;http://wordpress.org/extend/plugins/limit-login-attempts/&quot; title=&quot;Limit Login Attempts&quot;&gt;Limit Login Attempts&lt;/a&gt; når jeg setter opp en WordPress-side. Den blokkerer brukere som prøver å logge inn for mange ganger på kort tid. Standardinnstillingen er at 4 feilaktige innlogginger fører til en “lockout”.&lt;/p&gt;
&lt;p&gt;Til nå er det 1367 lockouts på denne siden. Man får også se en lang liste med IP-adressene som har prøvd og med hvilket brukernavn de har brukt. I listen min ser jeg at &lt;strong&gt;admin&lt;/strong&gt; er en gjenganger, over 90% av forsøkene er gjort med admin som brukernavn.&lt;/p&gt;
&lt;p&gt;En annen plugin jeg har begynt å ta i bruk er &lt;a href=&quot;http://wordpress.org/extend/plugins/google-authenticator/&quot; title=&quot;Google Authenticator&quot;&gt;Google Authenticator&lt;/a&gt;. Denne gjør at du må oppgi en kode i tillegg til brukernavn og passord når du logger på siden din. Koden får du via en app Google har laget, denne er tilgjengelig til iOs, Android og Blackberry. Dette fungerer på samme vis som bankID, koden er kun gyldig i ca 1 minutt. Dermed har det blitt veldig vanskelig for en person som prøver å bryte seg inn, selv om de har passordet ditt må de også ha telefonen din.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Nyheter i WordPress 3.6</title>
		<link href="https://andeers.com/nyheter-i-wordpress-3-6/"/>
		<updated>2013-04-15T00:00:00Z</updated>
		<id>https://andeers.com/nyheter-i-wordpress-3-6/</id>
		<content type="html">&lt;p&gt;WordPress 3.6 har blitt tilgjengelig i betaversjon, og har man lyst kan man allerede nå teste den ut ved å aktivere &lt;a href=&quot;http://wordpress.org/extend/plugins/wordpress-beta-tester/&quot; title=&quot;WordPress Beta Tester&quot;&gt;WordPress Beta Tester&lt;/a&gt;. Da får du mulighet til å laste ned de aller nyeste versjonene av WordPress. NB: Det er ikke anbefalt å gjøre dette på en produksjonsside da det er større sjangse for at det forekommer bugs.&lt;/p&gt;
&lt;h2&gt;Hva er nytt?&lt;/h2&gt;
&lt;p&gt;En av de største forandringene jeg la merke til er at “Post Formats” har fått et helt eget grensesnitt på sidene hvor man skriver innhold.&lt;/p&gt;&lt;figure id=&quot;attachment_785&quot; style=&quot;width: 510px;&quot; class=&quot;wp-caption aligncenter&quot;&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2013/04/Skjermbilde-2013-04-10-kl.-14.04.40.png&quot;&gt;&lt;img class=&quot;size-full wp-image-785 &quot; title=&quot;Nytt grensesnitt i WordPress 3.6&quot; alt=&quot;Post format UI i WordPress 3.6&quot; src=&quot;https://andeers.com/wp-content/uploads/2013/04/Skjermbilde-2013-04-10-kl.-14.04.40.png&quot; width=&quot;510&quot; height=&quot;161&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;figcaption class=&quot;wp-caption-text&quot;&gt;Nytt grensesnitt for å velge format.&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Det som også skjer når man velger foreksempel “Sitat” er at man får frem felter som passer til formatet. Det kommer:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Felt for sitat&lt;/li&gt;
&lt;li&gt;Sitatkilde&lt;/li&gt;
&lt;li&gt;Lenkefelt til kilde&lt;/li&gt;
&lt;li&gt;Også er det vanlige tekstfeltet tilgjengelig&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Dette vil gjøre det veldig mye enklere å for brukerne å ta i bruk formatene. For bilde-innlegg, galleri-innlegg, video og lyd-innlegg får man frem felt for å laste opp mediefiler eller lime inn url eller “embed”-kode.&lt;/p&gt;
&lt;h2&gt;Andre nyheter i WordPress 3.6&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;line-height: 13px;&quot;&gt;Innhold du skriver på lagres lokalt.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Du vår varsel om noen redigerer en post du er inne i, med mulighet til å kaste de ut av den.&lt;/li&gt;
&lt;li&gt;Grensesnittet på meny-innstillingene har blitt litt annerledes.&lt;/li&gt;
&lt;li&gt;Bedre håndtering av innholdsversjoner.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Mitt førsteinntrykk&lt;/h2&gt;
&lt;p&gt;Jeg må si jeg likte veldig godt at de har laget et grensesnitt for de forskjellige post-formatene. Jeg har klødd meg mye i hodet og lurt på hvordan jeg best mulig skal løse implementeringen av en “lenke-post” før, nå har det kommet dedikerte felter. Det at innlegg man skriver på lagres lokalt er ikke noe man tenker så mye over, men det er nok kjekt den dagen noe skjer og man ikke fikk lagret.&lt;/p&gt;
&lt;p&gt;Det er mye spennende som skjer med WordPress og jeg gleder meg bare til å se hvilke nye funksjoner som kommer etterhvert.&lt;/p&gt;
&lt;p&gt;Har du testet WordPress 3.6? Hva syns du? Liker du de nye grensesnittene?&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Mailboxapp &amp;#8211; skaper liv rundt lanseringen</title>
		<link href="https://andeers.com/mailboxapp-skaper-liv-rundt-lanseringen/"/>
		<updated>2013-02-11T00:00:00Z</updated>
		<id>https://andeers.com/mailboxapp-skaper-liv-rundt-lanseringen/</id>
		<content type="html">&lt;p&gt;For noen dager siden ble Mailboxapp tilgjengelig på &lt;a href=&quot;https://itunes.apple.com/us/app/mailbox/id576502633?mt=8&quot; title=&quot;Mailboxapp&quot;&gt;App Store&lt;/a&gt;, og i løpet av de første timene appen var tilgjengelig fikk den veldig mye omtale og oppmerksomhet.&lt;br /&gt;
Mye av oppmerksomheten kom av den noe spesielle måten de valgte å gi tilgang på. Før lansering kunne man oppgi telefonnummer og sette seg på venteliste. Når lanseringen kom fikk man tilgang til appen etter rekkefølgen man meldte seg på ventelisten.&lt;/p&gt;
&lt;p&gt;Når jeg åpna appen lå jeg ca på plass nr. 170.000, nå i dag 5 dager senere ligger jeg på plass 103.800. Det som var mer spennende å se var hvor kjapt telleren på hvor mange som lå bak i køen økte, i løpet av disse 5 dagene har den gått fra 150.000 til over 630.000.&lt;/p&gt;
&lt;p&gt;De har helt sikkert fått veldig mange nedlastninger etter omtalen i helga(det ser man på telleren), men personlig tror at de har overdrevet ventetiden betraktelig. Jeg tror mange kommer til å slette appen eller glemme den. Jeg må si selv at ikke er så veldig motiverende å sjekke appen nå og se at det fremdeles er over 100.000 foran meg.&lt;/p&gt;
&lt;p&gt;Men, det skal mailboxapp ha, de har klart å skape blest rundt appen sin. Nå gjenstår det bare å se hvor mange som faktisk vil bruke den.&lt;/p&gt;
&lt;p&gt;Hva tror du? Har du fått tilgang til mailboxapp, hva syns du?&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Facebook Graph Search</title>
		<link href="https://andeers.com/facebook-graph-search/"/>
		<updated>2013-01-24T00:00:00Z</updated>
		<id>https://andeers.com/facebook-graph-search/</id>
		<content type="html">&lt;h2&gt;Det skumle Graph Search&lt;/h2&gt;
&lt;ol start=&quot;15&quot;&gt;
&lt;li&gt;Januar lanserte Facebook sin nye funksjon &lt;strong&gt;Graph Search&lt;/strong&gt;, og sånn som alltid når Facebook gjør endringer eller kommer med noe nytt begynner folk å klage.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Denne gangen er det snakk om at Facebook gjør data om deg tilgjengelig for alle og flere aviser har dratt frem eksempler på folk som blir hengt ut med at de “liker voldtekt”, “unge jenter med store bryster” også videre.&lt;/p&gt;
&lt;p&gt;Det man ikke tenker over er at dette er sider man aktivt har likt og som er offentlig tilgjengelig. For dette nye søket gjør ingenting nytt med personvernet. Det er bare en ny måte å vise informasjon som allerede er tilgjenglig på profilen din.&lt;/p&gt;
&lt;p&gt;Dette betyr:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;line-height: 13px;&quot;&gt;Har du bilder kun venner kan se, kan kun venner av deg få opp disse bildene i søk.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Har du offentliggjort bostedet ditt, kan du komme opp i søk over hvem som bor på det aktuelle stedet.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Hva kan man gjøre?&lt;/h2&gt;
&lt;p&gt;Det første du bør gjøre er å gå på din egen profil, klikke på tannhjulet under coverbildet og velge “Vis som …”. Da får du se din egen profil som en ikke-venn. Ser du at for mange ting om deg er synlig bør du ta en gjennomgang av sikkerhetsinnstillingene på profilen din. Og, er du redd for at du skal dukke opp i sjenerende søk bør du ta en gjennomgang av hva du har likt opp gjennom årene og kanskje vurdere å “unlike” useriøse ting.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>jQuery og Google Analytics for å spore klikk</title>
		<link href="https://andeers.com/jquery-og-google-analytics-for-a-spore-klikk/"/>
		<updated>2013-01-06T00:00:00Z</updated>
		<id>https://andeers.com/jquery-og-google-analytics-for-a-spore-klikk/</id>
		<content type="html">&lt;p&gt;Har du lenker eller knapper som kjører AJAX-innhold kan det være kjekt å spore hvor mange som klikker på elementene. Det kan hende du er nysgjerrig på hvor mange som klikker på logoen din kontra HJEM-knappen. Ved å bruke Google Analytics kan du sette opp at klikk på disse elementene skal spores. Dermed kan du se hvor mange klikk logoen din får og hvor mange klikk hjem-knappen har fått. Dermed kan du finne ut hva brukerne foretrekker og om det er poeng å ha en hjem-knapp.&lt;/p&gt;
&lt;h2&gt;Google Analytics Event Tracking&lt;/h2&gt;
&lt;p&gt;For å spore klikk brukes en kode som ser ca sånn ut:&lt;br /&gt;
&lt;code&gt;_gaq.push([&#39;_trackEvent&#39;, &#39;Kategori&#39;, &#39;Hendelse&#39;, &#39;Tittel&#39;]);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;“Kategori” er en samlebetegnelse for flere “Hendelser”. Disse to er obligatoriske og må være med for at det skal fungere. I tillegg er det mulig å sette en Tittel, dette kan for eksempel være målet om det er lenker man sporer.&lt;/p&gt;
&lt;p&gt;I eksempelet med HJEM-knappen vil da kodene se sånn ut f.eks:&lt;br /&gt;
&lt;code&gt;_gaq.push([&#39;_trackEvent&#39;, &#39;Hjemlenke&#39;, &#39;Logo&#39;]);&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;_gaq.push([&#39;_trackEvent&#39;, &#39;Hjemlenke&#39;, &#39;Menyelement&#39;]);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Da vil du etter hvert få opp statistikk i Google Analytics om hvor mange som har klikket på de forskjellige lenkene.&lt;/p&gt;
&lt;p&gt;Google plasserer disse kodene i et onClick-element på lenkene i &lt;a href=&quot;https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide&quot; title=&quot;Google Analytics Event Tracking&quot;&gt;sin dokumentasjon&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;jQuery&lt;/h2&gt;
&lt;p&gt;Ved å bruke jQuery til dette vil du få en mye mer oversiktlig kode, pluss at du slipper å redigere html-koden.&lt;/p&gt;
&lt;p&gt;For å spore klikk på logoen kan du da bruke denne koden:&lt;/p&gt;
&lt;pre rel=&quot;jQuery&quot;&gt;&lt;code&gt;$(&#39;#logo&#39;).click(function(){
_gaq.push([&#39;_trackEvent&#39;, &#39;Hjemlenke&#39;, &#39;Logo&#39;]);
});
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I dette tilfellet er IDen til logoen “logo”. Denne koden kan du ha i &lt;code&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;/code&gt;-seksjonen eller i en ekstern javascript-fil. Dermed får du en ryddig kode og du får samlet alle tracking-kodene på en plass.&lt;/p&gt;
&lt;p&gt;jQuery og denne sporingskoden er en veldig kraftig kombinasjon, du kan spore alt mulig.&lt;/p&gt;
&lt;h3&gt;Forslag til sporing:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Hva en bruker velger i en nedtrekksliste.&lt;/li&gt;
&lt;li&gt;Hvor mange som flytter musa over logoen (&lt;code&gt;$.mouseover&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Eller alt annet du måtte føle for å vite om og som du kan bruke jQuery på.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Bruker du Google Analytics på en lur måte? Fortell gjerne om det i kommentarfeltet.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Nyttige Google Analytics widgets</title>
		<link href="https://andeers.com/nyttige-google-analytics-widgets/"/>
		<updated>2012-11-19T00:00:00Z</updated>
		<id>https://andeers.com/nyttige-google-analytics-widgets/</id>
		<content type="html">&lt;p&gt;Google Analytics kommer med veldig gode widgets som standard, men man kan sette opp egne widgets som kan gi enda fyldigere informasjon om de besøkende. I dette blogginnlegget har jeg tenkt å dele noen jeg bruker.&lt;/p&gt;
&lt;p&gt;For å lage egne widgets til Google Analytics må man trykke på fanen Startside (Home på engelsk) også trykke på “Ny oversikt” i venstremenyen. I vinduet som dukker opp velger du “Tomt lerret”, gir det et navn og trykker “Opprett oversiktspanel”.&lt;/p&gt;
&lt;img class=&quot;aligncenter size-large wp-image-740&quot; title=&quot;google-analytics-new&quot; src=&quot;https://andeers.com/wp-content/uploads/2012/11/google-analytics-new1.png&quot; alt=&quot;Nytt lerret - Google Analytics&quot; width=&quot;570&quot; height=&quot;174&quot; /&gt;
&lt;p&gt;Om du valgte “Tomt lerret” vil du automatisk få opp vinduet for å legge til en ny modul på siden.&lt;!--more--&gt;&lt;/p&gt;
&lt;h2&gt;Oversikt over mobilbesøkende&lt;/h2&gt;
&lt;p&gt;For å lage en pen oversikt over mobil-besøkende på siden din gjør du følgende:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Velg “Tabell”.&lt;/li&gt;
&lt;li&gt;For første kolonne velger du “Mobil (innebefattet nettbrett)”.&lt;/li&gt;
&lt;li&gt;I andre kolonne velger du “Besøk” eller “Unike besøkende”.&lt;/li&gt;
&lt;li&gt;Du kan legge til en tredje kolonne med foreksempel “Sidevisninger”.&lt;/li&gt;
&lt;li&gt;Videre velger du hvor mange resultater du vil vise.&lt;/li&gt;
&lt;li&gt;Til slutt er det bare å sette en tittel og lagre.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I punkt 3 og 4 kan du velge andre kriterier etter hva du ønsker å se, unike besøkende er viktigere enn sidevisninger. Du får mer ut av å vite at det har vært 30 personer innom siden din, enn at en person har oppdatert siden din 365 ganger på mobil.&lt;/p&gt;
&lt;h2&gt;Oversikt over skjermoppløsninger&lt;/h2&gt;
&lt;p&gt;Å vite hvilke skjermoppløsninger dine besøkende bruker kan være nyttig for utviklingen av siden din. Har du en small side og veldig mange besøkende med store skjermer kan det være lurt å utnytte plassen du har tilgjengelig.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Velg “Tabell” her også.&lt;/li&gt;
&lt;li&gt;Velg “Skjermoppløsning” i første kolonne.&lt;/li&gt;
&lt;li&gt;Velg “Unike besøkende” i andre kolonne.&lt;/li&gt;
&lt;li&gt;Velg hvor mange resultater som skal vises.&lt;/li&gt;
&lt;li&gt;Sett en tittel og lagre.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;a href=&quot;http://www.google.com/analytics/learn/setupchecklist.html&quot; title=&quot;Google Analytics Setup&quot;&gt;For fyldigere informasjon om Google Analytics kan du lese her.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Dette var to av mine widgets som jeg bruker i mitt oppsett. Har du noen andre kjekke widgets i Google Analytics må du gjerne dele dem i kommentarfeltet.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>SCSS &amp;#8211; Mer effektiv CSS</title>
		<link href="https://andeers.com/scss-mer-effektiv-css/"/>
		<updated>2012-11-12T00:00:00Z</updated>
		<id>https://andeers.com/scss-mer-effektiv-css/</id>
		<content type="html">&lt;p&gt;CSS3 har blitt godt implementert i de fleste nettlesere nå og det har mange kjekke muligheter som animasjoner, skyggelegging og avrundede hjørner. Men likevel kan du ta CSS enda et steg videre og gjøre utviklingen enklere. &lt;strong&gt;Say hello to SCSS.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;SCSS er et skriptspråk som kompileres til CSS. SCSS skrives på samme måte som CSS men det har muligheter som ikke er mulig med vanlig CSS. Du har foreksempel mulighet til å nøste css-tagger sånn at du slipper å skrive like mye:&lt;/p&gt;
&lt;pre rel=&quot;scss&quot;&gt;&lt;code&gt;
.mainmenu{
  width: 600px;
  margin: 0 auto;
  ul{
    background: #412eeb;
    li{
      display: inline;
      padding: 5px;
      a{
        color: #ca2828;
      }
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;pre rel=&quot;css&quot;&gt;&lt;code&gt;
.mainmenu{
  width: 600px;
  margin: 0 auto;
}
.mainmenu ul{
  background: #412eeb;
}
.mainmenu ul li{
  display: inline;
  padding: 5px;
}
.mainmenu ul li a{
  color: #ca2828;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Her vil SCSS kompileres til CSS-eksempelet over, ved å bruke SCSS sparer man litt unødvendig skriving og personlig mener jeg det blir mer oversiktlig.&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Variabler&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;SCSS gir også muligheten til å lage variabler. Variabler i CSS kan du foreksempel bruke til å angi 3-4 farger, dermed kan du bruke disse variablene gjennom CSS-dokumentet. Skulle du få lyst til å forandre noen av fargene på nettstedet kan du nå bare forandre variablene istedet for å måtte gå gjennom dokumentet og forandre alle forekomstene.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Mixins&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Mye CSS-kode skrives mange ganger gjennom dokumentene og kan ikke alltid plasseres i klasser for gjenbruk. Der har SCSS en kjekk ting som kalles mixins.&lt;/p&gt;
&lt;p&gt;En mixin er som en variabel, bare at du kan skrive hele CSS-biter du bruker ofte:&lt;/p&gt;
&lt;pre rel=&quot;scss&quot;&gt;&lt;code&gt;
@mixin centered {
  margin-left: auto;
  margin-right: auto;
}
.box{
  @include centered;
  /* Annen CSS */
}
&lt;/code&gt;&lt;/pre&gt;
&lt;pre rel=&quot;css&quot;&gt;&lt;code&gt;
.box{
  margin-left: auto;
  margin-right: auto;
  /* Annen CSS */
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Mixins med argument&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Du kan også la mixins motta argumenter og sette standard-argumenter om ingenting blir angitt.&lt;/p&gt;
&lt;p&gt;Bruker du ofte 1px ramme rundt bokser og avrundede hjørner er du kanskje lei av å skrive alle prefixene for de forskjellige nettleserene.&lt;/p&gt;
&lt;p&gt;Ved å bruke SCSS kan du da lage deg en mixin som gjør dette veldig enkelt:&lt;/p&gt;
&lt;pre rel=&quot;scss&quot;&gt;&lt;code&gt;
@mixin rounded($val) {
  -moz-border-radius: $val;
  -webkit-border-radius: $val;
  border-radius: $val;
}
.box{
  @include rounded(10px);
  /* Annen CSS */
}
&lt;/code&gt;&lt;/pre&gt;
&lt;pre rel=&quot;css&quot;&gt;&lt;code&gt;
.box{
  -moz-border-radius: 10px;
  -webkit-border-radius: 10px;
  border-radius: 10px;
  /* Annen CSS */
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Komme i gang med SCSS&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For å komme i gang med SCSS må du enten ha litt kunnskaper om Ruby og terminal(mac), være god til å søke og lese deg frem eller gå for et program som tar seg av alt.&lt;/p&gt;
&lt;p&gt;Personlig har jeg valgt å gå for det siste alternativet. Jeg bruker et program som heter CodeKit, det lar meg administrere alt på en behagelig måte, også slipper jeg å styre med ruby og kommandoer jeg fort glemmer.&lt;/p&gt;
&lt;p&gt;CodeKit overvåker de mappene du angir og kompilerer SCSS-koden til gyldig CSS. CodeKit har også en nyttig funksjon hvor det oppdaterer nettleseren med endringene du gjør uten at siden oppdateres. CodeKit har veldig mange funksjoner og muligheter og det fortjener et eget innlegg for å få med alt, så kanskje jeg skriver et innlegg om det senere.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Nytt standardbilde på kommentarer</title>
		<link href="https://andeers.com/nytt-standardbilde-pa-kommentarer/"/>
		<updated>2012-07-21T00:00:00Z</updated>
		<id>https://andeers.com/nytt-standardbilde-pa-kommentarer/</id>
		<content type="html">&lt;p class=&quot;intro&quot;&gt;
  I dette blogginnlegget skal jeg vise hvordan man enkelt kan sette en personlig avatar som standard på kommentarer. Alt som kreves er en liten kodesnutt og et nytt bilde.
&lt;/p&gt;
&lt;p&gt;Bilder på kommentarene på en blogg kalles avatarer og WordPress benytter en tjeneste som kalles &lt;a href=&quot;http://gravatar.com/&quot; title=&quot;Gravatar.com&quot;&gt;Gravatar&lt;/a&gt; for å la folk ha sine egne bilder på kommentarene uten å måtte registrere seg på hver enkelt blogg. For personer som ikke benytter gravatartjenesten vises enten WordPress sin “Mystery Man” eller autogenerert pixelart:&lt;/p&gt;&lt;figure id=&quot;attachment_665&quot; style=&quot;width: 338px;&quot; class=&quot;wp-caption aligncenter&quot;&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2012/07/avatars.png&quot;&gt;&lt;img class=&quot;size-full wp-image-665&quot; title=&quot;Avatarer&quot; src=&quot;https://andeers.com/wp-content/uploads/2012/07/avatars.png&quot; alt=&quot;Avatarer&quot; width=&quot;338&quot; height=&quot;144&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;figcaption class=&quot;wp-caption-text&quot;&gt;Avatarene man kan velge som standard&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Vil man ha et eget bilde som standard, noe som kan ta seg bedre ut om man har lagd et pent design, krever det kun en liten kodesnutt som må limes inn i functions.php.&lt;/p&gt;
&lt;p&gt;add_filter( &#39;avatar_defaults&#39;, &#39;ny_avatar&#39; );&lt;/p&gt;
&lt;p&gt;function ny_avatar ($avatar_defaults) {
$ny_avatar = get_bloginfo(&#39;template_directory&#39;) . &#39;/images/gravatar.png&#39;;
$avatar_defaults[$ny_avatar] = &amp;quot;Ny avatar&amp;quot;; return $avatar_defaults;
}&lt;/p&gt;
&lt;p&gt;Det denne kodesnutten gjør er å:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Kjøre funksjonen vår når WordPress skal vise avatarene.&lt;/li&gt;
&lt;li&gt;Angi hvor vår avatar ligger (I dette tilfellet ligger avataren i “images”-mappen i tema-mappen).&lt;/li&gt;
&lt;li&gt;Legge til vår avatar sammen med resten og gir den navnet “Ny avatar”.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Resultatet av dette er at det på administrasjonsiden “Settings – Discussion” har dukket opp et nytt valg for avatarer:&lt;/p&gt;&lt;figure id=&quot;attachment_685&quot; style=&quot;width: 439px;&quot; class=&quot;wp-caption aligncenter&quot;&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2012/07/Skjermbilde-2012-07-17-kl.-22.00.45.png&quot;&gt;&lt;img class=&quot;size-full wp-image-685&quot; title=&quot;Ny avatar&quot; src=&quot;https://andeers.com/wp-content/uploads/2012/07/Skjermbilde-2012-07-17-kl.-22.00.45.png&quot; alt=&quot;ny avatar&quot; width=&quot;439&quot; height=&quot;74&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;figcaption class=&quot;wp-caption-text&quot;&gt;Min nye avatar.&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Da skulle det være enkelt å lage din egen avatar for bruk på WordPress-siden, skulle noe være uklart er det bare å slenge igjen en &lt;strong&gt;kommentar&lt;/strong&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Gode plugins til WordPress</title>
		<link href="https://andeers.com/gode-plugins-til-wordpress/"/>
		<updated>2012-03-24T00:00:00Z</updated>
		<id>https://andeers.com/gode-plugins-til-wordpress/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;Har du din egen WordPress-blogg på eget domene? I såfall finnes det tusenvis av plugins(innstikk) som kan gjøre hverdagen din enda bedre. Iallefall for bloggingen din.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2012/03/wordpressplugins.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-604&quot; title=&quot;wordpressplugins&quot; src=&quot;https://andeers.com/wp-content/uploads/2012/03/wordpressplugins.png&quot; alt=&quot;Screenshot of plugins&quot; width=&quot;700&quot; height=&quot;373&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;På &lt;a href=&quot;http://wordpress.org/extend/plugins/&quot; title=&quot;WordPress Plugins&quot;&gt;wordpress.org&lt;/a&gt; finnes det per dags dato(20.03.12) 18.821 plugins. Det er plugins som kan  gjøre alt mulig for bloggen din, fra små ting som å legge til widgets, slideshows eller vise populære innlegg til mer avanserte ting som deling av kladder, spam-filter på kommentarer og muligheter for å lage forum av bloggen.&lt;/p&gt;
&lt;img class=&quot;alignright size-full wp-image-594&quot; title=&quot;Sortbytags&quot; src=&quot;https://andeers.com/wp-content/uploads/2012/03/sortbytags.png&quot; alt=&quot;Screenshot from wordpress.org/extend&quot; width=&quot;152&quot; height=&quot;249&quot; /&gt;
&lt;p&gt;Ikke alle plugins som ligger der er like gode, enkelte fungerer ikke i det hele tatt. Dette ser man heldigvis godt da alle plugins får en vurdering basert på hva brukerne syns, en stjerne er lav kvalitet og fem stjerner er god kvalitet.&lt;/p&gt;
&lt;p&gt;Man kan søke, sortere etter kategori eller se de mest populære, nyeste eller senest oppdaterte. Videre får man opp installasjonsveiledning, beskrivelse, ofte stilte spørsmål(faq) og statistikk over hvor ofte den er er lastet ned når man går inn på en plugin.&lt;/p&gt;
&lt;p&gt;Her kommer et par plugins jeg syns er veldig nyttige og som gjør WordPress bedre for meg:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://wordpress.org/extend/plugins/jetpack/&quot; title=&quot;Jetpack by WordPress.com - WordPress plugin&quot;&gt;Jetpack by WordPress.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Jetpack gir en WordPress-blogg på eget domene mye funksjonalitet som man vanligvis kun får på WordPress.com. Funksjonalitet som:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Statistikk.&lt;/li&gt;
&lt;li&gt;Gravatar Hovercards.&lt;/li&gt;
&lt;li&gt;Shortcodes for Youtube, Slideshare, Vimeo.&lt;/li&gt;
&lt;li&gt;Ekstra widgets som foreksempel kan vise tweets.&lt;/li&gt;
&lt;li&gt;Mulighet for å lage korte url-adresser med WP.me&lt;/li&gt;
&lt;li&gt;Og enda noen flere kjekke…&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Jeg personlig er veldig glad i statistikken. Den viser meg enkelt om innleggene mine har hatt noen sidevisninger.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://wordpress.org/extend/plugins/popular-posts-plugin/&quot; title=&quot;Popular Posts - WordPress plugin&quot;&gt;Popular Posts&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Popular Posts gir deg en widget som lar deg vise de mest populære innleggene dine i en widget. Veldig kjekk for å la leseren finne mer lesestoff og holde de på siden din lengre.&lt;/p&gt;
&lt;p&gt;Du har mange muligheter til å stille inn hvilke innlegg som skal vises, om sider skal inkluderes, om innlegg eldre enn x antall måneder skal fjernes også videre…&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://wordpress.org/extend/plugins/shareadraft/&quot; title=&quot;Share a draft - WordPress plugin&quot;&gt;Share a draft&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Ofte når man skriver innlegg skulle man ønske man kunne få tilbakemelding på det før man legger det ut, og det er ikke alltid man har andre tilstede.&lt;/p&gt;
&lt;p&gt;Med Share a draft får man sendt en epost til ønsket adresse med en link som vedkommende kan trykke på for å lese innlegget. En veldig kjapp og enkel måte å få tilbakemelding fra andre på.&lt;/p&gt;
&lt;p&gt;Man har muligheter til å trekke tilbake tilgang om man ikke vil at noen skal kunne lese lengre og man kan forlenge tiden en person har tilgang. Man har altså full kontroll på tilgangen.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Nytt design på siden min!</title>
		<link href="https://andeers.com/nytt-design/"/>
		<updated>2012-03-18T00:00:00Z</updated>
		<id>https://andeers.com/nytt-design/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;Da har jeg endelig fått tid til å lage et eget tema til nettsiden min!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2012/03/andeerscomdesign.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-578&quot; title=&quot;andeerscomdesign&quot; src=&quot;https://andeers.com/wp-content/uploads/2012/03/andeerscomdesign.png&quot; alt=&quot;Nytt design på Andeers.com&quot; width=&quot;570&quot; height=&quot;304&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Jeg har til nå brukt et tema som heter &lt;strong&gt;Standard Theme&lt;/strong&gt;, men har lenge hatt en plan om lage et eget tema når jeg har hatt tid. Min største hobby er webutvikling og av den grunn syns jeg det passer seg å ha noe jeg har laget selv som design på bloggen min.&lt;/p&gt;
&lt;p&gt;Det er fremdeles mange ting som må gjøres før temaet kan kalles fullstendig, men for å se hvordan det fungerer har jeg valgt å prøve det i en periode nå.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Funksjonalitet&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Jeg har hatt som mål å lage et tema med mye funksjonalitet som kan være kjekke å ha i et tema. Foreløpig har jeg lagd:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Mulighet til å bytte ut standard RSS-link med f.eks Feedburner&lt;/li&gt;
&lt;li&gt;Mulighet til i bytte layout mellom en kolonne og to kolonner, høyre eller venstre sidebar.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
  &lt;a href=&quot;https://andeers.com/wp-content/uploads/2012/03/themeoption.png&quot;&gt;&lt;img class=&quot;size-large wp-image-581 aligncenter&quot; title=&quot;themeoption&quot; src=&quot;https://andeers.com/wp-content/uploads/2012/03/themeoption.png&quot; alt=&quot;Theme options&quot; width=&quot;570&quot; height=&quot;184&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;p&gt;Videre er planen å legge til:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Mulighet for å legge inn tracking-kode(Google Analytics).&lt;/li&gt;
&lt;li&gt;Post-formats(Video, bilde, link, status).&lt;/li&gt;
&lt;li&gt;Ajax-innhenting av innlegg på forsiden.&lt;/li&gt;
&lt;li&gt;Responsive Design(Siden tilpasser seg skjermstørrelse).&lt;/li&gt;
&lt;li&gt;Fikse css på enkelte elementer som ikke ser helt bra ut enda.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;Så, hva syns du om temaet? Noe som ikke fungerer? Noe som er lite gjennomtenkt? Jeg er veldig interessert i å høre tilbakemeldinger på temaet og hva &lt;strong&gt;din&lt;/strong&gt; mening er.&lt;/em&gt;&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Path &amp;#8211; et nytt sosialt nettverk</title>
		<link href="https://andeers.com/path-et-nytt-sosialt-nettverk/"/>
		<updated>2012-02-16T00:00:00Z</updated>
		<id>https://andeers.com/path-et-nytt-sosialt-nettverk/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;I det siste har jeg prøvd et nytt sosialt nettverk, &lt;a href=&quot;https://path.com/&quot; title=&quot;Path.com&quot;&gt;Path&lt;/a&gt;. Det er veldig spennende og jeg liker absolutt ideen, men har jeg bruk for det?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Path er på mange måter som Facebook, man legger til venner, skriver statusoppdateringer og legger ut bilder. Den store forskjellen ligger i at Path kun kan brukes på mobil, og at det er en maksgrense på &lt;strong&gt;150 venner&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;En grei ide, man får ett nettverk der man kun har sine nærmeste venner, men er det noe mer? Jeg kan vite at det jeg deler kun deles med de jeg virkelig kjenner, men det kan jeg da allerede kan i Facebook ved hjelp av lister. Path har også den supernyttige funksjonen at du kan si fra når du legger deg og står opp. Personlig syns jeg Facebook allerede har for mange som deler alt for mye &lt;strong&gt;unyttig&lt;/strong&gt;, de trenger ikke flere funksjoner for å dele sånt.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2012/02/pathmobile.png&quot;&gt;&lt;img class=&quot;aligncenter size-medium wp-image-541&quot; title=&quot;pathmobile&quot; src=&quot;https://andeers.com/wp-content/uploads/2012/02/pathmobile-188x300.png&quot; alt=&quot;Path på mobil&quot; width=&quot;188&quot; height=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Så min konklusjon er at det er bra det kommer sosiale nettverk som prøver på nye ting, men Path har ikke nok nytt til at jeg ser fordeler med det.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Introduksjon til WordPress</title>
		<link href="https://andeers.com/introduksjon-til-wordpress/"/>
		<updated>2012-01-20T00:00:00Z</updated>
		<id>https://andeers.com/introduksjon-til-wordpress/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;WordPress har blitt et av de mest brukte cms og bloggverktøyene på internett. Det brukes av alt fra små personlige blogger, til store sider som &lt;a href=&quot;http://spotify.com/&quot;&gt;Spotify.com&lt;/a&gt;. WordPress er derfor et veldig bra alternativ om man vil starte sin egen blogg eller personlige nettside. I denne artikkelen går jeg gjennom de forskjellige alternativene og hva forskjellen mellom de er.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2012/01/bloggWP1.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-567&quot; title=&quot;bloggWP&quot; src=&quot;https://andeers.com/wp-content/uploads/2012/01/bloggWP1.png&quot; alt=&quot;Wordpress org og com&quot; width=&quot;570&quot; height=&quot;304&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hvordan komme i gang?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Det er veldig enkelt å komme i gang med WordPress. Man har i utgangspunktet **to **muligheter:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://wordpress.com/&quot; title=&quot;WordPress.com&quot;&gt;WordPress.com&lt;/a&gt; (WP.com)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://wordpress.org/&quot; title=&quot;WordPress.org&quot;&gt;WordPress.org&lt;/a&gt; (WP.org)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Hvilken versjon man velger kommer helt an på tekniske ferdigheter, økonomi og hva man vil gjøre. Her kommer en gjennomgang av de to alternativene.&lt;/p&gt;
&lt;!--more--&gt;
&lt;p&gt;&lt;strong&gt;WordPress.com&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;WP.com er den aller enkleste måten å komme i gang med WordPress på. På WP.com registrer man seg og får tildelt sin egen blogg på &lt;strong&gt;bloggnavn&lt;/strong&gt;.wordpress.com. Denne varianten er veldig enkel og det tar noen minutter å registrere seg og få bloggen tilgjengelig. Den største fordelen med WP.com er at man har muligheten til å få support om man skulle oppleve problemer. WP.com har også flere nyttige funksjoner innebygd som ikke finnes i WP.org-utgaven, blandt annet statistikk og facebook/twitter-innlogging for kommentarsystemet.&lt;/p&gt;
&lt;p&gt;Samtidig som WP.com har endel funksjonalitet WP.org ikke har, mangler også WP.com endel funksjonalitet og muligheter WP.org har. WP.com mangler muligheten til å:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Legge inn egne temaer (themes).&lt;/li&gt;
&lt;li&gt;Installere plugins.&lt;/li&gt;
&lt;li&gt;Bruke verktøy som krever tilgang til kildekoden, f.eks Google Analytics.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Selv om man ikke kan legge inn egne themes så har WP.com mange themes tilgjengelig, slik at man kan få en blogg med et personlig preg.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;WordPress.org&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Alternativet til WP.com er WP.org. Her laster man ned WordPress-filene også må man laste de opp på et eget webhotell. Å gjøre dette krever litt mer teknisk innsikt enn å registrere seg på WP.com, men de fleste vil klare det med litt hjelp.&lt;/p&gt;
&lt;p&gt;Å bruke dette alternativet krever at man har et eget domene (nettadresse) og et webhotell man kan lagre filene på. Dette koster som regel penger så om man kun er ute etter å komme i gang med blogging er WP.com et enklere og raskere alternativ. De største fordelene med denne løsningen er:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Total kontroll over nettstedet ditt.&lt;/li&gt;
&lt;li&gt;Mulighet for å legge inn egne temaer (themes).&lt;/li&gt;
&lt;li&gt;Mulighet for å legge inn plugins, noe som kan gi mye fancy funksjonalitet.&lt;/li&gt;
&lt;li&gt;Mulighet til å bruke verktøy som &lt;a href=&quot;http://www.google.com/analytics/&quot; title=&quot;Google Analytics&quot;&gt;Google Analytics&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Du får “dittdomene.com” istedet for “dittdomene.wordpress.com”&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Legger du inn WordPress på ditt eget domene er du mye friere enn du er med WP.com. Du kan modifisere på kjernefilene til WordPress om du føler for det, og du kan skreddersy din egen blogg om du har kunnskaper innen html, css og php.&lt;/p&gt;
&lt;p&gt;Oppstår det problemer har du ikke de samme support-mulighetene som du har med en blogg hos WP.com. Det finnes mange nettsteder med folk som hjelper hverandre, men du er aldri sikret svar eller en løsning.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hva skal man velge?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Hvilken løsning man ender opp med kommer veldig an på hva man har planer om tror jeg. Er du en web-utvikler vil du helt sikkert ha muligheten til å lage egne tema, utvikle plugins eller gjøre andre ting på nettstedet. Jeg personlig syns det ser mye mer proft ut med en nettadresse som ikke har “wordpress.com” i seg.&lt;/p&gt;
&lt;p&gt;Er du kun ute etter å blogge og ikke er opptatt av tekniske ting har du kanskje ikke like stor nytte av wordpress på eget domene.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Andre ressurser&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://codex.wordpress.org/Getting_Started_with_WordPress&quot; title=&quot;Getting started with WordPress&quot;&gt;Getting started with WordPress&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wordpress.com/features/&quot; title=&quot;WordPress Features&quot;&gt;WordPress Features&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;Dette er ment som en kort introduksjon av de alternativene som finnes. Skulle du ha flere spørsmål må du bare legge igjen en kommentar.&lt;/em&gt;&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Hvorfor analysere?</title>
		<link href="https://andeers.com/hvorfor-analysere/"/>
		<updated>2012-01-15T00:00:00Z</updated>
		<id>https://andeers.com/hvorfor-analysere/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;Det er enkelt å legge inn Google Analytics eller andre analyseverktøy og det er enkelt å se på tallene etterhvert som besøkende ankommer. Men hva skal man egentlig med dataene man samler inn?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hva kan være nyttig informasjon?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;La oss si man har en nettside med endel artikler om bedriften sin, forskjellige produkter, nyheter og kanskje en blogg. Det vil jeg kalle en ganske fyldig nettside. Men som eier av nettsiden kan det være vanskelig å vite hvordan de besøkende ankommer siden. Det er mange måter en person kan finne siden på, foreksempel:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Søker etter produktene&lt;/li&gt;
&lt;li&gt;Er en ivrig bloggleser&lt;/li&gt;
&lt;li&gt;Søker på firmanavnet&lt;/li&gt;
&lt;li&gt;Kommer fra Facebook (firmaside f.eks)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Uten analysedata vet man veldig lite om dette, og det er nesten umulig å finne det ut.&lt;/p&gt;
&lt;p&gt;Begynner man å se mer på dataene man får ut av Google Analytics kan man finne ut hvilke sider brukerne først ankommer og hvor de kommer fra. Med Analytics kan man se hva slags enhet brukerne sitter på, om det er veldig mange mobil/tablet-brukere og hvor i verden de besøkende er fra.&lt;/p&gt;
&lt;p&gt;Her kommer et eksempel på data man kan få ut fra Analytics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;40% av de besøkende bruker tablets(iPad, Galaxy Tab…)&lt;/li&gt;
&lt;li&gt;De besøkende kommer stort sett fra Norge(55%) og England(30%)&lt;/li&gt;
&lt;li&gt;De fleste besøkende kommer til nettstedet fra søkemotor og kommer til produktsidene.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Hva kan man så få ut av denne informasjonen?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Siden en så stor andel av de besøkende bruker tablets må man begynne å vurdere om man skal modifisere nettstedet og gjøre nettsiden mer touchvennlig om den ikke er det. Siden en forholdsvis stor andel besøkende kommer fra England kan det kanskje være lurt å lage en engelsk variant av nettsidene, og iallefall av produktsidene siden det er disse folk besøker.&lt;/p&gt;
&lt;p&gt;Ved å bruke analyseinformasjonen på denne måten kan man oppdage at enkelte forandringer kan gjøre opplevelsen bedre for brukerne, få flere besøkende og finne ut hva besøkende liker ved nettstedet ditt.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>PayPal, sosiale medier og sinte kunder</title>
		<link href="https://andeers.com/paypal-sosiale-medier-og-sinte-kunder/"/>
		<updated>2012-01-12T00:00:00Z</updated>
		<id>https://andeers.com/paypal-sosiale-medier-og-sinte-kunder/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;Sosiale medier er en veldig fin plass å være, det er lett å nå ut til veldig mange og man kan ofte klare seg uten store utgifter. Man kan få mye ut av sosiale medier, men man kan også brenne seg skikkelig.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Veldig mange firmaer bruker sosiale medier aktivt til promotering, kundeservice og generelle tilbakemeldinger. &lt;a href=&quot;http://rimi.no/&quot; title=&quot;Rimi.no&quot;&gt;Rimi&lt;/a&gt; bruker Facebook som support for sin app og tjeneste, &lt;a href=&quot;https://netcom.no/&quot; title=&quot;Netcom.no&quot;&gt;Netcom&lt;/a&gt; brukeraktivt som kundeservice hvor de svarer på alle slags problemer folk måtte ha med Netcom.&lt;/p&gt;
&lt;p&gt;Men det finnes også mange eksempler på bedrifter som har brukt sosiale medier på dårlige måter. Folk er flinke til å si fra når de er misfornøyde og i sosiale medier er det veldig enkelt å ytre sin mening. Sosiale medier har uante krefter, noe som &lt;a href=&quot;https://www.paypal.com/&quot; title=&quot;PayPal.com&quot;&gt;Paypal&lt;/a&gt; oppdaget på den harde måten før jul.&lt;/p&gt;
&lt;!--more--&gt;
&lt;p&gt;PayPal stengte kontoen til en nettside som gav vekk leker til fattige barn. PayPal mente at nettsiden brøt med deres retningslinjer. &lt;a href=&quot;http://mashable.com/2011/12/06/paypal-regretsy/&quot; title=&quot;PayPal Regretsy&quot;&gt;Denne artikkelen&lt;/a&gt; fra Mashable summerer opp hendelsen veldig godt.&lt;/p&gt;
&lt;p&gt;Etter hvert som folk fant ut hva som hadde skjedd begynte innleggene å komme på veggen til PayPal på Facebook. Det kom 10-20 nye innlegg hvert sekund og ingen av de hadde noe spesielt pent å si. Hva gjorde PayPal? Nesten ingenting, helt i starten slettet de enkelte innlegg men dette ble ikke mulig etterhvert når strømmen av innlegg ble større. Det mest fornuftige ville nok vært å stengt veggen for kommentarer, gitt en offisiell forklaring, forklart hvorfor det skjedde og hva som kom til å skje videre.&lt;/p&gt;
&lt;p&gt;Har man fått så mange innlegg på siden sin at man ikke klarer å svare på alle, bør man iallefall legge ut en generell offentlig forklaring. Ingenting ser verre ut enn at alle som kommer med &lt;strong&gt;kritikk blir ignorert&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Det gikk nesten to døgn før PayPal ga etter, gjenåpnet kontoen og la ut et blogginnlegg med en beklagelse. På denne tiden hadde de nok fått flere tusen innlegg på veggen sin.&lt;/p&gt;
&lt;p&gt;Jeg sjekket Facebook-veggen til PayPal i dag (12.01.12) og det er nesten bare **negative **innlegg der. PayPal selv har noen innlegg med linker til forskjellige nyheter som omhandler PayPal, men det er det eneste. PayPal har ikke svart på et eneste innlegg på veggen sin.&lt;/p&gt;
&lt;p&gt;Enten så skjønner ikke PayPal nytten av Facebook og muligheten til å komme i kontakt med brukerne, eller så har de bestemt seg for å ikke bruke Facebook til &lt;strong&gt;kundekontakt&lt;/strong&gt;. Uansett mener jeg de har mye å tjene på å vise kundene sine at de hører på de.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Kort om Google Analytics</title>
		<link href="https://andeers.com/kort-om-google-analytics/"/>
		<updated>2011-12-24T00:00:00Z</updated>
		<id>https://andeers.com/kort-om-google-analytics/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;Uansett om det er en blogg, en nettbutikk eller en info-nettside man har er man interessert i å vite hvor mange besøkende man har. Det kan også være greit å se hvor i verden de besøkende kommer fra.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Har man en norsk blogg, men får veldig mange treff fra utlandet kan det kanskje være lurt å vurdere om man skal blogge på engelsk istedet for norsk. Det kan også være greit å finne ut når på døgnet og på hvilke dager man har flest besøkende.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hva kan så gjøres?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For å overvåke trafikken på et nettsted kan man ta i bruk verktøy som foreksempel &lt;strong&gt;Google Analytics(GA)&lt;/strong&gt;. Det er et verktøy utviklet av Google som viser deg statistikk over de besøkende på nettstedet ditt.  GA er gratis å bruke og krever kun en Google-konto. For at man skal kunne ta i bruk GA må man ha tilgang til kildekoden på sitt nettsted, dette betyr at foreksempel personer som har en blogg på wordpress.com ikke vil ha muligheten til å legge inn GA da de ikke har tilgang til html-koden.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hva slags muligheter finnes det?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I GA kan man få se hvor mange besøkende man har hatt totalt, på spesifikke dager, fra spesifikke plasser og på hvilken tid av døgnet det er flest besøkende. Man har også muligheten til å se hva slags operativsystem, nettleser og enhet(mobil, iPad, data) som brukes.&lt;/p&gt;
&lt;p&gt;Alt sammen vises i oversiktlige grafer og diagrammer.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;/p&gt;&lt;p&gt;
    &amp;nbsp;
  &lt;/p&gt;
  &lt;p&gt;
    &lt;strong&gt;Hva kan det brukes til?&lt;/strong&gt;
  &lt;/p&gt;
  &lt;p&gt;
    Man kan bruke GA til å se hva slags målgruppe man har. Er flesteparten av leserne på mobil, kan det være lurt å vurdere om man skal gjøre nettsiden mer mobilvennlig.
  &lt;/p&gt;
  &lt;p&gt;
    Man kan få veldig mye forskjellig ut av å analysere trafikken, alt etter hva man ser på og etter.
  &lt;/p&gt;
  &lt;p&gt;
    &lt;em&gt;Har du noen erfaring med Google Analytics eller lignende?&lt;/em&gt;
  &lt;/p&gt;
  &lt;p style=&quot;text-align: center;&quot;&gt;&lt;/p&gt;</content>
	</entry>
	
	<entry>
		<title>Et alternativ til Google Analytics</title>
		<link href="https://andeers.com/et-alternativ-til-google-analytics/"/>
		<updated>2011-12-24T00:00:00Z</updated>
		<id>https://andeers.com/et-alternativ-til-google-analytics/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;I denne oppgaven i faget Sosiale Medier skulle vi se nøyere på et valgfritt analyseverktøy. Jeg prøvde å tenke meg om, men kom ikke på at jeg viste om noen andre enn Google Analytics. Jeg søkte derfor litt rundt og fant &lt;a href=&quot;http://getclicky.com/&quot; title=&quot;Clicky&quot;&gt;Clicky&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Alle bildene og informasjonen her har jeg funnet ut i fra demoversjonen på deres side.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Førsteinntrykket av det jeg ser er veldig bra. Clicky har et veldig oversiktlig og greit brukergrensesnitt.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2011/12/clickyScreen.png&quot;&gt;&lt;img class=&quot;aligncenter size-large wp-image-428&quot; title=&quot;clickyScreen&quot; src=&quot;https://andeers.com/wp-content/uploads/2011/12/clickyScreen-672x372.png&quot; alt=&quot;Clicky Dashboard&quot; width=&quot;570&quot; height=&quot;307&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Clicky fokuserer veldig på “live”-resultater. De viser brukeren i sanntid hvem som er inne på siden. Jeg må si jeg ikke helt ser vitsen med det, de brukerne som er inne på siden akkurat nå får man ikke gjort så veldig mye med likevel. Skal man analysere en side må man se på den over tid.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sammenlignet med Google Analytics(GA)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Når jeg søkte på alternativer til GA var det &lt;strong&gt;Clicky&lt;/strong&gt; som dukket opp veldig ofte. Derfor går jeg ut fra at folk flest også mener at det er en sterk konkurrent. Og jeg må si at jeg skjønte kjappere hvordan ting fungerte i Clicky, veldig oversiktlig og enkelt å komme i gang. Brukergrensesnittet er veldig behagelig uten for mye dilldall som forstyrrer.&lt;/p&gt;
&lt;p&gt;Jeg vurderer derfor sterkt å teste Clicky en periode på min nettside og se hvordan det er.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Har du erfaring med Clicky? Eller andre alternativer til Google Analytics?&lt;/em&gt;&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Julefreden senker seg</title>
		<link href="https://andeers.com/julefreden-senker-seg/"/>
		<updated>2011-12-20T00:00:00Z</updated>
		<id>https://andeers.com/julefreden-senker-seg/</id>
		<content type="html">&lt;p&gt;**Eksamen er ferdig, leiligheten er ryddet og ordnet til jul, jeg er hjemme i Surnadal,  treet er pynta og det har blitt julaften. **&lt;/p&gt;
&lt;p&gt;Endelig er det skikkelig juleferie (jeg har forsåvidt en øving som skal inn og en rapport som skal leveres i Januar), men &lt;strong&gt;nå&lt;/strong&gt; er det juleferie en stund.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img class=&quot;aligncenter&quot; title=&quot;https://www.flickr.com/photos/realityfanclub/4206605399/&quot; alt=&quot;Snow in forest&quot; src=&quot;https://farm3.staticflickr.com/2801/4206605399_148975cc3e.jpg&quot; width=&quot;500&quot; height=&quot;333&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;Etter et langt semester med mange innleveringer, rapporter og øvinger er det godt å endelig komme hjem og kunne slappe av litt. Ikke ha skole å tenke på hele tiden, men bare slappe av sammen med familie. Nå skal jeg nyte ferien så lenge jeg kan før det blir skole igjen i Januar. I semesteret som har gått har jeg hatt mange forskjellige fag:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Endringsledelse&lt;/li&gt;
&lt;li&gt;Formidlingsteknikk&lt;/li&gt;
&lt;li&gt;Prosjektledelse av store IT-prosjekter&lt;/li&gt;
&lt;li&gt;It, miljø og samfunn&lt;/li&gt;
&lt;li&gt;Sosiale Medier&lt;/li&gt;
&lt;li&gt;Webprogrammering i PHP&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Av disse fagene er det definitivt PHP og Sosiale medier som har vært de mest spennende. Har virkelig fått sansen for PHP og har begynt å lage et lite system for administrering av timer i prosjekt. Hovedsaklig for læringens del, men kanskje kan jeg bruke det til noe fornuftig også. Jeg var også innom biblioteket og lånte meg en bok om PHP som jeg har tenkt å se på om jeg får tid.&lt;/p&gt;
&lt;p&gt;Sosiale medier er et veldig spennende tema, det er så veldig mange muligheter der. Twitter har vist seg å bli en plass jeg tilbringer mer tid enn Facebook i det siste. Ved å følge mange spennende personer får jeg mye interessant lesestoff og spennende synspunkter på ting.&lt;/p&gt;
&lt;p&gt;Blogging for min egen del har også blitt mye mer interessant etter hvert som jeg har lært mer om sosiale medier. Jeg har blitt mer bevist på markedsføring av meg selv og har blitt mye mer bevist på hvordan jeg opptrer på nett.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2012&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;****2012 blir et spennende år (ikke minst for å se om Mayaene får rett :P), men også fordi jeg mest sannsynlig skal ende opp i en jobb i løpet av året. I Mai er planen å være ferdig med en bachelor i IT-støttet bedriftsutvikling.&lt;/p&gt;
&lt;p&gt;Vårsemesteret har jeg også planer om å ta Html5 som et bonusfag, har fått det inntrykket at man ikke kan drive med webutvikling uten å kunne html5 nå.&lt;/p&gt;
&lt;p&gt;Sånn utenom skole har jeg planer om å fortsette å bruke php og utvikle nettsider, sette meg enda mer inn i WordPress, trene og være snill og grei.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Ca halvveis i semesteret!</title>
		<link href="https://andeers.com/ca-halvveis-i-semesteret/"/>
		<updated>2011-11-09T00:00:00Z</updated>
		<id>https://andeers.com/ca-halvveis-i-semesteret/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;I det siste har alle blogginnlegg her vært svar på forskjellige oppgaver i sosiale medier-faget jeg tar. Nå tenkte jeg at det er på tide å blogge litt om andre ting også.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Dette semesteret er veldig forskjellig fra de andre semestrene jeg har hatt på høgskolen. Fra å ha ca en forelesning om dagen hver dag, har jeg dette semesteret hatt ca 15 forelesninger totalt. Dette semesteret er veldig mye mer opp til oss selv med rapporter og øvinger som skal inn hele tiden.&lt;/p&gt;
&lt;p&gt;I Webprogrammering med PHP har jeg også et prosjekt, noe som er veldig mye mer morsomt enn de andre fagene til sammen dessverre. Hadde jeg bestemt alt her i verden hadde jeg bare brukt tid på det, for det er morsomt. Dessverre er ikke livet sånn og jeg må også prioritere andre oppgaver.&lt;/p&gt;
&lt;p&gt;Ser frem til juleferie nå, slappe av uten innleveringer og prosjektarbeid. Da skal jeg fokusere mer på WordPress, jeg har planer om å lage et theme fra bunnen av.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Komme i gang med Sosiale Medier</title>
		<link href="https://andeers.com/komme-i-gang-med-sosiale-medier/"/>
		<updated>2011-10-21T00:00:00Z</updated>
		<id>https://andeers.com/komme-i-gang-med-sosiale-medier/</id>
		<content type="html">&lt;p&gt;Har &lt;strong&gt;du&lt;/strong&gt; en bedrift? Har du planer om å ta i bruk sosiale medier for bedriften din? Om svaret på begge spørsmålene er ja er dette blogginnlegget for deg.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. Planlegging&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Før man registrer seg på Facebook og Twitter er det veldig **viktig **å tenke på:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hva vil du oppnå? (få flere kunder, skape dialog med kunder, reklamere.)&lt;/li&gt;
&lt;li&gt;Hvordan skal du gå frem? (Hva skal skrives, hvem skriver, hvor ofte?)&lt;/li&gt;
&lt;li&gt;Hvordan skal du behandle negativ kritikk eller dårlig omtale?&lt;/li&gt;
&lt;li&gt;Hvordan kan du måle at du lykkes?&lt;/li&gt;
&lt;li&gt;Hvilke nettverk skal du starte med? (Bare Facebook?)&lt;/li&gt;
&lt;li&gt;Hva slags &lt;strong&gt;regler&lt;/strong&gt; og &lt;strong&gt;retningslinjer&lt;/strong&gt; har nettverkene?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Når du har tenkt gjennom og svart på alle spørsmålene her er det lurt å utarbeide en strategi for sosiale medier. Med en strategi har du full oversikt over planene for sosiale medier, noe som gir ansatte en enkel måte å sette seg inn i strategien på.&lt;/p&gt;&lt;figure id=&quot;attachment_365&quot; style=&quot;width: 558px;&quot; class=&quot;wp-caption aligncenter&quot;&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2011/10/strategy.jpg&quot;&gt;&lt;img class=&quot;size-large wp-image-365 &quot; title=&quot;Strategy&quot; src=&quot;https://andeers.com/wp-content/uploads/2011/10/strategy-672x372.jpg&quot; alt=&quot;Sjakk - Strategi&quot; width=&quot;558&quot; height=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;figcaption class=&quot;wp-caption-text&quot;&gt;Det er veldig viktig å ha en strategi&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Etablering&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Når du har tenkt gjennom punktene i steg en og laget en strategi er det neste steget å registrere seg på et (eller flere) nettverk. Før du faktisk registrerer deg vil jeg anbefale at du bruker litt tid på å &lt;strong&gt;sette deg inn i funksjoner&lt;/strong&gt; og sånn slik at du alt klart for deg. Når du registrer deg er det viktig at du har tenkt på et ordentlig navn på profilen. På en Facebookside lønner det seg å ha fullt firmanavn som tittel på siden og en forkortet versjon av navnet som “shortname” (facebook.com/shortname). På Twitter lønner det seg å angi et kort navn som brukernavn, også kan man ha det fulle navnet på firmaet som navn.&lt;/p&gt;
&lt;!--more--&gt;
&lt;p&gt;Når du har registrert siden og fått logget deg inn, er det bare å legge inn logo, beskrivelse og annen informasjon med en gang. Jo kjappere informasjonen ligger der, jo bedre ser det ut for besøkende. Skriv også et åpningsinnlegg sånn at besøkende ser at det faktisk skjer noe.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3. Når man har kommet i gang&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Når man har hatt Facebooksiden og/eller Twitter-kontoen en stund ser du hvordan det har gått i starten. Går det greit å publisere innlegg med jevne mellomrom? Får du respons? Det er viktig at du ser på utviklingen til siden din og vurderer hvordan det går.&lt;/p&gt;
&lt;p&gt;Om du ikke får noen tilhengere er det noe galt, kanskje finner ikke folk siden din eller så vet de ikke at den eksisterer. For å sjekke sånt, få venner og bekjente til å søke etter firmasiden din. De kan fortelle deg om de finner den lett eller ikke. Gjerne få venner og bekjente til å like siden din også, for når de liker den vil alle vennene deres få informasjon om siden også. Slik kan informasjon på Facebook spre seg veldig kjapt.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4. Ansvarsforhold&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Når du legger ut informasjon på Facebook fra din bedrift så må du tenke på at kanskje ikke alle ansatte ønsker å være med på bilder eller få mye informasjon lagt ut. Om andre ansatte også bruker kontoen må de tenke på at de skriver på vegne av bedriften og ikke seg selv, deres meninger vil tolkes til at det er bedriftens meninger. Det er også viktig at man ikke legger ut konfidensiell informasjon fra firmaet.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5. Har du lykkes?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Det er et veldig vanskelig spørsmål. Det er vanskelig å måle effekten av sosiale medier, men du kan sjekke om folk har fått et bedre inntrykk av firmaet ditt, om du har fått flere kunder, kritikk på ting du ikke var klar over eller ting du virkelig er god på. For å kunne måle effekten av sosiale medier må du nesten sette deg mål selv også vurdere mot disse.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6. Noen ting å passe seg for&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Det finnes flere bedrifter som har brent seg på Facebook fordi de ikke satte seg inn i reglene før de satte i gang. De feilene som mange bedrifter gjør er:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ikke opprette en side, men en vanlig person-profil (Mot Facebooks reglement).&lt;/li&gt;
&lt;li&gt;Opprette konkurranser som baserer seg på at folk skal “like” noe (Mot Facebooks reglement).&lt;/li&gt;
&lt;li&gt;Opprette en firmagruppe istedet for side (Ikke ulovlig, men ser ikke like bra ut).&lt;/li&gt;
&lt;li&gt;Legge ut innhold som bryter mot Facebooks retningslinjer (Så klart ulovlig).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Bryter man retningslinjene eller reglene risikerer man at kontoen blir slettet. Kontoen i seg selv er det ikke så farlig med, man kan alltids opprette en ny konto. Det er tilhengerne og innleggene som er viktige, har du opparbeidet deg 15.000 tilhengere er det veldig surt å måtte opprette en ny konto med 0 tilhengere. Det kan være veldig vanskelig å samle så mange en gang til.&lt;/p&gt;
&lt;p&gt;Til slutt vil jeg si at det er viktig å &lt;strong&gt;ikke&lt;/strong&gt; tenke at Sosiale medier skal være et mål for bedriften, sosiale medier må heller ses på som et &lt;strong&gt;verktøy&lt;/strong&gt; for å oppnå andre mål.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Noe annet bedrifter på Facebook/Twitter må tenke på?&lt;/em&gt;&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Bedrifter og Facebook!</title>
		<link href="https://andeers.com/bedrifter-og-facebook/"/>
		<updated>2011-10-20T00:00:00Z</updated>
		<id>https://andeers.com/bedrifter-og-facebook/</id>
		<content type="html">&lt;p&gt;De fire siste årene har flere og flere av oss mennesker registrert oss og brukt ganske så mye tid på &lt;a href=&quot;http://facebook.com/&quot;&gt;Facebook&lt;/a&gt;. Bare i  Norge har Facebook over &lt;a href=&quot;http://www.synlighet.no/facebook/statistikk-antall-brukere/&quot;&gt;2,5 millioner medlemmer&lt;/a&gt;, det er en veldig stor del av befolkningen.  Flere og flere bedrifter oppretter også sider på Facebook, alt fra store bedrifter til lokale avdelinger av matvarekjeder. Bedrifter som befinner seg på Facebook har dermed veldig mange potensielle personer tilgjengelige.&lt;/p&gt;
&lt;p&gt;**Hva kan bedrifter bruke Facebook til? **&lt;/p&gt;
&lt;p&gt;Det finnes forskjellige måter en bedrift kan bruke Facebook på. Du kan bruke Facebook for å reklamere for produkter og fortelle om nyheter. Du kan bruke Facebook for å få tilbakemeldinger, ris og ros eller bruke det som enkel kundeservice. Facebook er også veldig grei om man har et budskap som man vil skal nås ut til mange. Det er mye større sjangse for at noen ser det på Facebook, enn at de ser det på hjemmesiden til bedriften.&lt;/p&gt;
&lt;p&gt;Rimi foreksempel lanserte for en stund siden appen Rimi+. En app som lar brukeren lage handlelister fra sortementet til Rimi. Samtidig oppdaterte de Facebooksiden sin og lagde seg &lt;a href=&quot;http://twitter.com/RimiNorge&quot; title=&quot;Rimi på Twitter&quot;&gt;Twitterkonto&lt;/a&gt;. På Facebook har de også opprettet en supportfunksjon for appen sin. Her kan brukerne stille spørsmål og beskrive sine problemer med appen samt hjelpe andre med problemer, Rimi er også veldig aktive selv med å hjelpe brukerne.&lt;/p&gt;
&lt;!--more--&gt;
&lt;p&gt;&lt;a href=&quot;http://www.facebook.com/pages/Europris-Surnadal/151147641614180&quot; title=&quot;Europris Surnadal&quot;&gt;Europris Surnadal&lt;/a&gt; bruker Facebooksiden sin til å reklamere for nyheter, både varer og forandringer i butikken.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.facebook.com/sagatungrendahus&quot; title=&quot;Sagatun Grendahus&quot;&gt;Sagatun Grendahus&lt;/a&gt; derimot, bruker Facebook for å informere. Her finner man stort sett kontaktinformasjon og beskrivelse av lokalene. De bruker også Facebook til å svare på spørsmål angående huset.&lt;/p&gt;&lt;figure id=&quot;attachment_347&quot; style=&quot;width: 520px;&quot; class=&quot;wp-caption aligncenter&quot;&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2011/10/Using-Facebook-as-a-plan-of-doing-business.jpg&quot;&gt;&lt;img class=&quot;size-full wp-image-347&quot; title=&quot;Facebook&quot; src=&quot;https://andeers.com/wp-content/uploads/2011/10/Using-Facebook-as-a-plan-of-doing-business.jpg&quot; alt=&quot;Facebook&quot; width=&quot;520&quot; height=&quot;346&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;figcaption class=&quot;wp-caption-text&quot;&gt;Mange bedrifter bruker Facebook&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Er Facebook bare positivt?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Det er ikke bare for en bedrift å opprette en side på Facebook også blir dette automatisk en suksess. Det er viktig at de har en plan/strategi for hvordan siden skal brukes. Det er også viktig å tenke på at «alle» ser hva man gjør, sånn at man hele tiden holder en saklig tone og tenker på at man fremstår på vegne av bedriften. Og svarer man på ros er det viktig at man også svarer på kritikk.&lt;/p&gt;
&lt;p&gt;**Ikke gjør som Altibox… **&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.facebook.com/Altibox&quot; title=&quot;Altibox&quot;&gt;Alitbox har en Facebookside&lt;/a&gt; de bruker til å reklamere for nyheter og for å gi support til kundene sine. For en stund siden bestemte de seg for at Discovery Channel og noen flere kanaler ikke skulle være en del av grunnpakken deres. Noe som er greit. Problemet var at de ikke varslet om det på forhånd (noe som er ulovlig) og når irriterte kunder henvendte seg til dem på Facebook ble alle klager ignorert. Det mest usaklige var at det svarte på alle andre kundesupportspørsmål og  henvendelser.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2011/10/badrequest.jpg&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-350&quot; title=&quot;badrequest&quot; src=&quot;https://andeers.com/wp-content/uploads/2011/10/badrequest.jpg&quot; alt=&quot;Bad Request&quot; width=&quot;459&quot; height=&quot;118&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;En sånn oppførsel gir et veldig dårlig inntrykk av en bedrift, og er ikke en måte å oppføre seg på nett. Er man mottakelig for positiv respons må man være det for negativ respons også. Etter å sett mye på Altibox sin vegg, så ser det ut som de er virkelig serviceinnstilte nå, så det var kanskje en enkeltepisode.&lt;/p&gt;
&lt;p&gt;*Har du eksempler på god eller dårlig bruk av Facebook? *&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Komme i gang med Twitter</title>
		<link href="https://andeers.com/komme-i-gang-med-twitter/"/>
		<updated>2011-10-11T00:00:00Z</updated>
		<id>https://andeers.com/komme-i-gang-med-twitter/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;Twitter ble lansert i 2006 og er en mikrobloggingtjeneste som lar brukere legge ut oppdateringer på maks 140 tegn. Selv om det er enkelt å komme i gang med mikrobloggingen kan twitter være uoversiktlig og litt vanskelig å sette seg inn i. Twitter har i overkant av &lt;a href=&quot;http://socialtimes.com/200-million-twitter-accounts-but-how-many-are-active_b36952&quot; title=&quot;200 millioner brukere&quot;&gt;200 millioner brukere&lt;/a&gt; og det kan være ganske overveldende om man akkurat har logget inn for første gang. For det skjer ikke en verdens ting før man begynner å “følge” andre.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;1. Hva gjør man så på Twitter?&lt;/h2&gt;
&lt;p&gt;Når man følger andre vil det de legger ut dukke opp i din nyhetstrøm. Etterhvert som andre begynner å følge deg vil det du skriver også dukke opp i deres nyhetstrøm. Hele Twitter handler egentlig om nyhetstrømmen og det er hovedsaklig det Twitter er. Når andre legger ut et innlegg har du muligheten til markere innlegget som en favoritt, “retweete” eller svare på innlegget.&lt;/p&gt;
&lt;p&gt;Å merke et innlegg som en &lt;strong&gt;favoritt&lt;/strong&gt; betyr bare at innlegget lagres i en egen liste på profilen din, sånn at du får tak i innlegget senere. Jeg bruker stort sett funksjonen til å lagre innlegg med nyttige linker eller annet nyttig innhold når jeg har dårlig tid. Det er ikke alltid jeg rekker å gå inn på linken, sjekke innholdet og lagre bokmerke.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Retweet&lt;/strong&gt; betyr enkelt å greit at du tar innlegget til noen andre og legger det ut på din egen nyhetstrøm. For alle andre vil det vises at du retweeter innlegget til den andre personen. Retweeting brukes til å videreformidle morsomme eller nyttige innlegg.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Reply&lt;/strong&gt; betyr jo rett oversatt “svar”, men i twitter-sammenheng betyr det faktisk å legge ut et eget innlegg hvor personen du svarer er tagget. Det vil si at svaret du gir vil være synlig for alle.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;a href=&quot;https://andeers.com/wp-content/uploads/2011/10/androidTwitter.jpg&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-322&quot; title=&quot;Twitter for Android&quot; src=&quot;https://andeers.com/wp-content/uploads/2011/10/androidTwitter.jpg&quot; alt=&quot;Twitter&quot; width=&quot;500&quot; height=&quot;333&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;h2&gt;2. Noen spennende personer å følge&lt;/h2&gt;
&lt;!--more--&gt;
&lt;p&gt;Som tidligere sagt er ikke Twitter noe morsomt om man ikke følger noen. Siden jeg tar et fag som heter “Sosiale Medier” vil det være mest interessant å følge personer med interesse for sosiale medier.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://twitter.com/thomasmoen&quot; title=&quot;Thomas Moen&quot;&gt;Thomas Moen&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://twitter.com/hpnhansen&quot; title=&quot;Hans Petter N-Hansen&quot;&gt;Hans Petter N-Hansen&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://twitter.com/ceciliestaude&quot; title=&quot;Cecilie Staude&quot;&gt;Cecilie Staude&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://twitter.com/henriettehedlov&quot; title=&quot;Henriette Hedløv&quot;&gt;Henriette Hedløv&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://twitter.com/osol&quot; title=&quot;Øyvind Solstad&quot;&gt;Øyvind Solstad&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Dette er fem personer som er anbefalt å følge  i denne øvinga. Flere av de dukker opp ved et søk på “sosialemedier” og ser man på beskrivelsen deres ser man at alle sammen jobber / interesserer seg for sosiale medier.&lt;/p&gt;
&lt;p&gt;Siden jeg hadde et fag i fjor som også omhandlet bruk av Twitter litt, har faktisk fulgt hele gjengen en god stund nå. Og kan absolutt bekrefte at de skriver veldig mange gode innlegg om sosiale medier og teknologi. Så jeg kan anbefale andre å følge disse også.&lt;/p&gt;
&lt;h2&gt;3. Hvorfor bruke Twitter?&lt;/h2&gt;
&lt;p&gt;Jeg husker ikke helt hvorfor jeg opprettet en konto på twitter, men jeg kan tenke meg det var av nysgjerrighet. Nå har det blitt en naturlig del av min dag. På samme vis som jeg sjekker facebook sjekker jeg også twitter. Men twitter er absolutt hva du gjør det til. Følger du tre-fire kjedelige personer får du heller ikke noen god opplevelse. Følger du derimot folk og bedrifter som jobber med ting du interesserer deg for, vil twitter bli mye mer spennende.&lt;/p&gt;
&lt;p&gt;Start med å finne noen personer som har de interessene / fag-feltene du interesserer deg for, sjekk så hvem disse følger. På den måten kan du finne veldig mange interessante personer.&lt;/p&gt;
&lt;h2&gt;4. Litt om meg!&lt;/h2&gt;
&lt;p&gt;Som du kanskje har sett på høyresiden her, så har jeg også Twitter. Om du vil følge meg er brukernavnet mitt &lt;a href=&quot;http://twitter.com/andeersg&quot; title=&quot;Anders Grendstadbakk&quot;&gt;@andeersg&lt;/a&gt;. Jeg twittrer ikke så ekstremt mye, men prøver da å dele nyttige ting når jeg finner noe. Og blir alltid glad for å oppdage nye og spennende mennesker.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hva er ditt inntrykk av Twitter?&lt;/strong&gt;&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Sosiale medier &amp;#8211; Itfag</title>
		<link href="https://andeers.com/sosialemedier-itfag/"/>
		<updated>2011-10-02T00:00:00Z</updated>
		<id>https://andeers.com/sosialemedier-itfag/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;I år tar jeg et fag som heter &lt;a href=&quot;http://itfag.hist.no/public/fag/enkeltFag.jsp?fagkode=LN203D&quot; title=&quot;Sosiale Medier&quot;&gt;Sosiale Medier&lt;/a&gt; hos Itfag mens jeg studerer 3. året på Bachelor i IT-støttet bedriftsutvikling.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Sosiale medier er et nyoppstartet fag som kjøres for første gang dette semesteret. Opplegget ser veldig spennende ut med leksjoner, videoer og masse artikler om sosiale medier. Faget skal gi oss en bedre forståelse for hvordan sosiale medier kan tas i bruk av bedrifter, hvordan de forskjellige tjenestene og verktøyene kan utnyttes på best mulig måte. Faget kan absolutt anbefales til personer som er interessert i sosiale medier i &lt;strong&gt;bedriftssammenheng&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I Sosiale Medier er opplegget sånn at vi skriver alle oppgavene som blogginnlegg på hver vår &lt;strong&gt;blogg&lt;/strong&gt;. Dermed vil det bli mye godt lesestoff for den som interesserer seg for sosiale medier, her finner du linker til mange av bloggene:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://saxevik.blogspot.com/&quot; title=&quot;saxevik&quot;&gt;http://saxevik.blogspot.com &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ansa71.blogspot.com/&quot; title=&quot;ansa71&quot;&gt;http://ansa71.blogspot.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://andyarnt.blogspot.com/&quot; title=&quot;andyarnt&quot;&gt;http://andyarnt.blogspot.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://francisrath.wordpress.com/&quot; title=&quot;francisrath&quot;&gt;http://francisrath.wordpress.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ballacks1981.blogspot.com/&quot; title=&quot;ballacks1981&quot;&gt;http://ballacks1981.blogspot.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://sosialegraff.blogspot.com/&quot; title=&quot;sosialegraff&quot;&gt;http://sosialegraff.blogspot.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://karolibo.wordpress.com/&quot; title=&quot;karolibo&quot;&gt;http://karolibo.wordpress.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ln203d.wordpress.com/&quot; title=&quot;ln203d&quot;&gt;http://ln203d.wordpress.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://melvold.blogspot.com/&quot; title=&quot;melvold&quot;&gt;http://melvold.blogspot.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://roarla.wordpress.com/&quot; title=&quot;roarla&quot;&gt;http://roarla.wordpress.com&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;(Legger til flere etter hvert som folk kommer igang med faget)&lt;/p&gt;
&lt;p&gt;Tilslutt må jeg si jeg gleder meg til å komme skikkelig i gang med dette faget, sosiale medier er et veldig &lt;strong&gt;spennende tema&lt;/strong&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Pure Fiction &amp;#8211; Strategi for sosiale medier</title>
		<link href="https://andeers.com/pure-fiction-strategi-for-sosiale-medier/"/>
		<updated>2011-09-26T00:00:00Z</updated>
		<id>https://andeers.com/pure-fiction-strategi-for-sosiale-medier/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;Pure Fiction ble startet i 1999 i Trondheim. Vi jobber med rådgivning og strategi for bedrifter. Vi har siden oppstart opparbeidet oss noen faste kunder og bortsett fra det kommer det noen nye kunder via de gamle. Vi har nå vurdert en stund hvordan vi kan etablere oss på sosiale medier og dermed skape mer interesse for firmaet.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Vi har et ønske om å vises bedre på nett, skape en dialog med brukere og øke kunnskapen om firmaet. vi føler de kan øke folks kunnskap om oss ved at vi er mer aktiv på sosiale medier som f.eks Facebook. Vi kan også tenke oss å ha en blogg hvor ansatte og ledelsen kan dele kunnskap, fortelle mer om hva firmaet driver med og gi kunder og andre et inntrykk av oss.&lt;/p&gt;
&lt;p&gt;Her kommer vår strategi for sosiale medier presentert via &lt;a href=&quot;http://slideshare.net/&quot; title=&quot;Slideshare&quot;&gt;Slideshare&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pure Fiction&lt;/strong&gt; er et fiktivt firma oppdiktet for bruk i faget &lt;a href=&quot;http://itfag.hist.no/public/fag/enkeltFag.jsp?fagkode=LN203D&quot; title=&quot;Sosiale Medier&quot;&gt;Sosiale Medier&lt;/a&gt;. Dette er også mitt første forsøk på en slideshare-presentasjon, hva syns du om den? **Kunne noe vært gjort annerledes (bedre)? **&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Hva er en strategi?</title>
		<link href="https://andeers.com/hva-er-en-strategi/"/>
		<updated>2011-09-20T00:00:00Z</updated>
		<id>https://andeers.com/hva-er-en-strategi/</id>
		<content type="html">&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img class=&quot;   aligncenter&quot; title=&quot;SocialMediaCloud&quot; src=&quot;https://farm6.static.flickr.com/5091/5440728466_149c85e39c_z.jpg&quot; alt=&quot;SocialMediaCloud&quot; width=&quot;518&quot; height=&quot;351&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hvordan skal man lage en strategi for bruk av sosiale medier, og trenger man en strategi for sosiale medier?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Situasjonen i dag&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;De fleste er å finne på forskjellige sosiale nettverk nå, bare i Norge har facebook over &lt;a href=&quot;http://avis.dn.no/artikler/avis/article398249.ece&quot; title=&quot;Dagens Næringsliv&quot;&gt;2,4 millioner medlemmer&lt;/a&gt;. Dermed sier det seg selv at man når ut til veldig mange om man har en profil på et (eller flere) sosiale nettverk. Mange bedrifter har opprettet side på facebook, opprettet twitter-konto og opprettet blogg allerede, og man ser flere og flere komme etter.&lt;/p&gt;
&lt;p&gt;Hva skal man så gjøre da? Opprette en facebook-side, gi ansvaret til en ansatt og la han styre siden? **NEI. **Skal man etablere seg på sosiale nettverk er det viktig at man har en plan. Man må sette seg mål man vil oppnå, hvem som skal delta, sette retningslinjer for hva som skal deles og hva man vil oppnå.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hva er det man egentlig vil?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Hvorfor skal man etablere seg på sosiale nettverk? Hva vil man oppnå? Hvordan vet vi  at vi har oppnådd det? Sånne spørsmål kan man finne 100 av om man bare tenker seg godt om. Og det er kanskje lurt, for hva skal man egentlig med en bedriftsblogg? Har bedriften i det hele tatt tenkt på det?&lt;/p&gt;
&lt;p&gt;Jeg tror at det er veldig lurt å sette ned konkrete planer, mål og fremgangsmåter i starten. For eksempel kan dette være en fremgangsmåte i starten:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Det skal skrives ca to innlegg hver uke den første måneden.&lt;/li&gt;
&lt;li&gt;De ansatte i avdeling-X skal skrive disse.&lt;/li&gt;
&lt;li&gt;Etter en måned undersøker vi trafikken, hva leserne syns og hvilke grupper som leser bloggen.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Jeg tror at det er viktig å sette seg både kortsiktige og langsiktige mål for hva man vil oppnå. Et kortsiktig mål kan f.eks være at iløpet av første måneden skal facebook-siden få 100 “likes”. Langsiktige mål kan være å få økt trafikken på hjemmesiden til bedriften med x antall prosent, selge mer, kutte ned på reklamekostnader eller lignende. Jeg tror det er viktig at målene man setter seg faktisk kan måles.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Langsiktig&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;En ting som er veldig &lt;strong&gt;viktig&lt;/strong&gt; er at man ikke “glemmer” de sosiale nettverkene. Det er lite som gir meg et dårligere inntrykk enn en firmaside på facebook der man ser veldig tydelig at bedriften var aktive i tre uker etter de lanserte siden, for så å glemme siden helt.&lt;/p&gt;
&lt;p&gt;Skal man være tilstede på sosiale nettverk må dette inkluderes i rutinene til bedriften, sånn at det ikke glemmes vekk. Om man ikke tror man klarer å holde de sosiale profilene aktive er det bedre å ikke begynne.&lt;/p&gt;
&lt;p&gt;Til slutt vil jeg si at det viktigste er å tenke nøye gjennom hva man vil oppnå.&lt;/p&gt;
&lt;p&gt;Hva syns &lt;strong&gt;du&lt;/strong&gt; om bedriftsblogger?&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Automatiser internett</title>
		<link href="https://andeers.com/automatiserinternett/"/>
		<updated>2011-09-19T00:00:00Z</updated>
		<id>https://andeers.com/automatiserinternett/</id>
		<content type="html">&lt;p&gt;I dag oppdaget jeg en ny tjeneste på nett med det spennende&lt;a href=&quot;http://ifttt.com/&quot;&gt;&lt;img class=&quot;alignright size-full wp-image-242&quot; title=&quot;ifttt-logo&quot; src=&quot;https://andeers.com/wp-content/uploads/2011/09/ifttt-logo.png&quot; alt=&quot;Ifthisthenthat&quot; width=&quot;162&quot; height=&quot;114&quot; /&gt;&lt;/a&gt; navnet &lt;strong&gt;ifttt&lt;/strong&gt; eller “If this then” that som bokstavene står for. En tjeneste som lar deg sette opp automatiske rutiner basert på hendelser i forskjellige nettverk. &lt;a href=&quot;http://ifttt.com/&quot; title=&quot;If this then that&quot;&gt;Tjenesten kan du sjekke ut her&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hva brukes det til?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Denne tjenesten har veldig mange muligheter, man kan foreksempel koble WordPress-bloggen sin til tjenesten og sette opp at hver gang du poster et nytt innlegg skal dette postes på Twitter.&lt;/p&gt;
&lt;p&gt;Totalt så teller jeg nå 35 forskjellige tjenester man kan koble opp til &lt;strong&gt;ifttt&lt;/strong&gt;, noe som gir store muligheter til å automatisere mange kjedelige ting.&lt;/p&gt;
&lt;p&gt;Her er en annen prosedyre jeg har satt opp:&lt;/p&gt;&lt;figure id=&quot;attachment_245&quot; style=&quot;width: 494px;&quot; class=&quot;wp-caption alignleft&quot;&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2011/09/ifttt-task.png&quot;&gt;&lt;img class=&quot;size-full wp-image-245&quot; title=&quot;Facebook koblet opp med Dropbox&quot; src=&quot;https://andeers.com/wp-content/uploads/2011/09/ifttt-task.png&quot; alt=&quot;Facebook koblet opp med Dropbox&quot; width=&quot;494&quot; height=&quot;188&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;figcaption class=&quot;wp-caption-text&quot;&gt;Blider jeg blir tagget i, lagres i Dropbox&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Det er veldig mange og spennende muligheter og kombinasjoner, så jeg anbefaler alle å prøve tjenesten. Den koster heller ingenting, så det er bare å gå &lt;a href=&quot;http://ifttt.com/&quot; title=&quot;Ifttt&quot;&gt;hit&lt;/a&gt; og prøve.&lt;/p&gt;
&lt;p&gt;Har du prøvd? Hva syns du?&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Forventningsfaktorer i sosiale medier</title>
		<link href="https://andeers.com/forventningsfaktorer-i-sosiale-medier/"/>
		<updated>2011-09-18T00:00:00Z</updated>
		<id>https://andeers.com/forventningsfaktorer-i-sosiale-medier/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;Veldig mange bedrifter skaffer seg blogg, og begynner å blogge. Men hvordan opptrer man på en fornuftig og god måte?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Når man tar i bruk soiale medier er det viktig å fremstå ordentlig, sånn at leserne får et bra inntrykk av bedriften. Man kan bruke** forventningsfaktorer** for å gi et bra og ordentlig bilde av bedriften sin.&lt;/p&gt;
&lt;p&gt;Lar man medarbeidere få skrive innlegg og komme med meninger gir man bloggen mye mer troverdighet enn at bare sjefen og pr-avdeling skal blogge. Å være god til å svare leserne, ta i bruk facebook, og twitter gir leserne et inntrykk av at de blir hørt, og de får et bedre inntrykk av firmaet.&lt;/p&gt;
&lt;p&gt;Skal man ha en bedriftsblogg er det veldig viktig at man fremstår seriøst og ikke bare tuller. Her har jeg funnet noen eksempler på bedriftsblogger som er flinke på forventningsfaktorer:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://pengeroglivet.blogs.com/&quot; title=&quot;Sparebank1&quot;&gt;Sparebank1:&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Når jeg leser gjennom Sparebank1 sin blogg får jeg et stort inntrykk av at dette er troverdig. De har sju navngitte personer som jobber med bloggen, noe som for meg gir hele bloggen mye mer kvalitet enn at alle innlegg skulle hatt en forfatter med brukernavn “admin” eller lignende.&lt;/p&gt;
&lt;p&gt;De har veldig mange nyttige artikler som f.eks omhandler id-tyveri, håndtrykk og omdømme, men også mer morsomme artikler som &lt;a href=&quot;http://pengeroglivet.blogs.com/penger_og_livet/2011/09/kan-en-bank-svinge-rocke-eller-rappe.html&quot; title=&quot;Banmkusikk på Spotify&quot;&gt;denne&lt;/a&gt; som forteller at de har samlet masse musikk de omtaler som “&lt;a href=&quot;http://open.spotify.com/user/chrisbros/playlist/7tMcDVn80k3Yfkdz4L8rrf&quot; title=&quot;Bankmusikk&quot;&gt;bankmusikk&lt;/a&gt;” på Spotify. Sånne artikler som det gir meg litt innsikt i hverdagen deres føler jeg, jeg får det inntrykket at man kan ha det morsomt selv i et stort seriøst firma.&lt;/p&gt;&lt;figure id=&quot;attachment_228&quot; style=&quot;width: 517px;&quot; class=&quot;wp-caption aligncenter&quot;&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2011/09/pengeroglivet1.png&quot;&gt;&lt;img class=&quot;size-large wp-image-228   &quot; title=&quot;pengeroglivet&quot; src=&quot;https://andeers.com/wp-content/uploads/2011/09/pengeroglivet1-1024x508.png&quot; alt=&quot;Penger og Livet&quot; width=&quot;517&quot; height=&quot;257&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;figcaption class=&quot;wp-caption-text&quot;&gt;Penger og Livet&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;En annen blogg jeg vil trekke frem er &lt;a href=&quot;http://nrkbeta.no/&quot; title=&quot;NRKBeta&quot;&gt;NRKBeta&lt;/a&gt;, NRK sin blogg om internett, nye teknologier og sosiale medier:&lt;/p&gt;
&lt;p&gt;Som Sparebank1 sin blogg så er det her også flere navngitte personer som tar seg av skrivingen. NRKBeta omhandler teknologi, utvikling, sosiale medier og andre spennende tema innenfor teknologi, media og web 2.0.&lt;/p&gt;
&lt;p&gt;NRKBeta er veldig gode på respons til leserne sine i kommentarfelt og på Twitter. I dette &lt;a href=&quot;http://nrkbeta.no/2011/09/14/hvilken-vei-gar-egentlig-tallene/&quot; title=&quot;Hvilken vei går egentlig tallene?&quot;&gt;innlegget&lt;/a&gt; foreksempel ser man at artikkelforfatteren er raskt ute med å bli med i samtalene som oppstår i kommentarfeltet. Han svarer raskt, er saklig og bidrar videre til diskusjonen rundt temaet.&lt;/p&gt;
&lt;p&gt;Det gir meg et veldig godt inntrykk av NRKBeta.&lt;/p&gt;&lt;figure id=&quot;attachment_229&quot; style=&quot;width: 516px;&quot; class=&quot;wp-caption aligncenter&quot;&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2011/09/nrkbeta1.png&quot;&gt;&lt;img class=&quot;size-large wp-image-229   &quot; title=&quot;nrkbeta&quot; src=&quot;https://andeers.com/wp-content/uploads/2011/09/nrkbeta1-1024x509.png&quot; alt=&quot;NRKBeta&quot; width=&quot;516&quot; height=&quot;256&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;figcaption class=&quot;wp-caption-text&quot;&gt;NRKBeta&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Generelt kan man vel si at når bloggene blir brukt på gode måter med nyttige artikler og ikke fremstår som bare reklame for bedriften så får man straks et bedre inntrykk. At man lar ansatte skrive artikler hjelper også veldig på troverdigheten til bloggen. Men det viktigste, iallefall det jeg syns er viktigst, er at forfatterne er flinke til å følge opp artiklene sine, kommentere, bidra med mer enn å bare skrive selve innlegget. Da får jeg virkelig et inntrykk av at de legger ned en innsats i bloggen.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Facebook med Subscribe-button</title>
		<link href="https://andeers.com/facebook-med-subscribe-button/"/>
		<updated>2011-09-15T00:00:00Z</updated>
		<id>https://andeers.com/facebook-med-subscribe-button/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;De siste dagene har Facebook gitt brukere muligheten til å aktivere en “subscribe”-knapp som man kan ha på siden sin.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Før måtte man være venn med personene for å ha mulighet til å se statusoppdateringer, nå gir facebook deg muligheten til å følge andre brukere uten å være venn med de.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2011/09/Skjermbilde-2011-09-15-kl.-14.46.06.png&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-216&quot; title=&quot;subscribe&quot; src=&quot;https://andeers.com/wp-content/uploads/2011/09/Skjermbilde-2011-09-15-kl.-14.46.06-300x37.png&quot; alt=&quot;Subscribe-button&quot; width=&quot;300&quot; height=&quot;37&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Det eneste som kreves er at de har slått på muligheten for subscribers. Noe man kan gjøre &lt;a href=&quot;https://www.facebook.com/about/subscribe&quot; title=&quot;Subscribe&quot;&gt;her&lt;/a&gt;. Når du har aktivert det vil brukere som ikke er venn med deg få opp en knapp ved siden av “venneforespørsel” som lar brukeren “subscribe” eller følge deg. Da vil personene som følger deg få opp alle statusoppdateringer du skriver med personverninnstilling “Public” på sin egen vegg.&lt;/p&gt;
&lt;p&gt;Jeg syns dette er en nyttig funksjon som gir mye muligheter for brukerne på Facebook. Vil du følge meg, trykk &lt;a href=&quot;https://www.facebook.com/andeersg&quot; title=&quot;Anders&quot;&gt;her&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Hva syns du om funksjonen?&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Anbefaling: Instapaper</title>
		<link href="https://andeers.com/anbefaling-instapaper/"/>
		<updated>2011-09-14T00:00:00Z</updated>
		<id>https://andeers.com/anbefaling-instapaper/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://www.instapaper.com/&quot; title=&quot;Instapaper&quot;&gt;Instapaper&lt;/a&gt; gir deg muligheten til å lagre artikler&lt;a href=&quot;http://www.instapaper.com/&quot;&gt;&lt;img class=&quot;alignright size-full wp-image-203&quot; title=&quot;InstapaperLogo&quot; src=&quot;https://andeers.com/wp-content/uploads/2011/09/Skjermbilde-2011-09-14-kl.-09.55.12.png&quot; alt=&quot;InstapaperLogo&quot; width=&quot;203&quot; height=&quot;52&quot; /&gt;&lt;/a&gt; du finner på nett på en enkel måte, spare deg for hundrevis av bokmerker og du slipper å fylle nettleseren med faner.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Jeg har en stor uvane, etter jeg tar en nettleser i bruk går det maks 3 dager så har jeg minimum 15 faner oppe. Som regel er det artikler jeg har planer om å lese, guider jeg skal følge eller noe annet jeg skal sjekke når jeg får bedre tid. Resultatet blir dermed at jeg etter hvert når fanene er så mange at man ikke lengre kan lese hva de inneholder, putter de sidene som jeg har tenkt å lese i bokmerker. Noe som resulterer i at jeg får hundrevis av bokmerker i forskjellige mapper.&lt;/p&gt;
&lt;p&gt;Bokmerker tenker jeg at egentlig skal de brukes til å lagre nettsider man bruker ofte, ikke til å lagre alle slags artikler man har tenkt å lese senere.&lt;/p&gt;
&lt;p&gt;For å forandre på dette begynte jeg å søke litt rundt, og etter litt fant jeg &lt;a href=&quot;http://www.instapaper.com/&quot; title=&quot;Instapaper&quot;&gt;Instapaper&lt;/a&gt;. Instapaper er en nettside som lagrer artikler for deg, på en veldig enkel måte. Du får et bokmerke som det lønner seg å plassere lett tilgjengelig i en bokmerkelinje eller lignende. Og dermed er det bare å trykke på bokmerket mens du er på en side du kan tenke deg å lese senere.&lt;/p&gt;
&lt;p&gt;Instapaper lagrer deretter siden i kontoen din, sånn at du bare kan logge inn og lese artiklene senere. Du har også mulighet til å laste ned artikler til Kindle eller lignende, noe som gir deg mulighet til å lese artikler uten internett.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2011/09/Skjermbilde-2011-09-14-kl.-09.48.21.png&quot;&gt;&lt;img class=&quot;alignleft size-medium wp-image-200&quot; title=&quot;InstapaperScreen&quot; src=&quot;https://andeers.com/wp-content/uploads/2011/09/Skjermbilde-2011-09-14-kl.-09.48.21-300x187.png&quot; alt=&quot;Instapaper Screenshot&quot; width=&quot;300&quot; height=&quot;187&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Itfag sin blogg &amp;#8211; Liten analyse</title>
		<link href="https://andeers.com/itfag-sin-blogg/"/>
		<updated>2011-09-08T00:00:00Z</updated>
		<id>https://andeers.com/itfag-sin-blogg/</id>
		<content type="html">&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://andeers.com/wp-content/uploads/2011/09/itfagBlogg.png&quot;&gt;&lt;img class=&quot;alignright size-thumbnail wp-image-186&quot; title=&quot;itfagBlogg&quot; src=&quot;https://andeers.com/wp-content/uploads/2011/09/itfagBlogg-150x150.png&quot; alt=&quot;itfagBlogg&quot; width=&quot;150&quot; height=&quot;150&quot; /&gt;&lt;/a&gt;Itfag er en blogg skrevet av lærere ved HiST. På bloggen deler de informasjon om fag de kjører, tips og triks innen teknologi og annen nyttig informasjon for it-studenter og andre interesserte.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Itfag-bloggen ble startet opp i Juni 2010, og har siden da vært en aktiv blogg med flere bidragsytere. Det er hovedsaklig lærere og ansatte ved Aitel som er forfattere. Bloggen inneholder mange artikler om fag man kan velge, erfaringer og oppgaver fra fagene, teknologi-tips og anbefalinger av programmer, metoder og operativsystem.&lt;/p&gt;
&lt;p&gt;Denne bloggen henvender seg mot studenter, folk i jobb som tenker å utvide kunnskapen sin, lærere og andre med interesse for nettbasert læring, teknologi og utdanning. Jeg kan tenke meg den har tre hovedfunksjoner:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Reklamere&lt;/strong&gt; for Itfag&lt;/li&gt;
&lt;li&gt;Gi &lt;strong&gt;informasjon&lt;/strong&gt; til studenter&lt;/li&gt;
&lt;li&gt;Dele nyttige &lt;strong&gt;tips og triks&lt;/strong&gt; med andre&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I &lt;a href=&quot;http://blogg.itfag.hist.no/2011/08/25/i-dag-har-jeg-ikke-gjort-noen-ting/&quot; title=&quot;Webinar om GTD&quot;&gt;blogginnlegget&lt;/a&gt; som omhandler webinaret om metoden “Getting Things Done” ser man at det er hovedsaklig lærere og andre folk som driver med læring som har kommentert. I &lt;a href=&quot;http://blogg.itfag.hist.no/2011/08/08/det-ma-v%C3%A6re-lov-a-kose-seg/&quot; title=&quot;Jenter og ingeniørstudier&quot;&gt;blogginnlegget&lt;/a&gt; om jenter og ingeniørstudier er det derimot flere studenter som har svart. Hvem som kommenterer kommer veldig an på hva innlegget handler om, noe som er ganske naturlig da forskjellige målgrupper interesserer seg for forskjellige ting.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Kommentarer&lt;/strong&gt; gir leserne en mulighet til å gi tilbakemeldinger til bloggeren. Lesere kan være med å diskutere innholdet i innlegget, de kan si sin mening om saken og det er en fin plass for diskusjon rundt temaer. Itfag er veldig gode til å ikke glemme innleggene sine etter at de er publisert, de følger hele tiden opp kommentarer som kommer og svarer leserne. I disse to eksemplene over ser man at forfatterne av innleggene er flinke til å følge opp og svare på kommentarer.&lt;/p&gt;
&lt;p&gt;Bloggen bruker &lt;a href=&quot;http://www.wordpress.org/&quot; title=&quot;Wordpress.org&quot;&gt;WordPress&lt;/a&gt; som bloggplatform, en gratis løsning som blir brukt av veldig mange bloggere. Den enkleste måten å sjekke hva slags plattform en blogg bruker er ofte å sjekke hva som står skrevet i footeren (Nederste delen av nettsiden). På Itfag ser man wordpress-logoen helt ned til venstre. Om man ikke finner noen kjennetegn åpenlyst kan man ta en titt på kildekoden.&lt;/p&gt;
&lt;p&gt;I kildekoden kan man lete etter denne linjen: &lt;strong&gt;&amp;lt;meta name=”generator” content=”WordPress 3.0.1″ /&amp;gt;&lt;/strong&gt;. Den skal ligge i head-seksjonen om det er en WordPress-blogg. Et annet kjennetegn på at det er WordPress er at mange linker inneholder mapper som begynner på wp, f.eks &lt;strong&gt;wp-content&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Grunnen til at de har valgt WordPress er nok at det er en av de beste plattformene for blogging nå. Veldig mange store firmaer har blogger drevet av WordPress, og det er jo et tegn på at det fungerer veldig godt. WordPress har også veldig god funksjonalitet og masse funksjoner som gjør blogging enkelt. Blant annet kan flere brukere være knyttet til samme blogg, det er lett å plassere bilder i innlegg og det er lett å administrere alle innlegg, kommentarer og sider.&lt;/p&gt;
&lt;p&gt;Når jeg ser på valget av tema til bloggen syns jeg de heller skulle lagd et eget tema. De heter Itfag og jeg vil tro de har kunnskapen til å designe et tema som er unikt for dem. Personlig syns jeg det er mye mer interessant når jeg kommer inn på en blogg og ser noe unikt ( Fullt klar over at jeg ikke har laget temaet jeg bruker heller ). Iallefall syns jeg de kunne byttet ut faviconet med et mer unikt og gjenkjennelig. Bortsett fra dette har de absolutt valgt et &lt;a href=&quot;http://wordpress.org/extend/themes/jq&quot; title=&quot;JQ&quot;&gt;tema&lt;/a&gt; med god funksjonalitet, funksjonen som lar meg redusere alle innleggene på fremsiden til bare overskrifter er veldig kjekk når man leter etter innlegg.&lt;/p&gt;
&lt;p&gt;Jeg syns bloggen er en viktig ressurs for Itfag. De selger nettbaserte fag og bloggen er en smart måte å reklamere på. Interesserte personer kan gå inn og lese mer om fagene de har lyst til å ta, kommentere og dermed sitte igjen med et veldig godt inntrykk.&lt;/p&gt;
&lt;p&gt;Siden du har kommet ned hit betyr det at du nå har lest deg gjennom mine tanker rundt &lt;a href=&quot;http://blogg.itfag.hist.no/&quot; title=&quot;Itfag&quot;&gt;blogg.itfag.hist.no&lt;/a&gt;. Grunnen til at jeg har skrevet dette er fordi jeg tar et fag som heter &lt;a href=&quot;http://itfag.hist.no/public/fag/enkeltFag.jsp?fagkode=LN203D&quot; title=&quot;Sosiale Medier&quot;&gt;Sosiale Medier&lt;/a&gt; hos Itfag, og dette har vært en del av den første øvinga. Den første øvinga kan du lese &lt;a href=&quot;http://aitel.hist.no/fag/sos/sos-oving1.pdf&quot; title=&quot;Øving 1&quot;&gt;her&lt;/a&gt; om du er interessert.&lt;/p&gt;
&lt;p&gt;Har du synspunkter rundt det jeg har skrevet? Sleng gjerne igjen en kommentar.&lt;/p&gt;
&lt;p&gt;Anders Grendstadbakk&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Skolestart!</title>
		<link href="https://andeers.com/skolestart/"/>
		<updated>2011-09-05T00:00:00Z</updated>
		<id>https://andeers.com/skolestart/</id>
		<content type="html">&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;skoleår, 5. semester, snart ferdig med bachelor-grad.. Tiden går kjapt!&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Nest siste semester har herved startet og etter mye vurdering er jeg ganske sikker på fagene jeg har valgt.&lt;/p&gt;
&lt;p&gt;Bortsett fra standardfagene jeg må ha har jeg valgt Sosiale Medier og Webprogrammering med PHP. Så denne høsten skal jeg også bruke bloggen min i faglig sammenheng. Sosiale Medier benytter blogg i fagopplegget.&lt;/p&gt;
&lt;p&gt;PHP ser jeg virkelig frem til å lære meg. Har brukt html/css og litt javascript i flere år nå, og gleder meg til å lære et språk som virkelig kan gi nettsider mer funksjonalitet.&lt;/p&gt;
&lt;p&gt;Ellers så begynner jo spørsmålet om hva som skal skje om ca ett år å komme, master eller jobb? Absolutt ikke godt å vite, men jeg tenker at det sikkert lønner seg å prøve å finne en master og ta denne.&lt;/p&gt;
&lt;p&gt;En annen ny ting er temaet jeg har på bloggen min. Jeg har valgt å kjøpe meg ett, og gikk for Standard Theme. Likte dette temaet veldig fra første gang jeg så det. Så nå blir det litt justeringer og fiksing til jeg blir helt fornøyd.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Planlegge et nytt design</title>
		<link href="https://andeers.com/planlegge-et-nytt-design/"/>
		<updated>2011-07-10T00:00:00Z</updated>
		<id>https://andeers.com/planlegge-et-nytt-design/</id>
		<content type="html">&lt;p&gt;Selv om det ikke er lenge siden jeg lagde dette designet som jeg har på siden nå, så er jeg ikke fornøyd og har begynt å planlegge et nytt ett.&lt;/p&gt;
&lt;p&gt;Noe som ikke er så enkelt, jeg vet ikke helt hvordan jeg vil ha det. Så de siste dagene har jeg brukt på å lete rundt på internett etter blogger og nettsider for å få litt inspirasjon.&lt;/p&gt;
&lt;p&gt;Jeg har satt meg det målet at det nye designet skal bli litt mer innholdsrikt i forhold til dette her.&lt;/p&gt;
&lt;p&gt;Etter å ha sett litt rundt om kring på nett har jeg begynt å planlegge litt mer. Jeg skriver ned en liste over forskjellige ting jeg vil ha med som farger, bilder og andre elementer også begynner jeg så smått å redigere et tomt theme jeg har.&lt;/p&gt;
&lt;p&gt;Videre har jeg bestemt meg for at jeg skal prøve å holde meg til det jeg har notert nå og ikke forandre ting absolutt hele tiden som jeg ellers gjør. Så får vi håpe at det kommer noe godt ut av dette.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Hva skal man velge?</title>
		<link href="https://andeers.com/hva-skal-man-velge/"/>
		<updated>2011-06-09T00:00:00Z</updated>
		<id>https://andeers.com/hva-skal-man-velge/</id>
		<content type="html">&lt;p&gt;Eksamensresultatene fra vår-semesteret har kommet og jeg kan kalle semesteret for ferdig. Men nå begynner tankene rundt hva slags fag jeg skal velge til høsten. Foreløpig står det mellom:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://itfag.hist.no/public/fag/enkeltFag.jsp?fagkode=LV197D&quot; title=&quot;Webprogrammering i PHP&quot;&gt;Webprogrammering i PHP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://itfag.hist.no/public/fag/enkeltFag.jsp?fagkode=LV199D&quot; title=&quot;Webprogrammering i ASP.NET&quot;&gt;Webprogrammering i ASP.NET&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://itfag.hist.no/public/fag/enkeltFag.jsp?fagkode=LN202D&quot; title=&quot;Html5&quot;&gt;Html5&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://itfag.hist.no/public/fag/enkeltFag.jsp?fagkode=LN203D&quot; title=&quot;Sosiale Medier&quot;&gt;Sosiale Medier&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;De to webprogrammeringsfagene er valgfag vi kan velge mellom som en del av studiet, de to andre vurderer jeg å ta som bonusfag. Jeg ser for meg at det kan bli krevende å skulle ha flere av de samtidig, men alle ser virkelig interessante ut.&lt;/p&gt;
&lt;!--more--&gt;
&lt;p&gt;Personlig syns jeg PHP ser mye mer spennende ut enn ASP.Net, men jeg vet ikke hva som kan være mest taktisk med tanke på fremtidig jobb?&lt;/p&gt;
&lt;p&gt;Sosiale medier og html5 skal jeg ta, må bare finne ut når det passer best.&lt;/p&gt;
&lt;p&gt;Html5 tar for seg mulighetene man har og hvordan man kan utnytte html best. Faget ser også på css3, noe som virker veldig spennende. Jeg bruker css3 litt på denne nettsiden også.&lt;/p&gt;
&lt;p&gt;Sosiale Medier ser på bruken av Facebook og Twitter i bedriftssammenheng.&lt;/p&gt;
&lt;p&gt;Planen fremover er å lese mye om de forskjellige språkene, også prøve å finne ut når de forskjellige fagene passer best i forhold til andre fag.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Blogging på mobil</title>
		<link href="https://andeers.com/blogging-pa-mobil/"/>
		<updated>2011-05-30T00:00:00Z</updated>
		<id>https://andeers.com/blogging-pa-mobil/</id>
		<content type="html">&lt;p&gt;Nå har jeg installert WordPress for Android og begynt å teste dette så smått.&lt;/p&gt;
&lt;p&gt;Jeg kan med en gang si at det ikke er det samme som å bruke en pc, men det fungerer for små innlegg eller kladding.&lt;br /&gt;
Det som er mest genialt er mulighetene til å skrive uten tilgang til internett. Man kan begynne på et innlegg og når man får internett igjen kan man laste opp det man har skrevet.&lt;/p&gt;
&lt;p&gt;Ellers har man muligheten til å laste opp bilder, formatere teksten og legge til tags. Så man kan lage fullverdige blogginnlegg med mobilen.&lt;/p&gt;
&lt;p&gt;Personlig vil jeg nok si at jeg foretrekker å skrive på pc med litt større skjerm og bedre tastatur enn mobiler, men absolutt kjekt å ha om man føler for å kladde litt på et innlegg.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Forandringer!</title>
		<link href="https://andeers.com/forandringer/"/>
		<updated>2011-05-22T00:00:00Z</updated>
		<id>https://andeers.com/forandringer/</id>
		<content type="html">&lt;p&gt;Nå går semesteret mot slutten og da begynner jeg endelig å få litt tid til nettstede mitt igjen. Jeg har derfor bestemt meg for å lage et helt nytt design, da jeg jeg ikke var helt fornøyd med det gamle.&lt;/p&gt;
&lt;p&gt;Nå er det 33 timer til det er skoleferie og det skal feires sammen med klassen på kvelden. Så er planen for resten av sommeren å skaffe seg jobb i Trondheim. Så forhåpentligvis blir det mye tid til å fikse og trikse med nettstedet.&lt;/p&gt;
&lt;p&gt;Snakkes 😉&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>#SoMeWebinar</title>
		<link href="https://andeers.com/somewebinar/"/>
		<updated>2011-03-18T00:00:00Z</updated>
		<id>https://andeers.com/somewebinar/</id>
		<content type="html">&lt;p&gt;I dag hadde vi en forelesning utenom det vanlige. Vi skulle ha forelesning om sosiale medier i faget Samarbeidsteknologi og skulle derfor prøve noe nytt.&lt;/p&gt;
&lt;p&gt;Vi brukte Adobe Connect, en nettbasert løsning for foredrag. Ved hjelp av Twitter hadde læreren fått tak i 5-6 personer som holdt forskjellige fordrag om sitt forhold til sosiale medier.&lt;/p&gt;
&lt;p&gt;Adobe Connect lar foredragsholderne dele skjermen sin, vise en powerpoint-presentasjon, snakke og bruke webcam. Noe som fungerte veldig bra hele tiden, med unntak av enkelte tilfeller hvor lyden falt vekk.&lt;/p&gt;
&lt;p&gt;Men, det beste med hele greia er at om man kobler dataen til tven, så kan man sitte i sofaen, spise frokost og slappe av mens man er på forelesning. Absolutt min type forelesning.&lt;/p&gt;
</content>
	</entry>
</feed>