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
Quick tips

Vimeo video playback speed increase

Lately I’ve been watching some videos from Vimeo and it really annoyed me that it doesn’t have a video playback speed  increase option (since, well, you can listen most videos on 1.25 or 1.5 even – and since we’re all about time hacking ;)). So, after googling, I found that there is a Chrome plugin which does the job well.

CodeProject, Quick tips

Share a web service on your local development machine with Localtunnel

I was testing Jenkins and as it doesn’t support localhost addresses I found Localtunnel, which, and I qote,

allows you to easily share a web service on your local development machine without messing with DNS and firewall settings.

Localtunnel will assign you a unique publicly accessible url that will proxy all requests to your locally running webserver.

You can  install it via npm:

npm install -g localtunnel

Then, start your project on some local port (for example 1337), and make sure all works well locally. Now, request a tunnel to your local server:

lt --port 1337

And you should get an output like:

your url is: https://awesome.localtunnel.me

You can use this link now and any requests to that url will be routed to your service on port 1337.

Quick tips

Free Visual Studio Code

You’ve all heard the news – Microsoft made a free editor for developers called Visual Studio Code. You can download it from the official page here. The cool thing is that it works on Windows, OS X, and Linux, with support for IntelliSense, debugging, and GIT.

It’s worth making a distinction between Visual Studio 2015 which is still the full integrated development environment (IDE), while Visual Studio Code is “just” an editor – but from what I saw so far, a good one.

Quick tips

How to make a sticky post in WordPress

While editing your post in WordPress in the Publish area on the right, next to Visibility click on edit and then check the “Stick this post to the front page” option.

howToMakeStickyWp

Quick tips

Update field only if it’s new value

Recently I wanted to find out how to update field only if the updated value would be new (as in – different from the current one).

After a bit of googling I managed to find the solution which I’m now presenting here for anyone that may need a solution for such an use case:

UPDATE table SET db_field=(CASE db_field WHEN NULL THEN 'new_value' ELSE db_field END);

 

Ionic, Quick tips

Handling Ionic CORS issue

CORS = Cross origin resource sharing – a pain in the butt when trying to do an ajax request when developing locally.

For local testing I ended up using a Chrome plugin: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en.

The site http://enable-cors.org/ gives a lot of info on how to solve the cors issue if you control the API server. Namely, for Apache: http://enable-cors.org/server_apache.html.

But, TBH, all this ended up not working for me, so what I did was I created a “proxy” .php page which is called first (not calling the json file directly) and the PHP code for that page looks like this:

<?php
	header('Access-Control-Allow-Origin: *'); 
	echo file_get_contents("myJSON.json");
?>

edit: I answered a similar question on StackOverflow and I wrote a full tutorial with downloadable project from Github about this.

NodeJS, Quick tips

Keep your Node.js scripts running with Forever and Nodemon

edit (18.06.2015): Nowdays I’m using PM2, and here’s my post that explains how to use PM2.


Nodemon is a utility that will monitor for any changes in your source and automatically restart your server.  Install with npm:

npm install -g nodemon

Forever is a simple CLI tool for ensuring that a given script runs continuously (i.e. forever). Install with npm:

npm install -g forever

Forever & Nodemon running together:

forever start nodemon --exitcrash app.js

edit (24.02.2015):

If you get an error like this:

error:   Cannot start forever
error:   script /home/nikola/nodemon does not exist.

Try to run nodemon with the full path:

forever start /usr/bin/nodemon --exitcrash app.js

You can find out the path to nodemon by executing:

which nodemon
Quick tips

How to find unread emails in Gmail

As you can see in the featured image, to find unread emails in Gmail, just search for is: unread and you will get all of your unread emails.

You can combine this, for example, to only find unread emails in a certain label: label:myStuff is:unread

Quick tips, Windows

Grep GUI on a Windows machine with AstroGrep

I had to find some string inside one of the files, and I couldn’t remember in which file it was, classic 🙂

In linux, simple grep command would help, but on Windows there’s no such thing, or at least I thought… After some googling I came up with AstroGrep and I think it’s awesome, and it also comes with a GUI if you fancy that:

AstroGrep

You can download it freely from their site.

Quick tips

How to compare today’s date with the one you have in the MySQL timestamp field

Say you have a field called date in your MySQL table and its type is timestamp (example: ‘2014-08-23 08:37:57’), and you want to get all the records for today (so, all the records who’s dates are ‘2014-08-23’ neverminding the time). Here’s how yo do that:

SELECT * FROM `the_table` WHERE date(date) = curdate();

So, we’re using date() and curdate() functions here to help us achieve that.

Page 3 of 4«1234»

Recent posts

  • Discipline is also a talent
  • Play for the fun of it
  • The importance of failing
  • A fresh start
  • Perseverance

Categories

  • Android (3)
  • Books (114)
    • Programming (22)
  • CodeProject (35)
  • Daily Thoughts (77)
  • Go (3)
  • iOS (5)
  • JavaScript (127)
    • Angular (4)
    • Angular 2 (3)
    • Ionic (61)
    • Ionic2 (2)
    • Ionic3 (8)
    • MEAN (3)
    • NodeJS (27)
    • Phaser (1)
    • React (1)
    • Three.js (1)
    • Vue.js (2)
  • Leadership (1)
  • Meetups (8)
  • Miscellaneou$ (77)
    • Breaking News (8)
    • CodeSchool (2)
    • Hacker Games (3)
    • Pluralsight (7)
    • Projects (2)
    • Sublime Text (2)
  • PHP (6)
  • Quick tips (40)
  • 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