Blog Spot!


How to exclude file/folders from dropbox sync?

superuser

$ dropbox -h
commands:
Note: use dropbox help <command> to view usage for a specific command.

  • status get current status of the dropboxd
  • throttle set bandwidth limits for Dropbox
  • help provide help
  • puburl get public url of a file in your dropbox's public folder
  • stop stop dropboxd
  • running return whether dropbox is running
  • start start dropboxd
  • filestatus get current sync status of one or more files
  • ls list directory contents with current sync status
  • autostart automatically start dropbox at login
  • exclude ignores/excludes a directory from syncing
  • lansync enables or disables LAN sync
  • sharelink get a shared link for a file in your dropbox
  • proxy set proxy settings for Dropbox

In short use: dropbox exclude [file or folder name]

Added on 11.Mar.2019
Tags: dropbox exclude sync

The Observer Pattern - JavaScript

Pure code example:

/**
 * OBSERVER PATTERN:
 * 
 * This pattern implements the Subject and Observer objects.
 * Most of the hard work is done by the Subject, the Observer
 * needs to have a way to receive the updated value. Usually
 * only by implementing the update() method.
 */

class Subject {
    constructor() {

        /**
         * The list of threads observed based on each user's instance.
         * this will contain a list of observers.
         */
        this.observers = [];
    }

    isSubscribed(o) {

        /* Help us check if the observer for an user is already subscribed */
        return this.observers.filter(subscriber => subscriber === o).length;
    }

    subscribe(o) {

        /* Verifies that the user is not subscribed already */
        if (this.isSubscribed(o)) return;

        /* If the user is not subscribed adds the function to the list */
        this.observers.push(o);
    }

    unsubscribe(o) {

        /**
         * returns a new array of functions without the one passed as argument,
         * Basically unsubscribing the user from that thread.
         */
        this.observers = this.observers.filter(subscriber => subscriber !== o);
    }

    notify(data) {

        /**
         * notifies the user, it passes the data to each observer
         * set in the list so that it's updated.
         */
        this.observers.forEach(observer => observer.update(data));
    }
}

// ------------------------------------------------------------------
// :: Example Usage
// ------------------------------------------------------------------

class Temperature extends Subject {

    constructor(tmp = 0) {
        super();
        this.tmp = tmp;
    }

    setTmp(tmp) {
        if (this.tmp !== tmp) {
            this.notify(tmp);
        }
        this.tmp = tmp;
    }
}

class SensorObserver {

    /**
     * Required method used in the subject to update the observable value.
     */
    update(data) {
        console.log('Observable value has changed:[%j]', data);
    }
}

let tmp = new Temperature(22);
let sen = new SensorObserver();

tmp.subscribe(sen);

// simulate temperature changes
setInterval((min, max) => {
    tmp.setTmp(Math.floor(Math.random() * (max - min) ) + min);
}, 2000, 18, 24);

Added on 11.Mar.2019
Tags: patterns oop js observer

Deploy Laravel 5 application on shared hosting

Short article.

For more about deploying a Laravel/Lumen application on shared hosting, check out my complete guide

Added on 10.Mar.2019
Tags: laravel queue shared hosting.

Binary Search

Binary search is the most efficient searching algorithm having a run-time complexity of O(log2 N). This algorithm works only on a sorted list of elements.

Binary search begins by comparing the middle element of the list with the target element. If the target value matches the middle element, its position in the list is returned. If it does not match, the list is divided into two halves. The first half consists of the first element to middle element whereas the second half consists of the element next to the middle element to the last element.

binary-search

Course link

Added on 07.Mar.2019
Tags: binary search algorithm

How To Route Web Traffic Securely Without a VPN Using a SOCKS Tunnel

digitalocean

ssh -D 8123 -f -C -q -N sammy@example.com
  • -D: Tells SSH that we want a SOCKS tunnel on the specified port number (you can choose a number between 1025-65536)
  • -f: Forks the process to the background
  • -C: Compresses the data before sending it
  • -q: Uses quiet mode
  • -N: Tells SSH that no command will be sent once the tunnel is up

Added on 27.Feb.2019
Tags: ssh route socks tunnel proxy

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