Showing posts with label sweets. Show all posts
Showing posts with label sweets. Show all posts
Thursday, December 16, 2021

Git tips & tricks: Fixup last commit

Tuesday, June 5, 2018

TypeScript Recipe: Elegant Parse Boolean

There are many ways to convert String to Boolean or Number to Boolean, etc.
Here we will do it all in one and stop worry about form of boolean like parameters we receive from outside.


Lets' Convert 1 '1' and 'true' to true and 0 '0' 'false' null and undefined to false
Wednesday, March 8, 2017

Pair your Total Commander file manager with Cmder console

Do you want to feel yourself as happy on Windows as on Mac? Well, sleek console and good file-manager could help you a lot...

Cmder


Cmder is a powerful console emulator for Windows.

Here is a short tip how to pair you Cmder Console with Total Commander file manager.
Thursday, September 22, 2016

SEO: Your Site description in Google search

When you search for something Google displays results with site/page description snippets.
Those could be either auto-generated from the keywords in page context or meta description snippet.
I bet, you could describe, what is your site about much more precisely, than search engine can assume, right?

Monday, August 22, 2016

The easiest way to start your Local Webserver with Node.js

On client-side development, it's often needed to quickly check or prove some script behavior in separate environment, so it's always good to have an extremely fast way yo launch your index.html on local web server.

npm http-server

http-server is a simple, zero-configuration command-line http server. It is powerful enough for production usage, but it's simple and hackable enough to be used for testing, local development, and learning.
Tuesday, August 16, 2016

Pair your Atom editor with Cmder console

Do you want to feel yourself as happy on Windows as on Mac? Well, sleek console and cross-platform editor could help you a lot...
Friday, June 3, 2016
Wednesday, June 1, 2016

Catch JS breakpoints in IDEA

How to debug JS from IDEA

Always wanted to place and catch breakpoints right into IDEA rather than doing it in browser's Dev tools.
It's fairly simple, it boosts your development speed and requires only two steps:
Wednesday, April 13, 2016

Boost your web development speed with LiveReload

Live Reload

LiveReload monitors changes in the file system.
As soon as you save a file, it is preprocessed as needed, and the browser is refreshed.
Even cooler, when you change a CSS file or an image, the browser is updated instantly without reloading the page.
Friday, March 11, 2016

All your Calendars in one Place

On which side are you?

Obviously an entry point is either IOS or Android, but the rest mostly doesn't meter.

Google Calendar (Android)

The most awesome thing, that you're able to display calendar from any third-party service, that provides ICalendar feed (like a Trello, in your Google Calendar)
In addition Google Calendar automatically fetches and adds the Events from Gmail - flights, hotel, concert, restaurant reservations, bookings (e.g. from Booking.com or Airbnb)

Flexibits Fantastical (IOS)

You could sync Fantastical with your Google Calendar as well, so basically you'll have all benefits from google as well.
Monday, January 18, 2016

Web Resource Optimizer for Java (Wro4j)

Wro4j is a tool for analysis and optimization of web resources. It brings together almost all the modern web tools: JsHint, CssLint, JsMin, Google Closure compressor, YUI Compressor, UglifyJs, Dojo Shrinksafe, Css Variables Support, JSON Compression, Less, Sass, CoffeeScript and much more.
So, basically it allows to organize static resources in groups, minify & combine those into common file, which simplifies it's including into your webpages.

See Simple 3 Steps usage explanation directly on Wro4j - Github
Monday, November 30, 2015

Meet ECMA Script 2015 (ES6)

ECMAScript 6


ES6 is the next generation of JavaScript, standard update since 2009.
The frameworks like AngularJS, Ember, Aurelia, etc. are already targeted on ES6 future releases.

What is New?

This ECMAScript update brings a lot of useful stuff into JS world.
Here are some of new features to enjoy:
  • block scoped variables;
  • arrow functions;
  • default parameters, rest & spread operators;
  • string interpolation;
  • binary, octal; string unicode & regexp literals;
  • Array element finding;
  • properties shorthand;
  • destructing assignment;
  • Modules, Classes & Promises;
  • Map/WeakMap & Set/WeakSet;
  • Iterators & Generators;
  • for...of loop;
Friday, November 13, 2015

