Blog Spot!


Using Modern CSS to Build a Responsive Image Grid

Added on 29.Jan.2016
Tags: css design image responsice grid

JavaScript Replace object-based values in text

if (typeof String.prototype.supplant !== 'function') {
    String.prototype.supplant = function (o) {
        return this.replace(/{{([^{}]*)}}/g, function (a, b) {
            var r = o[b];
            return typeof r === 'string' ? r : a;
        });
    };
}

var obj = {
    a: "text",
    b: "text 2",
    c: "text 3"
}

var stringA = "http://{{a}}.something.com/",
    stringB = "http://something.{{b}}.com/",
    stringC = "http://something.com/{{c}}";

alert(stringA.supplant(obj));

stackoverflow

Added on 28.Jan.2016
Tags: js replace template function

Best resources to learn JavaScript

Added on 28.Jan.2016
Tags: js

Escape HTML tags in JavaScript

function escapeHTML(text) {  
    var replacements = {
        "<": "&lt;",
        ">": "&gt;",
        "&": "&amp;",
        "\"": "&quot;"
    };

    return text.replace(/[<>&"]/g, function(character) {  
        return replacements[character];  
    }); 
}

Added on 28.Jan.2016
Tags: escape escaping html js function

Shuffle JavaScript Array

var list = [1,2,3,4,5,6,7,8,9];

list = list.sort(function() {
    return Math.random() - 0.5;
});

console.log(list);

Added on 28.Jan.2016
Tags: js shuffle array function advanced tricks

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