Archive for March, 2017


25 Mar 2017

javascript easy templates

13:51 | javascript, tricky | 667 views

Goal: build a quick template method So we have an item template and some values to replace. Do like this way. // 1. define the parser function template(strings, …keys) { return (function(…values) { var dict = values[values.length – 1] || {}; var result = [strings[0]]; keys.forEach(function(key, i) { var value = Number.isInteger(key) ? values[key] : […]


25 Mar 2017

javascript multiline strings in the code

13:40 | javascript, tricky | 707 views

Goal: use multiline strings in the code I have a simple string template. I want to store it in a variable but I want to forget the concatenation. We can use the following trick. var itemTemplate = `<li> <div class=”direction-r”> <div class=”flag-wrapper”> <span class =”flag”>${0}</span> <span class =”time-wrapper”>${1}</span> </div> <div class =”desc”>${2}</div> </div> </li>`; console.log(itemTemplate); […]


13 Mar 2017

chrome t-rex fun

1:48 | fun | 669 views

Goal: there is no at this time 🙂 open in chrome the following chrome://network-error/-106 and press space bar or arrow up enjoy…


8 Mar 2017

Detect AD Blocker

2:09 | javascript | 664 views

Goal: do we have AD blocker or not? something like this: enjoy…



#sidebar a { color:#fff; } #sidebar ul ul li { color: #DEF585; } #sidebar h2 { color: #fff; } #sidebar ul p, #sidebar ul select { color: #BEDDBE; } #backfly { background: url(images/golfBallWallPaper.jpg) left bottom fixed repeat-x #65a51d; }