Benchmarks in Java (Know what u're measuring)

Accurate Benchmark

It's often needed to know whether the certain operation is faster than another one(especially to argue with somebody on code review:)).
Probably the most of the fast self-written benchmark tests are incorrect because of side factors, that were not considered.
Here are few points we have to consider before start doing better:
  • JVM warmup at start an execution is slow and becomes faster and faster until it goes to steady-state;
  • Just In Time Compiler optimizes the code, so your measures become wrong;
  • Garbage Collector GC could act during your measure so it'll affect the results;
  • Class loading First execution time usually includes the loading of all classes it uses, cause JVM typically loads classes only when they're first used;
  • False Sharing Might happen when u try to read 2 adjacent fields from 2 or more threads at the same time (those could contend with each other on the hardware level)
  • Caching CPU cache, File system cache, Memory access optimizations.

There is a fairly simple and useful Code Tool by Open JDK called JMH supposed to simplify & optimize the benchmarks writing & running (references are in the end of page).
Sunday, November 8, 2015

Best Practice: Anonymous Closures

Manage Access & Namespaces via Closures

Anonymous Closures allow to maintain modularity and to prevent exposing the private modules data.
Global variables have unclear scope leading to tough manageable apps. Invocation of the global variables is expensive, because it checks entire scope depth.
The objects with the same names might be overridden if those are not within the separate namespaces.
Here are few points how to start doing better:
  • use namespaces to prevent conflicts & unexpected overrides;
  • use anonymous closures to encapsulate & isolate your app private data;
  • return the result object with the only api that you want to expose;
  • avoid direct global variables usage, use imports istead;
  • group file content around needed data.
Saturday, November 7, 2015

Best Practice: Watchout Wacky Decimals in JavaScript

Make your Calculations Consistent

JS uses binary floating point to handle decimal based operations.
JavaScript calculations with floating point causes the Nonsense cases especially during the result comparisons & displaying.
Here are few points how to start doing better:
  • round your values before displaying;
  • always use radix, to ensure that result is in the number system you expect;
  • test for number presence before doing math operations;
  • remember isNaN() is looking strictly for NaN;
  • parse your string numerical data before calculations.

Best Practice: Comparisons in JavaScript

Make your Comparisons Carefully

Make sure that your comparison expression will always be evaluated to what you expect.
Usage of == might be dangerous, when you only expect strict Boolean values.
Here are few points how to start doing better:
  • use triple-equals where the data might have multiple types;
  • use instanceof to identify the object type;
  • ensure that an object has the property (use hasOwnProperty()) before access to it;
Tuesday, November 3, 2015

Fail-Fast instead of Fire-and-Forget

Fail-Fast

fail-safe, fail-fast, fire-and-forget

Fail Fast means, when something goes wrong, you must show an error as soon as possible, so that you can take an action to solve the problem.
With fire-and-forget (when you have no any response) there is nothing you can do, when something went wrong.
Here is few points to follow fail-fast behavior:
  • assertions;
  • meaningful exceptions;
  • response for each request.

Monday, November 2, 2015

Best Practice: Executions & Memory Control in JavaScript

Control the Memory & Scripts Execution speed

The less operations you do, the more processor time you save, the higher speed you have.
Each new element addition to the DOM cause reflow, which can badly affect the user experience.
Here are few points how to start doing better:
  • re-locate work-intensive scripts;
  • run scripts asynchronously;
  • let inheritance to help with memory efficiency;
  • insert DOM elements within fragments;
  • declare variables as few times as possible;
  • make efficient choices in terms of script execution;
Sunday, November 1, 2015

Best Practice: Loops Optimization in JavaScript

Optimize Loops

The less operations you do, the more processor time you save, the higher speed you have.
Javascript doesn't scope to blocks. So, any variable declared in loop will be available after the loop and may override pre-existing globals!
Here some few points to get doing better:
  • avoid repetitive access;
  • break out earlier;
  • choose the right loop type;
  • organize your declarations;
  • batch your operations;
Tuesday, September 29, 2015

Keynote: AngularJS Less Backend

Angular JS


Take a look on the previous article to refresh your memory
  • Angular JS Basics shornotes.
  • Angular JS Do the regular things.
  • Angular JS Do the custom things.
  • Angular JS Routing.