My favorite shortcuts

Dear future me, you are welcome.

This is list of my favorite shortcuts for different programs / environments.

Windows 10

win + shift + left/right arrow

move windows from one monitor to another

 

Visual Studio

ctrl + M + M

collapse/expand current region or method

 

ctrl + M + O

collapse all regions and methods

 

ctrl + M + L

expand all regions and methods

 

ctrl + ]

go to matching bracket / region / comment / tag / etc.

 

ctrl + L OR ctrl + X

cut whole line to clip board

 

ctrl + ,

search accross all files and types (classes, enums, methods etc.) Super Powerfull

 

ctrl + shift + space

show possible overloads (arguments) for method

 

ctrl + shift + up/down arrow

jump to previos/next reference in current file

 

ctrl + .

hints/options to help you resolve errors

 

ctrl + alt + P

attach to process while debugging

 

ctrl + alt + L

go to solution explorer

 

ctrl + ;

go to solution explorer search

 

ctrl + K + S

wrap (surround with) selection into code snippet (migth be if, function, try, etc.)

 

ctr + [ + S

find the currently active file in Solution explorer

 

ctrl + alt + home

keep tab open

 

Visual Studio + Web Essentials

shift + alt + W

wrap (surround with) some content with HTML tag

 

Chrome Developer Tools

ctrl + ]/[

move forward/backward within tabs (Elements, Console, Sources…)

 

ctrl + O

opens search box to find source file by name

 

ctrl + shift + F

search accross all source files

 

ctrl + F

search within active source file

 

alt + W

on Sources tab, closes actvie source file

 

ctrl + B

adds a breakpoint into cursor line of active source file

 

ESC

opnes/closes console (at the bottom of window)

How to quickly test some C# code?

From time to time I want to check behaviour of native API. In JavaScript it is really easy, just start browser, open console and you are good to go.

With .NET it is not so straightforward. You need to start your IDE, usually Visual Studio, create new console project and after you are done with what you wanted to do, cleanup – remove the console project, if you do not want to end up with TestProject-142.

I am glad I have found the https://dotnetfiddle.net/, which allows me to test native .NET API instantly, without new project overhead. Thanks for the project!

Download all .zip files on web page by JavaScript

For certain project I needed to download 600+ zip files containing information. I created tiny script using jQuery and vanilla JavaScript to download the files automatically.

Set up your browser to save files without asking for the file location, open browser console of your page and copy & paste the script in there.

// get URLS of all the zips
var allUrls = jQuery("a[href$='.zip']");
var downloadWindow = { closed:true };
var downloaded = [];
var errors = [];

var intervalId = setInterval(function(){

  // in case of error, close the opened window
  if (downloadWindow.document && 
      downloadWindow.document.readyState === 'complete') {
    errors.push(downloadWindow.location.href);
    downloadWindow.close();
  }

  // when the window is closed start new download, if there are unprocessed URLs
  if (downloadWindow.closed) {
    if (allUrls.length > 0) {
      var url = allUrls[0].href;
      allUrls.splice(0,1)

      // skip URLs we already downloaded
      if (downloaded.indexOf(url) === -1) {
        downloadWindow = window.open(url);
        downloaded.push(url);
      }
    }

    // stop the loop, when there is no URL to open
    else {
      clearInterval(intervalId);
    }
  }
}, 500)

Browser should start to download .zip files one by another ;-)

Blue door weekend project

From weekend lounging I switched to weekend painting. It is quite time, since I and Saška have decided, we would like to have all our room doors painted blue. I finally managed to roll up my sleeves, buy the blue stain, bronze handles and get work done.

spruce door without stain

This is how the door looked brand new, without any treatment.

spruce door with blue stain

And this is the result after painting with blue stain and “installing” bronze handle. It was not as easy as pie, however with little perseverance it was doable.

spruce door blue stain closer look

And closer look .

Idea for this little home project came from visit of IKEA. There was model installation of kitchen with storage room, which had door painted just like this. So thanks IKEA :-)

Croatia holiday on boat – Lessons learned

Beside other things I had found this particularly useful.

Food

  • tuna cans with bread, olive oil and vegetable – very tasty breakfast

Equipment

  • swimming glass and snorkel
  • shoes into water, especially useful for sea ​​urchins

Place to see

  • national park Krka – beautiful

 

Following things I would utilize…

Food

  • muesli for breakfast – tasty and quick when you do not want to mess up with anything else

Equipment

  • portable speakers with prepared music playlists (party, chill, seafaring, well known songs)
  • headlamp
  • knife – Swiss or dagger
  • clothes pegs
  • repellent
  • ointment for bites/stings
  • net against mosquito
  • powder for wounds
  • pillow around neck for travelling in car
  • camera lens cloth
  • something to clean swimming glasses from dewing

Other

  • if no one other has – internet package for smartphone

Logos examples of our work team

At work, we agreed among colleagues to print our team t-Shirts. Team is called Everest, and I have tried to create some designs.

This was my the first shot, the silhouette is from actual Mount Everest peak.

Everest logo

Next one is from morning flood of inspiration, the typo in Everest is the work of colleague Miro and is self-explanatory :-) The silhouette is also from the mountain, but from different point of view.

Ever(b)est  logo

I was not happy with the silhouette of mountain and man, so I tried to stick with the simplicity and typography and this is the result.

Ever(b)est logo typography only

The idea of last design, also pure typography, struck me like lightning and is the one, I am the most proud of.

Evervest logo typography only

