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.
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.
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.
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);
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.
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
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:
You can download it freely from their site.
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.
Recent posts
- Espanso: Because Who Actually Likes Typing Out Their Emails?
- Getting started with Vue.js 3 by building a Pokemon search application
- Solving the ‘Retry as Admin’ while saving files in Visual Studio Code on a Mac
- Cybersecurity Alert: The New Phishing Scam Hitting OpenSea Users
- Sparkly Wheels are Turning in the Opposite Directions: A Handy Fix for a STEM Toy Enthusiast
Categories
- Android (3)
- Books (114)
- Programming (22)
- CodeProject (35)
- Daily Thoughts (71)
- Go (3)
- iOS (5)
- JavaScript (126)
- Leadership (1)
- Meetups (8)
- Miscellaneou$ (76)
- Breaking News (8)
- CodeSchool (2)
- Hacker Games (3)
- Pluralsight (7)
- Projects (2)
- Sublime Text (2)
- PHP (6)
- Quick tips (40)
- Servers (8)
- Stack Overflow (81)
- Unity3D (9)
- Windows (8)
- Wordpress (2)