Nikola Brežnjak blog - Tackling software development with a dose of humor
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Home
Daily Thoughts
Ionic
Stack Overflow
Books
About me
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Nikola Brežnjak blog - Tackling software development with a dose of humor
Books

You Are a Badass – Jen Sincero

My favorite quotes from the book You Are a Badass: How to Stop Doubting Your Greatness and Start Living an Awesome Life  by Jen Sincero which I rated 4/5 on my Goodreads account:

“If you’re serious about changing your life, you’ll find a way. If you’re not, you’ll find an excuse.”

“You are loved. Massively. Ferociously. Unconditionally. The Universe is totally freaking out about how awesome you are. It’s got you wrapped in a warm gorilla hug of adoration. It wants to give you everything you desire. It wants you to be happy. It wants you to see what it sees in you.”

“What other people think about you has nothing to do with you and everything to do with them.”

“Because if you base your self-worth on what everyone else thinks of you, you hand all your power over to other people and become dependent on a source outside of yourself for validation. Then you wind up chasing after something you have no control over, and should that something suddenly place its focus somewhere else, or change its mind and decide you’re no longer very interesting, you end up with a full-blown identity crisis.”

“So often, we pretend we’ve made a decision, when what we’ve really done is signed up to try until it gets too uncomfortable.”

“Maybe, if you put your disbelief aside, roll up your sleeves, take some risks, and totally go for it, you’ll wake up one day and realize you’re living the kind of life you used to be jealous”

“Nobody who ever accomplished anything big or new or worth raising a celebratory fist in the air did it from their comfort zone. They risked ridicule and failure and sometimes even death.” 

“The only failure is quitting. Everything else is just gathering information.” 

“If you are depressed, you are living in the past. If you are anxious, you are living in the future. If you are at peace, you are living in the present.” 

“I can pretty much guarantee that every time you tearfully ask yourself the question, “WTF is my problem?!” the answer lies in some lame, limiting, and false subconscious belief that you’ve been dragging around without even realizing” 

“There’s something called the Crab Effect. If you put a bunch of crabs in a bowl and if, while they’re in there crawling all over each other, one of them tries to climb out, the rest of them will try to pull him back down instead of helping to push him out. No wonder they’re called crabs.” 

“Because so often when we say we’re unqualified for something, what we’re really saying is that we’re too scared to try it, not that we can’t do it.”

“You need to go from wanting to change your life to deciding to change your life.”

“What you tell yourself on a daily basis is more powerful than you know.” 

“Our greatest fears are the greatest waste of time.” 

“Comparison is the fastest way to take all the fun out of life.”

My favorite #quotes from the #book You Are a Badass by Jen Sincero https://t.co/XUV6CZ0lWi

— Nikola Brežnjak (@HitmanHR) July 10, 2017

Ionic3

How to create the simplest TODO application with Ionic 3

TL;DR

This is the simplest example which shows how to create a simple TODO application with Ionic 3 in just a few lines of code.

Quickstart

To see it in action:

  • Clone the finished project from Github
  • Make sure you’ve got the newest Ionic CLI (see this post for more instructions)
  • Run ionic serve
  • The app in action (after adding few items and swiping to delete one):

Step by step on how to create this yourself from scratch

Create a new blank Ionic project with ionic start Ionic3ServerSendTest blank

Template

Copy the following code to src/pages/home/home.html file:

Here we have three parts:

  • an input (ion-input) field where we enter the text for our TODO. We’ve put a ngModel of name todo on it – we will be able to reference this in the code by this same variable name.
  • a button (ion-button) which when clicked calls the function called add, which we’ll define in our src/pages/home/home.ts file shown below.
  • a list (ion-list) with multiple items (ion-item) in it. Also, we’ve made use of the ion-item-sliding (learn more about it from the docs here). We are repeating the ion-item-sliding component as many times as we have items in the todos array (you’ll see where we set that in the home.ts file, as mentioned above).

Code

To the src/pages/home/home.ts file copy the following content:

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

@Component({
    selector: 'page-home',
    templateUrl: 'home.html'
})
export class HomePage {
    todos: string[] = [];
    todo: string;

