Tuesday, June 9, 2015

Search a file with matching a pattern under directory in linux, unix ..

Run this command
grep -H -r [pattern] [directory]

 pattern - Replace this with your custom patter
 directory - Replace this with your custom patter
-H : means to print the filename for each match.
-r : Read all files under each directory, recursively;


Tuesday, February 24, 2015

Javascript closure simple example snippet

<p>Counting with a local variable.</p>
<button type="button" onclick="myFunction()">Count!</button>
<button type="button" onclick="setFunction()">set!</button>
<p id="demo">0</p>
<script>
var add = (function () {
var counter = 0;
return {
get:function(){ return counter += 1},
set:function(x){ counter = x; return counter;}
}
})();
function myFunction(){
document.getElementById("demo").innerHTML = add.get();
}
function setFunction(){
document.getElementById("demo").innerHTML = add.set(5);
}
</script>
view raw gistfile1.txt hosted with ❤ by GitHub
Demo
Counting with a local variable.

0


Wednesday, January 7, 2015

How to make triangles or arrows using css border width


h2.entry-title { position: relative; }
h2.entry-title:after { content: ""; border-width: 15px; position: absolute; left: 179px; top: -4px; border-style: solid; border-left-width: 0; border-right: 15px solid green; border-left: 15px solid yellow; }

with all borders



h2.left-triangle:after { border:15px solid transparent; border-right: 15px solid green; }

left triangle



h2.right-triangle:after { border:15px solid transparent; border-left: 15px solid green; }

right triangle



h2.top-triangle:after { border:15px solid transparent; border-bottom: 15px solid green; }

top triangle



h2.down-triangle:after { border:15px solid transparent; border-top: 15px solid green; }

down triangle