Blog Spot!


How to test if a string is JSON or not?

function isJson(str) {
    try {
        JSON.parse(str);
    } catch (e) {
        return false;
    }
    return true;
}

stackoverflow

Added on 27.May.2015
Tags: json js validate

9 Great Mate Themes

One of the best things about being a MATE user is the fact that everything is super stable and reliable. This desktop environment hasn’t changed its looks in quite a long time. Everything is nearly like the way it looked in 2002.

This can be a good thing when it comes to usability. It’s tried and true. On the other hand, the MATE desktop doesn’t look very modern. The default themes it ships with aren’t very attractive, and overall it seems like it needs a face-lift.

Check out these nine themes that look great in the MATE desktop environment!

article

Two very nice, tested and working themes + icon set.
Ambiance & Radiance Flat
Vibrancy Colors Icon

Added on 19.May.2015
Tags: themes linux mate icons

Reconfiguring the audio ports is this easy under linux

To find the tool to reconfigure the audio ports is this easy under Ubuntu 14.04.1 LTS.

sudo apt-get install alsa-tools-gui
hdajackretask

askubuntu

Added on 18.May.2015
Tags: audio ports linux alsa tools gui

A utility to accurately report the core memory usage for a program

ps_mem

Usage:

ps_mem [-h|--help] [-p PID,...] [-s|--split-args] [-t|--total] [-w N]

Example output:

 Private  +   Shared  =  RAM used       Program

 34.6 MiB +   1.0 MiB =  35.7 MiB       gnome-terminal
139.8 MiB +   2.3 MiB = 142.1 MiB       firefox
291.8 MiB +   2.5 MiB = 294.3 MiB       gnome-shell
272.2 MiB +  43.9 MiB = 316.1 MiB       chrome (12)
913.9 MiB +   3.2 MiB = 917.1 MiB       thunderbird
---------------------------------
                          1.9 GiB
=================================

Added on 12.May.2015
Tags: utility memory python

Define a Get Elements By Attribute Javascript function.

Recursive functions can be very effective in manipulating tree structures such as the browser’s Document Object Model (DOM). Each recursive call is given a smaller piece of the tree to work on.

// Javascript - The Good Parts page: 35
var walkTheDom, getElementsByAttribute;

Define a walkTheDom function that visits every node of the tree in HTML source order, starting from some given node. It invokes a function, passing it each node in turn. walkTheDom calls itself to process each of the child nodes.

walkTheDom = function walk(node, funk) {
    funk(node);
    node = node.firstChild;
    while(node) {
        walk(node, funk);
        node = node.nextSibling;
    }
};

Define a getElementsByAttribute function. It takes an attribute name string and an optional matching value. It calls walkTheDom, passing it a function that looks for an attribute name in the node. The matching nodes are accumulated in a results array.

getElementsByAttribute = function(att, value) {
    var results = [];

    walkTheDom(document.body, function(node) {
       var actual = node.nodeType === 1 && node.getAttribute(att);
       if (typeof actual === 'string' &&
              (actual === value || typeof value !== 'string')) {
           results.push(node);
       }
    });

    return results;
};

Added on 10.May.2015
Tags: js node dom

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