This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shareOnFacebookButton() { | |
var dynamicUrl = "https://www.facebook.com/sharer/sharer.php" | |
+ "?" | |
+ "u=" + window.location.href; | |
var fbButton = document.createElement("a"); | |
fbButton.id = "facebook-url"; | |
fbButton.href = dynamicUrl; | |
fbButton.innerText = "Share on Facebook"; | |
document.body.appendChild(fbButton); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createXMLHttpRequest() { | |
var xhr = new XMLHttpRequest(); | |
xhr.open("GET", "url"); // Method GET or POST | |
xhr.onload = function(e) { | |
console.log(xhr.responseText); | |
}; | |
xhr.send(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function secondsToTime(secs) | |
{ | |
var hours = Math.floor(secs / (60 * 60)); | |
var divisor_for_minutes = secs % (60 * 60); | |
var minutes = Math.floor(divisor_for_minutes / 60); | |
var divisor_for_seconds = divisor_for_minutes % 60; | |
var seconds = Math.ceil(divisor_for_seconds); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This functions needs JQuery and Three DOM objects | |
* with id minutes, seconds and hours. | |
*/ | |
function progresiveCounter() { | |
var seconds = 0; | |
var minutes = 0; | |
var hours = 0; | |
var strSeconds = ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function webViewExecuteCode() { | |
webview.executeScript({ code: "document.body.style.backgroundColor = 'red'" }); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setInterval(function() { | |
// Execute ever single second. | |
}, 1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setTimeout(function() { | |
// Wait until 1 second to execute this. | |
}, 1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JSON.stringify(jsonObject); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JSON.parse(stringValue); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#idOfTheDiv { | |
width: 400px; /* here you put the width that you need */ | |
height: 200px; /* here you put the height that you need */ | |
position:absolute; | |
left:50%; | |
top:50%; | |
margin-left:-200px; /* this number always to be the width divided two in negative */ | |
margin-top:-100px; /* this number always to be the height divided two in negative */ | |
} |