Blog Spot!


Two-way binding with Backbone

Two-way binding just means that:

  1. When properties in the model get updated, so does the UI.
  2. When UI elements get updated, the changes get propagated back to the model.

Backbone doesn't have a "baked-in" implementation of 2 option (although you can certainly do it using event listeners)

In Backbone, we can easily achieve option 1 by binding a view's "render" method to its model's "change" event. To achieve option 2, you need to also add a change listener to the input element, and call model.set in the handler.

stackoverflow
jsfiddle

Added on 18.Mar.2018
Tags: backbone js binding events data spa

HOW TO SELF DETECT A MEMORY LEAK IN NODE

article

example code:

if (os.hostname() === 'host_name') {

  const memwatch = require('memwatch-next');
  const heapdump = require('heapdump');

  console.log('_SYSTEM_ activating:[memwatch]');
  console.log('_SYSTEM_ activating:[heapdump]');

  memwatch.on('leak', function(info) {
    let heapsnapshot = '/path/leak_' + Date.now() + '.heapsnapshot';

    console.log('MEMWATCH [%s]'.bgBlue, JSON.stringify(info));
    console.log('HEAPDUMP [%s]'.bgBlue, heapsnapshot);
    heapdump.writeSnapshot(heapsnapshot);

  });
}

Added on 16.Feb.2018
Tags: node nodejs leak memory detect debug profile

Remove entries from known_hosts

Use this command to remove entries from known_hosts:

ssh-keygen -R hostname

askubuntu

Added on 05.Feb.2018
Tags: known_hosts linux terminal bash ssh host

Laravel 5.5 — Activate account after registration using Laravel Notification

Added on 15.Jan.2018
Tags: laravel auth register user laravel

Make meld work as git diff tool

~/.gitconfig

[diff]
    external = /usr/local/bin/git-diff.sh
    tool = meld
[merge]
    tool = meld
[push]
    default = simple

/usr/local/bin/git-diff.sh

#!/bin/bash
meld "$2" "$5" > /dev/null 2>&1

..then use git diff HEAD

Added on 12.Jan.2018
Tags: meld git diff tool

Search


PHP Libraries


Carbon lib / docs
Idiorm lib / docs
Image Workshop lib / docs
lorenzos/Minixed lib / docs
Parsedown lib / docs
PHP Paginator lib / docs
PHP Redis lib / docs
QrCode lib / docs
Requests lib / docs
Slim lib / docs
Spyc lib / docs
TWIG lib / docs
Upload lib / docs
Validation lib / docs
Zebra Image lib / docs

JS Libraries


AJV lib / docs
BackboneJS lib / docs
Bootstrap Notify lib / docs
C3.js lib / docs
ChartJS lib / docs
FastMD5 lib / docs
HighlightJS lib / docs
jQuery-Storage lib / docs
JS-Cookie lib / docs
Leaflet JS lib / docs
LowDB lib / docs
Marked lib / docs
NeedlyJS lib / docs
ParcelJS lib / docs
RequireJS lib / docs
Swig lib / docs
Toastr lib / docs
Underscore lib / docs
ValidateJS lib / docs
top