Gorgo.Live.ToString()

Mariusz, Gorzoch tech Blog

Archive for August 2014

C# extensions method by JavaScript

leave a comment »

Not so many people are aware that extensions method are possible to implemented also on JavaScript code. Here you have quick example how to achieve that:

1. Let’s create class definition

function MyClass(imput){
this.myProperty = input;
}

2. Let’s create object of our class

var myObject = new MyClass('test');

3. Now, we are ready to add first extension method to our MyClass definition

MyClass.prototype.PrintMe = function() { console.log(this.myProperty); }
myObject.PrintMe() //Prints "test"

4. That was easy, but we can go even further and add additional method to all existing objects, by simply extending “Object” class

Object.prototype.PrintMeSuper = function() { console.log("super print!"); }
myObject.PrintMeSuper(); //Print "super print!"

JavaScript can be fun, 😉

Written by Mariusz Gorzoch

23 August 2014 at 15:06

Posted in Bez kategorii

Chrome Omnibox -> how to show URL

leave a comment »

In recent release of chrome Google introduce hiding of URL from OmniBox (URL address bar).

Google Chrome Canary Omnibox

If you annoyed by this like me then there is simple solution for that. Simply go to that page:

chrome://flags/#origin-chip-in-omnibox

and disable it.

More details can be found under fallowing post from Google forum

Written by Mariusz Gorzoch

21 August 2014 at 11:19

Posted in Bez kategorii