Milos Island, Greece 2012

Greece was definitely the right place to go to recharge my batteries.

The destination, Milos Island in Aegean sea, couldn’t be picked any better. There were no annoying tourists, no Czech speaking people, there was a beautiful private beach with at the most six to ten people on it, wicked yummy food that I crave already and the best coffee that made me stop pouring gallons of milk into my “latte” coffee.

It is time to let the pictures talk for me πŸ™‚ Enjoy!

The beach, about 200 meters from our place

Continue reading “Milos Island, Greece 2012”

Javascript 6 – prototype property

In my earlier post I used the prototype property to give all my cookies a method to scare away the Cookie Monster. It worked well but I started questioning what this prototype thing really refers to.

So I asked my true friend, the console.​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ πŸ˜‰

Continue reading “Javascript 6 – prototype property”

Javascript 5 – cookies vs. Cookie Monster

Once I read in John Resig’s book that a constructor is like a cookie cutter to make cookies. I found that very nice of him that he thought of people like me… who… who likes cookies and try to learn JS. Well, so I made up this little example. I have a cookie cutter, cookies and someone who eats them, the Cookie Monster. πŸ™‚

For those who don’t know Cookie Monster, this is him. Very scary guy.

Source: http://www.news.com.au/world/from-cookies-to-comedy-for-a-furry-blue-monster/story-e6frfkyi-1225960632753

This is my cookie cutter, properly said a constructor. It allows me to bake as many cookies as I want.

function MyCookie(flavor) {
 this.flavor = flavor;
 this.eaten = false;
 }

Continue reading “Javascript 5 – cookies vs. Cookie Monster”

Husky Boulder X 2012 in photos & video

The boulder contest was well done thank to the guys from Boulder Bar.

The video is finally here.

And here are some pics. I have no clue who is who. I know only Nelly and Martin Spilka. So if anyone recognizes their faces I will be glad to give them names. πŸ™‚ Please let me know at blogenka@gmail.com.

Javascript 4 – Everything is an object

CONFESSION: As I found out today not everything is an object. There are also these primitive value types like Undefined, Null, String, Boolean and Number that aren’t objects even though some of them can be represented as an object. This fact doesn’t change any of the stuff written below.

I used to tell myselfΒ  “Just stay away from the hellish objects and you’ll be fine”.
Well, that was quite naive to say when everything in JS is represented via an object. πŸ™‚

I did some short tests to see.

Object, like the real? one

[code lang=”js”]

var myObject = new Object();
myObject[‘0’] = ‘b’;
myObject[‘1’] = ‘o’;
myObject[‘2’] = ‘o’;

console.log(myObject);

[/code]

I created an object with 3 properties.

The __proto__Β  thing is an internal property. It points to an object myObject inherits from.

Continue reading “Javascript 4 – Everything is an object”

Javascript 3 – Use console to debug or die

Using alert() to debug really sucks. I always have to pray for my inserted alert to come up and it often doesn’t and I have no idea why or I kill my browser by never ending loop with alerts I can’t stop or I would get this error Object object that basically says “Just Give It Up!”.

Well, alert time is over. I was told to use a console.log(). Suddenly the JS world seems a bit nicer.

I prefer the Google Chrome console. You can activate it by hitting F12.

Example 1 – feeling much better already πŸ˜‰

[code lang=”js”]

var test = ‘Defined’;
console.log(test);

var test2;
console.log(test2);

console.log(test3);

[/code]

Continue reading “Javascript 3 – Use console to debug or die”

Javascript 2 – a function returning a function

I had some troubles with understanding this piece of code. [code lang=”js”]

var doSth = (function () {
var a = 1;
return function() {
alert(a++);
}
})();

/* The variable "doSth" points to an anonymous function
that is called afterwards via the brackets ().

It returns a piece of code that is then available in the variable doSth.
The returned code alerts the variable "a" incremented by 1.
FIX: it alerts variable "a" and then it is incremented by 1.

So now the variable "doSth" contains an executable code */

[/code]

Continue reading “Javascript 2 – a function returning a function”

Javascript 1 – variable scope

I don’t understand Javascript and probably never will. I am not a programmer and probably never will be… unless i get hit by something and my brain will click into some programming guru mode. But still, I really would like to get at least some of the code I see from my colleagues or even write something that makes sense by myself. Something I wouldn’t call “neverusable”. Sooo hold your thumbs… if I lose this fight my brain is only good for coding HTML & CSS. πŸ™‚

I realized I have to start and learn the basics properly. πŸ™‚
I started with a variable scope.

Example 1

[code lang=”js”]
var a = 1;
function doSth() {
alert(a);
}
doSth();

// This is quite simple.
// alerts 1
/* variable "a" has a global scope so wherever
you are in the code you can access it unless there is another
variable named "a" within the function you are calling the variable from */
[/code]

Continue reading “Javascript 1 – variable scope”