Skip to content

Instantly share code, notes, and snippets.

View cld-santos's full-sized avatar

Claudio Santos cld-santos

View GitHub Profile
@cld-santos
cld-santos / jsbin.PoolOfCalls.html
Last active August 29, 2015 14:00
This samples show how to enable a pool of requests made by multiples clicks on a html button for example.
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Multiple clicks trigger a pool of executed functions" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<input id="txtMsg" type="text"/>
@cld-santos
cld-santos / jsbin.thisKeyword.js
Last active August 29, 2015 14:00
This sample show how the 'this' keyword refer to a different objects, and thoose scopes are both, global or object related depends on where are you in the current moment.
console.clear();
function Blog(){
//bad pratice avoid this
//if (!(this instanceof blog))
// return new blog();
function internal(){
console.log('internal:' + this);
@cld-santos
cld-santos / jsbin.closure.js
Last active August 29, 2015 14:00
How closure works guided by code.
console.clear();
console.log('init Test');
var globalVar = "global";
function myObject(value){
var test="private"+value;
this.testLog = function(){
console.log(test + ":" + globalVar);
};
@cld-santos
cld-santos / quick-edit-panel.css
Last active August 29, 2015 14:00
This sample shows how to implement a quick insert panel to able users to quickly register information using desktop, smartphone and tablets devices.
.prompt{
padding:5px;
background-color:black;
height:28px;
color:white;
font-family:courier;
}
@cld-santos
cld-santos / recursiveArray.js
Created October 25, 2013 00:54
This sample shows how to iteratate through a multidimensional array avoiding the closure issue.
console.clear();
function printRecursiveArray(value, c){
for(c=0; c<value.length; c++){
if (typeof value[c] !=='object'){
console.log(value[c]);
}else{
printRecursiveArray(value[c],0);
}
}
}