Blog Spot!


Git useful hints

Built-in git GUI

gitk

Use colorful git output

git config color.ui true

Show log on just one line per commit

git config format.pretty oneline

Use interactive adding

git add -i

git-guide

Added on 07.Apr.2017
Tags: git useful configs

Variable name as a string in Javascript

var varToString = function(varObj) {
    return Object.keys(varObj)[0]
}

var someVar = 42;

console.log(varToString({someVar}));

stackoverflow

Added on 07.Apr.2017
Tags: js nodejs function name

Change underscore template setings

// change underscore template setings
_.templateSettings = {
    evaluate: /\{%([\s\S]+?)%\}/g,
    interpolate: /\{\{([\s\S]+?)\}\}/g,
    escape: /\{\{-([\s\S]+?)\}\}/g
};
  • evaluate JavaScript: {% %}
  • print raw variables: {{ }}
  • print escaped variables: {{- }}

Added on 07.Apr.2017
Tags: underscore js templates settings

Teach a Dog to REST, nice tutorial video

At the Cloudstock hackathon December 6th, 2010, Brian Mulloy presented "Teach a Dog to REST," asking the question: where are all the elegant REST APIs we'd all hoped to see? While many claim REST has arrived, many APIs in the wild exhibit arbitrary, productivity-killing deviations from true REST.

ScreenShot

Added on 30.Mar.2017
Tags: rest video api

Twitter Bootstrap - Tabs - change URL's hash

Enable hash in the url for routing in Backbone when using bootstrap tabs

Try this code. It adds tab href to url + opens tab based on hash on page load:

$(function(){
  var hash = window.location.hash;
  hash && $('ul.nav a[href="' + hash + '"]').tab('show');

  $('.nav-tabs a').click(function (e) {
    $(this).tab('show');
    var scrollmem = $('body').scrollTop() || $('html').scrollTop();
    window.location.hash = this.hash;
    $('html,body').scrollTop(scrollmem);
  });
});

stackoverflow

Added on 29.Mar.2017
Tags: bootstrap backbone tabs tab hash url

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