    constructor(public navCtrl: NavController) {

    }

    add() {
        this.todos.push(this.todo);
        this.todo = "";
    }

    delete(item) {
        var index = this.todos.indexOf(item, 0);
        if (index > -1) {
            this.todos.splice(index, 1);
        }
    }
}

The only thing that differs here from the basic blank template generated code is the todos and todo variables which we use for holding the array of todos and a current todo that’s connected to the model in the input box.

The add function pushes the current todo that we have in the input box at the time of pressing the Add button into the todos array.

The delete function first finds the index of the item that we want to delete from the list and then, by using the splice function, it deletes the item from the todos array.

Running the app

Just run ionic serve or even better yet ionic lab from the root directory of your Ionic app and you’ll have the app running locally in your browser tab with live reload option turned on.

Conclusion

That’s it. It doesn’t get any easier than this. Sure, this is as simple as it gets; there’s no persistence or anything, that’s for you to play with. Or, well, I may add that in the next tutorial…

‘Till then, have a great one, and a happy 4th of July to all my friends across the big pond 😉

How to create the simplest #TODO application with #Ionic 3 https://t.co/xvjmXVruBH

— Nikola Brežnjak (@HitmanHR) July 4, 2017

Miscellaneou$

Get free stickers from dev.to

This is just a quick post to say thank you to the dev.to community for sending me these awesome new stickers and a T-shirt. This way my ‘old’ laptop got even more crowded and a ‘new’ one is now nicely showing my day to day activities:

Copying and pasting from StackOverflow ?

OK, true, sometimes I answer some questions as well ?

Anyways, make sure to check them out as you too can get these stickers (if you’re into this that is) for free here: http://dev.to/freestickers.

Their community seemed to have liked the post I shared about Git branching done right with Gitflow & improving code quality with code reviews so check it out if it sounds interesting…

Oh, btw, you can see how my Lenovo ? looked like covered with stickers.

Keep your stacks overflowing folks and talk to you soon!

devtoStickers

Got free stickers thanks to @ThePracticalDev https://t.co/Jg2L5ZabL7

— Nikola Brežnjak (@HitmanHR) June 27, 2017

Meetups

Freelancing – 10th MeCoDe meetup

Meetup notes

Recently (14.06.2017), we had our 10th MeCoDe meetup, and this time the topic was the ever so slightly mysterious world of Freelancing.

The presenter was Martina Lipovac, the owner of the creative studio Trogled, who did an awesome job sharing her experience with freelancing in terms of how it is to work from home, how to use different freelancing platforms, how to find new work and communicate with clients, how to organize time, etc.

Also, she covered a lot of things from the legal aspect regarding how to have everything ‘by the book’. Martina also arranged a guest video presentation from her friend Matija Matečić, the CEO of Solo, which is an online service for creating invoices which follow our (sometimes weird) legislation (Croatian specific).

By sharing her success story, I hope some folks got inspired to finally try if this ‘mysterious freelancing’ works for them.

You can take a look at Martina’s presentation here.

Picture time

[ngg_images source=”galleries” container_ids=”29″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

Milestones

This was our 10th Meetup in a span of just a bit over one year. I’m very happy that our small community has such a will to learn new things and expand horizons on a professional level, so am looking forward to another 10!

Call for speakers

As always, we welcome new speakers, even with n0 prior experience (you gotta start somewhere, right? :)) so in case you wanna share something with us, just shoot me an email…

#Freelancing – 10th MeCoDe meetup https://t.co/0WguhFlAqu

— Nikola Brežnjak (@HitmanHR) June 26, 2017

Ionic3

Posting data from Ionic 3 app to a PHP server

TL;DR

This is the simplest example which shows how to POST data from an Ionic 3 app to a PHP server.

The tutorial covering the Ionic version 1 can be found here, and the tutorial covering the Ionic version 2 can be found here.

Quickstart

To see it in action:

    1. Clone the finished project from Github
    2. Make sure you’ve got the newest Ionic CLI (see below for instructions)
    3. Run ionic serve
    4. You should see something like this:
      ionic2ServerPost