Minimalist, responsive and free wordpress theme tweaked by me

I wanted to find nice, clean, minimalist, responsive theme for my wordpress blog. After few hours of googling I got into LESS theme by Jared Erickson. It was pretty close to what I was looking for, so I grabbed it [thanks Jared] and made few tweaks to suite me even better. Before I will go into deep with changes I made, here is where I draw my  inspiration:

Dive into HTML5 – beautiful e-book, I feel joy every time I read it. Not just the content is great, but it is compendious too. Although you read technical book, you feel like reading a story. You might very well forget to step out of bus on right bus stop, while reading it :-)

Ruoyu Sun’s blog – I have accidentally discovered this blog while searching for information about Angular.js. Ruoyu’s post provided useful info, but it was compendious  and easy to read too.

Good font, good blog?

First thing I wanted to change in original theme was fonts. All theme was sans-serif and for headings there was used Arvo, which was quite exotic for me. I wanted serif font for headings and also for content. For headings I found pretty interesting IM Fell Great Primer on Google fonts.

For content, the default was Helvetica Neu, quite common and good for a lot of text. But instead, I chose Gentium Book Basic, which was my number one choice, after examining quite many options on Google fonts.

Fancy tags

The next thing I played with was tags, just added a little bit of CSS to make it look more fancy.

article .meta {
  line-height: 18px;
  font-size: 14px;
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: .9px;
}

article .meta .tags a {
  font-size: 12px; /* fallback for older browsers */
  font-size: 1.2rem;
  margin-right: 10px;
  margin-right: 1rem;
  background-color: #007998;
  color:#fff;
  padding: 3px 5px 3px 10px;

  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;

  -webkit-border-top-left-radius: 10px;
  -webkit-border-bottom-left-radius: 10px;
  -webkit-border-top-right-radius: 4px;
  -webkit-border-bottom-right-radius: 4px;

  -moz-border-radius-topleft: 10px;
  -moz-border-radius-bottomleft: 10px;
  -moz-border-radius-topright: 4px;
  -moz-border-radius-bottomright: 4px;

  -webkit-transition: background-color 0.25s ease-in-out;
  -moz-transition: background-color 0.25s ease-in-out;
  -o-transition: background-color 0.25s ease-in-out;
  -ms-transition: background-color 0.25s ease-in-out;
  transition: background-color 0.25s ease-in-out;
}

Rule the responsiveness

The whole blog is very simple and clean, therefore it is not hard to make it responsive. In original theme, the header was showing on small width devices floated to left. I wanted it to be centered, so just added following snippet to override parent CSS.

@media (max-width: 767px) {
  header .gravatar {
    display: block;
    margin-left:auto;
    margin-right:auto;
  }
  header #brand {
    display: block;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    width: 100%;
  }
  header #brand h1.site-title {
    display: inline;
  }
}

Here comes the problems

All the changes I wanted to apply as child theme, so I will not break original one and also to maintain changes, in case there will be parent theme update in the future. Creating child theme is as easy as pie, however here I run into problems. I have created child theme folder with style.css file properly configured, but after activation, my child theme looked exactly as original LESS theme. After looking a while into HTML source of my blog I realized, there is wrong style.css file loaded. It took me a little googling to figure out, how to fix this.

In functions.php file, which comes with parent theme, there is style registration function

wp_enqueue_script( 'less-style', get_template_directory_uri() . '/style.css' );

which uses wrong function to get path to style.css, because the function get_template_directory_uri() returns the path to parent theme folder, therefore parent style will be loaded. Instead get_stylesheet_uri() function should be used, which will return the path to current (child) theme style.css file.

In final the style registration should look like

wp_enqueue_script( 'less-style', get_stylesheet_uri() );

And child theme works like a charm. If I will make more tweaks to my blog style in future, will try to add it here and keep the post up to date.

Little Cookie clicker hack

Few days ago I fell in love with Cookie clicker. But after some time of playing I felt kind of bored, because the buildings started to be shitty expensive and my CPS was growing very slowly. I created 2 very simple scripts which helped me generate full load of cookies, while still having a fun of game.

This short tutorial is for chrome.

First things first

Include jQuery to page of your cookie clicker. Open chrome developer tools by hitting F12 key (hit it hard), go to console tab, copy and paste this oddly looking compressed jQuery code into your console – hit Enter key. Done!

No more missed golden cookies

First script ensure you never miss golden cookie anymore. Copy and paste this code into console window and hit Enter – yes hard!

var neverMissGoldenCookie = setInterval(function(){
if (jQuery('#goldenCookie').css('opacity') !== "0") {
jQuery('#goldenCookie').trigger('click');
}
}, 500);

This small script ensures, that you will catch all the golden cookies, which appear on screen. If you don’t want to cheat anymore paste to console following line of code.

clearInterval(neverMissGoldenCookie)

Become a click champion

Second hack script will ensure you will never have to click on big cookie, the cookie will be clicked automatically. Copy and paste to console the following script.

var neverClickCookieAgain = setInterval(function(){
jQuery('#bigCookie').trigger('click');
}, 10);

Your cookie will be clicked 100 times per second, every second, until you disable it by following code.

clearInterval(neverClickCookieAgain)

Get your computer a break

If you are same “freak” as me and you leave your computer on during night to earn cookies, here is one performance advice. Minimize window or tab with Cookie clicker running, your CPU load will go down significantly.

I guess that’s all and now, when you are earning full load of cookies, go out and start your life again ;-)