If you want to make it work from your server:

  1. Make sure you’ve got the newest Ionic CLI (see below for instructions)
  2. Clone the finished project from Github
  3. Upload the PHP/api.php file to your server
  4. In the src/pages/home/home.ts file adjust the link variable (line #21) to point to your server
  5. Run ionic serve

Getting started with Ionic 3

After neglecting Ionic 3 (and for the most part Ionic 2) for far too long due to the overburdening work I still have on my Ionic 1 apps, I finally got some time to take a look at Ionic 3 and update the most popular post about Ionic on my blog, so here you go and enjoy.

In general, from me playing just a bit with Ionic 3, I have to say I love it, so expect some more posts about it soon-ish…

To install the Ionic SDK and create Ionic 3 projects, you need to install the latest Ionic CLI:

npm install -g ionic

You don’t need to worry about this messing up your current ionic CLI since the new one still works with old Ionic 1 projects.

Just for reference, here’s what my ionic info says now:

$> ionic info 

global packages:

    @ionic/cli-utils : 1.4.0
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Ionic Framework                 : ionic-angular 3.4.2

System:

    Node       : v8.0.0
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b 
    ios-deploy : 1.9.1 
    ios-sim    : 5.0.13 
    npm        : 5.0.1 

Step by step on how to create this yourself from scratch

  1. Create a new blank Ionic project with:
    ionic start Ionic3ServerSendTest blank
  2. Copy the following code to src/pages/home/home.html file:
    <ion-header>
     <ion-navbar>
     <ion-title>
     Ionic3 Server Send Test
     </ion-title>
     </ion-navbar>
    </ion-header>
    
    <ion-content padding>
     <ion-list>
     <ion-item>
     <ion-label floating>Username</ion-label>
     <ion-input type="text" name="username" [(ngModel)]="data.username"></ion-input>
     </ion-item>
    
     <button ion-button block (click)="submit()">Submit to server</button>
     </ion-list>
    
     <ion-card>
     <ion-card-header>
     Response
     </ion-card-header>
    
     <ion-card-content>
     <b>{{data.response}}</b>
     </ion-card-content>
     </ion-card>
    </ion-content>
    

    Here you basically created a form with an username input field and with a button which acts as a submit button.

    Once the button is clicked AngularJS should handle it within the submit() function which we will define in our src/pages/home/home.ts file (shown below).

    Input username uses  the new syntax for ng-model , and it binds to the variable data.username, so that you can then use it in your submit() function (shown below).

    Components are a bit different in Ionic 3 now, so I encourage you can take a look at the official documentation.

  3. On your server, create an api.php file with the following content:
    <?php
        //http://stackoverflow.com/questions/18382740/cors-not-working-php
        if (isset($_SERVER['HTTP_ORIGIN'])) {
            header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
            header('Access-Control-Allow-Credentials: true');
            header('Access-Control-Max-Age: 86400');    // cache for 1 day
        }
    
        // Access-Control headers are received during OPTIONS requests
        if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
    
            if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
                header("Access-Control-Allow-Methods: GET, POST, OPTIONS");         
    
            if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
                header("Access-Control-Allow-Headers:        {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
    
            exit(0);
        }
    
    
        //http://stackoverflow.com/questions/15485354/angular-http-post-to-php-and-undefined
        $postdata = file_get_contents("php://input");
        if (isset($postdata)) {
            $request = json_decode($postdata);
            $username = $request->username;
    
            if ($username != "") {
                echo "Server returns: " . $username;
            }
            else {
                echo "Empty username parameter!";
            }
        }
        else {
            echo "Not called properly with username parameter!";
        }
    ?>

    As you can see from the code, the first part is explained in detail in this StackOverflow question, and it basically solves the CORS issue that you would otherwise run into.

    The second part, explained in detail in this StackOverflow question,  deals with the way you POST data from Ionic to your PHP server. The gist is that since we POSTed in a JSON format, we have to json_decode  the data that comes to your PHP server.

  4. To the file src/pages/home/home.ts file copy the following content and adjust the link variable to point to the file on your server:
    import { Component } from '@angular/core';
    import { NavController } from 'ionic-angular';
    import { Http } from '@angular/http'; //https://stackoverflow.com/questions/43609853/angular-4-and-ionic-3-no-provider-for-http
    
    @Component({
     selector: 'page-home',
     templateUrl: 'home.html'
    })
    
    export class HomePage {
     data:any = {};
    
     constructor(public navCtrl: NavController, public http: Http) {
     this.data.username = '';
     this.data.response = '';
    
     this.http = http;
     }
    
     submit() {
     var link = 'http://nikola-breznjak.com/_testings/ionicPHP/api.php';
     var myData = JSON.stringify({username: this.data.username});
     
     this.http.post(link, myData)
     .subscribe(data => {
     this.data.response = data["_body"]; //https://stackoverflow.com/questions/39574305/property-body-does-not-exist-on-type-response
     }, error => {
     console.log("Oooops!");
     });
     }
    }

    As with the Ionic 2 tutorial, things have changed a lot since Ionic 1, but in Ionic 3 (if you come from Ionic 2) you shouldn’t have any problems. Anyways, practice makes perfect, so make sure you put in the hours of deliberate practice.

    In this file, we import the Http component from Angular. You can check out the link in the comment to learn that you also need to import and inject HttpModule in src/app/app.module.ts (two new lines that I’ve added are bolded):

    import { BrowserModule } from '@angular/platform-browser';
    import { ErrorHandler, NgModule } from '@angular/core';
    import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
    import { SplashScreen } from '@ionic-native/splash-screen';
    import { StatusBar } from '@ionic-native/status-bar';
    import { HttpModule} from '@angular/http';
    
    import { MyApp } from './app.component';
    import { HomePage } from '../pages/home/home';
    
    @NgModule({
     declarations: [
     MyApp,
     HomePage
     ],
     imports: [
     BrowserModule,
     IonicModule.forRoot(MyApp),
     HttpModule
     ],
     bootstrap: [IonicApp],
     entryComponents: [
     MyApp,
     HomePage
     ],
     providers: [
     StatusBar,
     SplashScreen,
     {provide: ErrorHandler, useClass: IonicErrorHandler}
     ]
    })
    export class AppModule {}

    Inside the HomePage class, we now have a constructor where we’re setting some default values. Important to note, see how we’re passing in Http via the constructor parameter.

    Inside the submit function we use the http service to post to our API endpoint with some data. Make note of how we use the subscribe function to handle data once it arrives. Also, make sure you check out the StackOverflow link in the comment as a solution of how to access plain text response.

  5. Run ionic serve  from the root directory of your Ionic app

That’s all folks, I hope this tutorial helps you in starting your journey towards Ionic3 & Angular4!

Posting data from #Ionic 3 app to a #PHP server https://t.co/QYKiQtq1kJ

— Nikola Brežnjak (@HitmanHR) June 21, 2017

Meetups

Web API on ASP.NET Core – 9th MeCoDe meetup

Meetup notes

Few Thursdays ago (18.05.2017) (yeah, I know, this post comes late, but better late than never, they say 🙂) we had our 9th MeCoDe meetup, and this time the topic was Web API on ASP.NET Core.

The presenter was Velimir Sanjković, the owner of S-Soft, who did a great job showing us first hand how to create a Web API on ASP.NET core using both Visual Studio and Visual Code.

Source code

In case you want to check out the code, you can do so via Github.

Picture time

[ngg_images source=”galleries” container_ids=”28″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

Milestones

Believe it or not, MeCoDe is one year old already!

Miscellaneou$

Weblica 2017

This was the 3rd Weblica conference in my Međimurje county (I wrote about the first one here and about the second one here).

Again, the entrance was free and every attendee got a nice T-Shirt (best design so far if you ask me), loads of stuff to eat and drink. The talks were interesting and informative, and for all this a big two thumbs up to the organizers. Also, active participants could get Microsoft keyboards, wireless mouses, USB drives, etc…

I got a mouse 🙂

Here I’ll just add few of the interesting slides from the presentations that I’ve attended. You can check the full program on Weblica’s website.

Conference oppening – Velimir Sanjković

ASP.NET Core i Angular 2 – Ratko Ćosić

[ngg_images source=”galleries” container_ids=”21″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

ASP.NET Core serving JavaScript applications – Dobriša Adamec

[ngg_images source=”galleries” container_ids=”23″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

Lunch

[ngg_images source=”galleries” container_ids=”24″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

Node.js + Docker – Davor Tarandek

[ngg_images source=”galleries” container_ids=”25″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

React – Toni Petrina

[ngg_images source=”galleries” container_ids=”26″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

No Bulls*it Freelancer – Tomislav Kozačinski

[ngg_images source=”galleries” container_ids=”27″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

Demystified Webpack – Andrei Zvonimir Crnković

[ngg_images source=”galleries” container_ids=”22″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

All in all, a great conference and hope to see you next year…

#Weblica 2017 notes @weblica https://t.co/2UooGO7k6R

— Nikola Brežnjak (@HitmanHR) May 29, 2017

Quick tips

How to stop and remove MySQL server on a Mac but keep the client

Remove MySQL server on a Mac

The other day I wanted to run some project via Docker Compose. Surprisingly, the MySQL service defined normally like this:

mysql:
       image: tutum/mysql
       env_file:
         - docker.env
       ports:
         - "3306:3306"

didn’t start, because I apparently had MySQL server already running locally.

Trust me, I tried everything from this StackOverflow post but any time I tried to kill the process (that I saw is running with ps aux | grep mysql) it would spun back up.

Then, I remembered that I installed MySQL server some time ago via the app called MAMP. I went in and removed all of that and also I found one post that I’ll paste here (full credit to Vitor Britto):

# Remove MySQL completely

1. Open the Terminal
2. Use `mysqldump` to backup your databases
3. Check for MySQL processes with: `ps -ax | grep mysql`
4. Stop and kill any MySQL processes
5. Analyze MySQL on HomeBrew: 

    ```
    brew remove mysql
    brew cleanup
    ```

6. Remove files: 

    ```
    sudo rm /usr/local/mysql
    sudo rm -rf /usr/local/var/mysql
    sudo rm -rf /usr/local/mysql*
    sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    sudo rm -rf /Library/StartupItems/MySQLCOM
    sudo rm -rf /Library/PreferencePanes/My*
    ```

7. Unload previous MySQL Auto-Login: 

    ```
    launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    ```

8. Remove previous MySQL Configuration: 

    ```
    subl /etc/hostconfig` 
    # Remove the line MYSQLCOM=-YES-
    ```

9. Remove previous MySQL Preferences: 

    ```
    rm -rf ~/Library/PreferencePanes/My*
    sudo rm -rf /Library/Receipts/mysql*
    sudo rm -rf /Library/Receipts/MySQL*
    sudo rm -rf /private/var/db/receipts/*mysql*
    ```

10. Restart your computer just to ensure any MySQL processes are killed
11. Try to run mysql, **it shouldn't work**

Keep the MySQL client for interacting with the MySQL databases

At this point, I removed everything related to MySQL, but I still needed the client to connect to the MySQL database that I ran with Docker Compose.

The fastest way (that I’ve found in this StackOverflow post) to install the client without installing the server was to install MySQLWorkbench and then add this to your path (I put these in my .zshrc file; you may use .bashrc):

export PATH=$PATH:/Applications/MySQLWorkbench.app/Contents/MacOS

Of course, the path may vary for you in case you’ve installed it in some other location. Anyway, hope this helps someone… ?

How to stop and remove #MySQL server on a Mac but keep the client https://t.co/0vtuBgOqMD

— Nikola Brežnjak (@HitmanHR) May 11, 2017

Miscellaneou$

This tool will save you tons of typing in Terminal

Even though this may come off as a clickbait title, I’m honestly telling you that this tool will save you lots of time typing in the terminal.

Tell me, how many times you did something like this:

mkdir testProject
cd testProject
mkdir app
cd app
mkdir config
mkdir js
mkdir css
cd js
mkdir vendor
cd vendor
cd ../../../

Let’s assume that you did all that on the ~/Desktop folder; then you’re currently at the ~/Desktop/testProject/ folder.

Now, say you want to go back to the vendor folder to add some other files/folders (or do some other stuff). Naturally, you would write cd app/js/vendor.

What if I tell you that you could achieve the same this by typing something like z vend?

Enter the Z tool. This simple script allows you to do just that – move to some folder without having to type the whole path in.

Just imagine, how many times you found yourself going through the terminal and changing directories and then telling yourself “Wouldn’t it be nice if I could just go back to that directory by just clicking on it (as you can in any GUI tool)?”. Well, now you can.

This cool tool was presented to me by my coworker Shawn Milochik, and I’m using it ever since. Here’s his YouTube video which will show you how to install and run this tool in under 3 minutes.

For the sake of brevity, here are the installation steps:

  • download the z.sh to your local folder (for example /Users/nikola/CoolScripts/z.sh)
  • source it in your .bash_profile or .zshrc config file by adding this line: source /Users/nikola/CoolScripts/z.sh
  • start a new terminal window and make good use of Z

Hope this helps you and saves you some typing time as it does for me ?

This tool will save you tons of typing in Terminal – thanks to @ShawnMilo for showing it to me https://t.co/XPEegWPJRq

— Nikola Brežnjak (@HitmanHR) May 8, 2017

Meetups

Golang Zagreb – First Workshop

Last Saturday (22.03.2017) I attended the first ever Go language workshop.

The workshop host was Matej Baćo, who is also the organizer of Golang Zagreb.

We were working on a task to create a currency exchange rates JSON service. The Github repo of the project is here. Matej did an excellent job preparing this workshop as you can checkout the master branch and follow the instructions in the main.go in order to go through the same process as we did. If you get stuck at some point or don’t know how would you solve a certain step, you can check out other branches which Matej prepared (for each phase there is a start and done branch).

Few pics from the workshop

[ngg_images source=”galleries” container_ids=”20″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

If you’re a Go aficionado and would like to keep learning about Go from the first-hand experience, make sure to attend their next meetup this Wednesday where they also have a so-called ‘hack table’ where you can ask any question about the Go code you’re writing and having some issues with.

All in all, great workshop, I highly recommend you check them out, and I’m looking forward to the next one!

#Golang Zagreb – First #Workshop lead by @matejbaco https://t.co/zCCtdsPRgw

— Nikola Brežnjak (@HitmanHR) April 25, 2017

Page 20 of 52« First...10«19202122»304050...Last »

Recent posts

  • SendGrid Phishing Scam Attempts
  • Retrospective Questions
  • When espanso Breaks on Long Replacement Strings (and How to Fix It)
  • 2024 Top Author on dev.to
  • Hara hachi bun me

Categories

  • Android (3)
  • Books (114)
    • Programming (22)
  • CodeProject (36)
  • Daily Thoughts (78)
  • Go (3)
  • iOS (5)
  • JavaScript (128)
    • Angular (4)
    • Angular 2 (3)
    • Ionic (61)
    • Ionic2 (2)
    • Ionic3 (8)
    • MEAN (3)
    • NodeJS (27)
    • Phaser (1)
    • React (1)
    • Three.js (1)
    • Vue.js (3)
  • Leadership (1)
  • Meetups (8)
  • Miscellaneou$ (80)
    • Breaking News (8)
    • CodeSchool (2)
    • Hacker Games (3)
    • Pluralsight (7)
    • Projects (2)
    • Sublime Text (2)
  • PHP (6)
  • Quick tips (41)
  • Servers (8)
    • Heroku (1)
    • Linux (3)
  • Stack Overflow (81)
  • Unity3D (9)
  • Windows (8)
    • C# (2)
    • WPF (3)
  • Wordpress (2)

"There's no short-term solution for a long-term result." ~ Greg Plitt

"Everything around you that you call life was made up by people that were no smarter than you." ~ S. Jobs

"Hard work beats talent when talent doesn't work hard." ~ Tim Notke

© since 2016 - Nikola Brežnjak